Lepidolite ore image segmentation method based on improved SAM model
By improving the SAM model, using dynamic layered distillation and expansion of flash attention mechanisms, the problems of slow processing speed and poor adaptability of lithium mica detection methods are solved, and the rapid and accurate segmentation of lithium mica images is achieved, which is suitable for industrial-level Quick detection.
Patent Information
- Application Number
- CN202411494415.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-02-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing lithium mica mine detection methods are slow to process and poorly adaptable, making it difficult to meet the needs of rapid industrial testing.
Using an improved SAM model, the sample data set is constructed by collecting and labeling lithium mica ore images, and the SAM model is improved through dynamic layered distillation and expansion of flash attention mechanisms to improve the efficiency and accuracy of image segmentation.
It realizes rapid and accurate segmentation of lithium mica images, improves detection efficiency and adaptability, and is suitable for industrial-level rapid detection.
Smart Images

Figure CN119478398A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of machine vision, and in particular to a lepidolite ore image segmentation method based on an improved SAM model. Background Art
[0002] As lithium is widely used in industries such as batteries, glass, and ceramics, the demand for lithium resources continues to increase. Efficient and accurate identification and extraction of lithium mica has become one of the key tasks in the mining industry. In the mining and processing of lithium mica, impure separation of mica, feldspar, and quartz is a common and thorny problem. This not only affects the extraction efficiency of lithium resources, but also leads to lower product quality. The Lithium Mineral Segmentation System (LMSS) is designed to accurately and quickly detect and analyze the purity of mineral separation to ensure that the extraction purity and utilization efficiency of lithium mica always remain within the ideal range.
[0003] The traditional way for lithium mica beneficiation to judge the purity of mineral separation in finished products is mainly chemical analysis. This method has brought important challenges to the beneficiation operation due to its long cycle, high cost, and consumption of a large amount of human resources. Therefore, the traditional chemical detection method is not very effective in dealing with emergencies. Since the components of lithium are mainly present in mica, this chemical analysis can actually be regarded as a special defect detection, which has been widely studied and applied in academia and industry. The current defect detection methods can be roughly divided into four categories: the first is the detection network, which directly uses the target detection model or improves it on this basis; the second is the classification network, which first classifies normal samples and defective samples, and then classifies the defect types; the third is the segmentation network, which converts defect detection into semantic segmentation of defective areas and normal areas; the last is the combination network, which cascades the detection network and the classification network, first locates the defect position, and then classifies the defect type. With the rapid development of image segmentation technology, the SAM large model (Segment Anything) proposed in 2023 aims to achieve efficient and extensive automatic segmentation tasks. Its main features include automatic segmentation capability and wide versatility, and it can accept prompt information such as points, boxes, masks, etc. to improve the precision and accuracy of segmentation. However, the SAM segmentation model requires a large amount of memory and has a slow processing speed, making it unsuitable for rapid industrial detection.
[0004] In addition, when using the above method to perform lithium mica ore segmentation detection, there is still a problem of poor detection effect of some pictures. This is because the pictures taken by the electron scanning microscope are too large, resulting in slow processing speed, and because the computer has no prior knowledge of lithium mica ore, these problems will cause great trouble to the computer. Summary of the invention
[0005] The invention provides a lepidolite image segmentation method based on an improved SAM model, so as to solve the technical problems of slow processing speed and poor adaptability existing in the existing lepidolite detection method.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] On the one hand, the present invention provides a method for segmenting a lithium mica ore image based on an improved SAM model, and the method for segmenting a lithium mica ore image based on the improved SAM model comprises:
[0008] Collect and annotate lepidolite ore images to construct a sample data set;
[0009] Improve the SAM model to obtain the image segmentation model;
[0010] Using the sample data set to train the image segmentation model;
[0011] The lepidolite ore image to be segmented is input into the trained image segmentation model to obtain the segmentation result.
[0012] Furthermore, the collecting of the lepidolite ore image includes:
[0013] Spread the lepidolite ore flat on a glass slide;
[0014] Images of the lithium mica ore spread on a glass slide under an electron scanning microscope are collected from different angles to obtain diverse images of the lithium mica ore.
[0015] Furthermore, the labeling of the collected lepidolite ore images includes:
[0016] Annotating the collected lepidolite ore image by using the SAM model to obtain a first original annotated image;
[0017] The first original annotated image is corrected using a preset annotation tool to obtain a second original annotated image, and the second original annotated image is used as an annotated image of the corresponding lepidolite ore image.
[0018] Furthermore, constructing the sample data set includes:
[0019] Convert the format of the lepidolite ore image and its corresponding annotated image;
[0020] The format-converted lepidolite images and their corresponding annotated images are divided into a training set and a validation set according to a preset ratio.
[0021] Furthermore, the SAM model is improved to obtain an image segmentation model, including:
[0022] The self-attention mechanism in the SAM model is replaced by the dilated flash attention mechanism to obtain an improved SAM model;
[0023] Taking the SAM model as the teacher model and the improved SAM model as the student model, the preset knowledge distillation method is used to transfer the knowledge from the SAM model to the improved SAM model to obtain the image segmentation model.
[0024] Furthermore, the preset knowledge distillation method is a dynamic layered distillation method.
[0025] Furthermore, the image segmentation model is trained using the sample data set, including:
[0026] First, the image segmentation model is trained using the data of the training set to form an initial image segmentation model; then, the data of the verification set is input into the initial image segmentation model to verify the image segmentation and generate a corresponding verification segmentation image; wherein the verification process includes comparing the verification segmentation image with the annotated image in the verification set and calculating the segmentation accuracy; comparing the calculated segmentation accuracy with a preset accuracy threshold, if the calculated segmentation accuracy is higher than the preset accuracy threshold, it means that the current image segmentation model has met the quality requirements of image segmentation, otherwise, the model does not meet the requirements.
[0027] Furthermore, the image of the lithium mica ore to be segmented is input into the trained image segmentation model to obtain a segmentation result, including:
[0028] The image of the lithium mica ore to be segmented is input into the trained image segmentation model, and the trained image segmentation model is used to segment the image of the lithium mica ore to be segmented into a mica image, a feldspar image and a quartz image.
[0029] On the other hand, the present invention further provides an electronic device, comprising a processor and a memory; wherein the memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the above method.
[0030] In yet another aspect, the present invention further provides a computer-readable storage medium, wherein at least one instruction is stored in the storage medium, and the instruction is loaded and executed by a processor to implement the above method.
[0031] The beneficial effects brought about by the technical solution provided by the present invention include at least:
[0032] The present invention uses a preset SAM model and a custom annotation tool to annotate the original lepidolite ore image collected under an electron scanning microscope to obtain an original annotated image; performs format conversion on the original lepidolite ore image and the original annotated image to obtain a target mineral image and a target annotated image; inputs the target mineral image and the target annotated image into a preset SAM model for training and verification to obtain an image segmentation model; obtains an annotated mineral image, and inputs the annotated mineral image into the image segmentation model for segmentation to obtain mica, feldspar and quartz segmentation images. The method has the advantages of high detection efficiency and strong adaptability, and has great application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0034] Figure 1 It is a schematic diagram of the execution flow of the lithium mica ore image segmentation method based on the improved SAM model provided in an embodiment of the present invention;
[0035] Figure 2 is an image of an original lepidolite ore provided by an embodiment of the present invention;
[0036] Figure 3 is the original marked image of the lepidolite ore provided by the embodiment of the present invention;
[0037] Figure 4 is a schematic diagram of the structure of an improved SAM model provided by an embodiment of the present invention;
[0038] Figure 5 Schematic diagram of the dynamic layered distillation principle provided by an embodiment of the present invention;
[0039] Figure 6 is a schematic diagram of the structure of the expanded flash attention mechanism provided by an embodiment of the present invention;
[0040] Figure 7 It is a system block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0041] In order to make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.
[0042] First of all, it should be noted that in the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplary" in the present invention should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of the word "exemplarily" is intended to present the concept in a concrete way. In addition, in the embodiments of the present invention, the meaning expressed by "and / or" can be both, or it can be either of the two.
[0043] First embodiment
[0044] This embodiment provides a method for segmenting a lithium mica ore image based on an improved SAM model. The method can be implemented by an electronic device. The execution flow of the method is as follows: Figure 1 As shown, the following steps are included:
[0045] S1, collecting and annotating the collected lepidolite ore images to construct a sample data set;
[0046] Specifically, in this embodiment, the implementation process of the above S1 is:
[0047] S11, spreading the lithium mica ore on a glass slide, and collecting the original lithium mica ore image under an electron scanning microscope; it should be noted that in the process of collecting the original lithium mica ore image, attention should be paid to the diversity of the lithium mica ore images as much as possible, and each lithium mica ore image should be as different as possible. During the photo shooting process, the ore should be spread on the glass slide as much as possible, and sampling is performed at different angles. In this way, the collected data set not only has rich and colorful ore data, but also can keep the segmented image clear. The original lithium mica ore image is as follows: Figure 2 shown.
[0048] S12, annotating the original lepidolite ore image collected under the electron scanning microscope through the preset SAM model and the custom annotation tool to generate an initial annotated image; the specific implementation process is as follows:
[0049] The original lithium mica ore image under the electron scanning microscope is annotated by the preset SAM model to obtain the first original labeled image; the first original labeled image is smeared and modified by the custom annotation tool to obtain the second original labeled image, and the second original labeled image is used as the original labeled image of the corresponding original lithium mica ore image. It should be noted that in this step, we first use the preset SAM model to automatically annotate the collected original lithium mica ore image to generate a preliminary annotated image. This step can significantly reduce the workload of manual annotation. Subsequently, we use the custom annotation tool to modify the details of the preliminary annotated image to generate a more refined second version of the original annotated image. Through the modification of this custom tool, we can not only ensure that the edges of the annotated image are precisely aligned with the edges of the original lithium mica ore image, but also further improve the efficiency of annotation. The tool used in this embodiment is the Grounded-SAM annotation tool. The Grounded-SAM annotation tool is selected instead of other annotation tools for this refinement process because, compared with other annotation tools, Grounded-SAM integrates SAM and BLIP, combining image segmentation and image detection capabilities. It can detect the segmentation of lithium mica ore at the same time, thereby reducing the overall annotation efficiency. The original lithium mica ore image is as follows: Figure 2 The corresponding original labeled image is shown in Figure 3 shown.
[0050] S13, converting the format of the original lepidolite ore image and the original marked image to obtain a target ore image and a target marked image.
[0051] It should be noted that, in this embodiment, after the initial lepidolite ore image is acquired, the next step is to convert the format of the original lepidolite ore image and the corresponding original labeled image. This conversion is to ensure that they can be recognized and read by the training platform. Through this conversion, the target lepidolite image and the target labeled image are obtained. The training platform is configured with a preset segmentation model.
[0052] S14, after obtaining the target mineral image and the target annotated image, these images are divided into a training set and a verification set according to a predetermined ratio. Specifically, in this embodiment, the ratio is set to 9:1, but according to actual needs, this ratio can be adjusted to 8:2 or other ratios, and the specific ratio is not strictly limited.
[0053] S2, improve the SAM model to obtain the image segmentation model;
[0054] It should be noted that this embodiment introduces a novel SAM structure, which significantly reduces the computational complexity. It uses a dynamic layered distillation (DLD) method to effectively transfer knowledge from ordinary SAM to the improved SAM model without affecting performance. In addition, the dilated flash attention mechanism is used to replace the original SAM self-attention mechanism to improve the efficiency and reasoning speed of the algorithm. Based on the improved model structure of SAM, Figure 4 shown.
[0055] The SAM model consists of three parts: image encoder, prompt encoder, and mask decoder. It is expensive to train the improved SAM from scratch. Therefore, after inputting a set of images, the image encoder of the original SAM is subjected to dynamic layered distillation (DLD) to extract the image embedding. The original SAM image encoder and prompt encoder (prompt embedding of output point prompts and box prompts) are frozen (i.e., the weights are not updated during training), while the lightweight image encoder and mask decoder are learnable. The image embedding and prompt embedding are input into the mask decoder to generate the segmentation mask. The process of dynamic layered distillation (DLD) is as follows: Figure 5 As shown in Figure 1, in this process, we introduced two core models: one is an experienced "teacher" model, and the other is a "student" model that is learning. The teacher model is a pre-trained model with excellent performance. It is built on the encoder of SAM, and its internal structure integrates multiple advanced modules, such as multi-head self-attention (MHA) and multi-layer perceptron (MLP). These modules work together on the input sample set to generate accurate output results. The student model is a more streamlined version that optimizes its own performance by learning the output of the teacher model. Although the student model is consistent with the teacher model in structure, it is appropriately reduced in size and complexity. It uses a lightweight self-attention mechanism, namely the fast self-attention mechanism (Lightening MHA), and a simplified version of the MLP module to adapt to its smaller model size.
[0056] It should be noted that in order to achieve effective knowledge transfer from the teacher model to the student model, this embodiment proposes an innovative dynamic hierarchical distillation (DLD) strategy. This method strengthens the layer-by-layer learning process between models by dynamically adjusting the importance weights of features. Specifically, when comparing the intermediate representations of two models, the DLD method calculates the loss function between them and adjusts it accordingly to optimize the learning effect of the student model. The specific dynamic hierarchical distillation process is as follows:
[0057] The first is to use dynamic split weights; when the previous layers are not well distilled, the performance of subsequent layers may be affected by the low-quality features extracted from the previous layers. By giving these initial layer losses a larger weight, dynamic weighting ensures that they receive more attention during training. This helps to better align the student model with the teacher model in the initial stages. Given a deep neural network consisting of L layers, each layer is associated with a temporal weight. This mechanism adjusts the importance of each layer in the neural network at various training stages. The initial layers maintain the maximum focus, and the subsequent layers follow the dynamic weighting scheme. This mechanism helps to achieve cascading knowledge absorption from the teacher model.
[0058] Next is decoupled feature distillation; the distillation process transfers knowledge from the teacher model to the student model, selecting the layers closest to the output for feature distillation. Since these deeper layers are directly related to the output of the model, distilling them can more effectively pass on key information to obtain prediction results. These layers are designated as "focus layers". In the initial stage of training, layers close to the input are given priority. The intention here is to represent the main features of the student model, represented as Feature representation with teacher model Alignment, with the feature representation of the teacher model, for the layer closest to the input. As training proceeds, the layer-by-layer weights are dynamically shifted. The losses associated with subsequent layers are gradually amplified. In this process, the loss function evolves to absorb representations from subsequent layers:
[0059]
[0060] It is also important to note that the lightweight image encoder obtained by disentangled distillation has alignment issues with the frozen decoder, especially for the point-based cue segmentation task. Therefore, we fine-tune the decoder to align with the image encoder by sampling point cues and box cues on the SA-1B dataset.
[0061] Furthermore, in order to solve the problem of high computational requirements in the SAM image encoder, this embodiment uses the attention mechanism to speed up the reasoning speed. Among them, a fast self-attention module is shown in the student model. The specific structure of this module is as follows Figure 6As shown in the figure, Q, K, and V represent query, key, and value, respectively, which are standard components of the Transformer architecture. The self-attention module is lightweight and uses Dilated Flash Attention to reduce computational complexity. The specific process is as follows:
[0062] We used segmentation and dilution to reduce the computational burden of processing (Q, K, V) in the attention operation. The input is segmented into segments of equal length in the sequence dimension and sparseness is applied. Rows at fixed intervals are selected to reduce the amount of data required for attention calculation. Secondly, FlashAttention parallel processing is used. After the input data is sparsely processed, each segment can participate in the attention calculation as an independent dense matrix to achieve parallel processing. This parallelization is crucial for the effective processing of large-scale data sets. It can significantly increase the processing speed and improve the efficiency of real-time image segmentation tasks. Finally, the output is reorganized. In the Dilated Flash Attention framework, the sparse segments are processed in parallel. The result of the transposed product is processed by the softmax function and Multiply and then recombine into a coherent final output , as shown below:
[0063]
[0064] The process mainly includes the following steps:
[0065] First, a zero matrix with the same dimension as the original input is built to accumulate the outputs of each segment.
[0066] Second, for each calculated segment output , determine a specific offset This offset Determined the final output The exact initial position in the zero matrix.
[0067] Finally, use the The mapping operation outputs each segment Mapped to a zero matrix.
[0068]
[0069] Among them, the "MAP" operation is based on the offset Determine the location of each output The elements are placed into the zero matrix. This ensures that the output of each segment is precisely aligned in the final output matrix according to its original input position.
[0070] The introduced Dilated Flash Attention mechanism has achieved a significant improvement in efficiency, increasing the efficiency by a factor of , where N represents the total size of the input, w represents the length of each segmentation, and r represents the interval of sparsification. Based on this mathematical principle, it can be understood that regardless of the scale of the input data, Dilated Flash Attention can effectively reduce the amount of computation required. This feature significantly improves the efficiency of the model in handling large-scale image segmentation tasks, thus bringing significant gains in performance and practicality.
[0071] S3, training the image segmentation model using the sample data set;
[0072] Specifically, in this embodiment, the implementation process of S3 is as follows: the target mineral image and the target annotated image are input into the improved SAM model for training and verification to obtain an image segmentation model. The model is trained using the training set data to form an initial image segmentation model. Subsequently, the verification set data is input into the initial model to verify the image segmentation and generate a corresponding verification segmentation image. The verification process includes comparing the verification segmentation image with the annotated image in the verification set data and calculating the segmentation accuracy. The specific operation is that if the verification segmentation image is completely consistent with the annotated image, a correct segmentation is recorded; then the next verification segmentation image is compared until all images are compared. Finally, the number of correct segmentations is divided by the total number of verification images to obtain the accuracy of the verification segmentation.
[0073] Next, the calculated verification segmentation accuracy is compared with the preset accuracy threshold. If the verification segmentation accuracy is higher than the preset threshold, it means that the initial image segmentation model has met the quality requirements of image segmentation. In this case, the initial model will be adopted as the final image segmentation model.
[0074] Understandably, if the segmentation accuracy obtained during the verification process fails to meet the preset standard, this indicates that the current initial image segmentation model has not yet achieved the required image segmentation quality. In this case, it is necessary to conduct an in-depth analysis of the images that failed in the verification segmentation to identify the specific scenarios that led to the segmentation failure, such as whether the ore is completely flat, whether it is stacked, etc. Among them, it should be noted that it may take a long time to train the segmentation model, usually about a day. After the training and verification are completed, the trained image segmentation model is saved to ensure that it has higher accuracy in practical applications.
[0075] S4, inputting the lepidolite ore image to be segmented into the trained image segmentation model to obtain a segmentation result.
[0076] Specifically, in this embodiment, after the image segmentation model is obtained, the image to be segmented is imported into the model to obtain the lithium mica ore segmentation image, and the specific components are mica image, feldspar image and quartz image.
[0077] In summary, this embodiment provides a method for segmenting a lithium mica ore image. First, the lithium mica ore is spread on a glass slide, and then the original lithium mica ore image collected under an electron scanning microscope is annotated through a preset SAM model and a custom annotation tool to generate an initial annotated image; then the original lithium mica ore image and the original annotated image are format-converted to obtain a target ore image and a target annotated image; the target mineral image and the target annotated image are input into a preset improved SAM model for training and verification to obtain an image segmentation model; the robustness of image segmentation is improved; finally, the lithium mica ore image is input into the image segmentation model for segmentation to obtain a lithium mica ore segmented image. The image segmentation model used in this embodiment has high adaptability and efficiency, and it can quickly and accurately segment a variety of images that have not been standardized and trained.
[0078] Second embodiment
[0079] This embodiment provides an electronic device, such as Figure 7 As shown, the electronic device includes: a processor and a memory; wherein the processor and the memory can be connected via a communication bus; the memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the method of the first embodiment. In addition, the electronic device may also include a transceiver, the processor and the transceiver can be connected via a communication bus, and the transceiver is used to communicate with other devices.
[0080] Next, combine Figure 7 The following is a detailed introduction to the various components of the electronic device:
[0081] Among them, the processor is the control center of the electronic device, and the electronic device may include multiple processors, each of which may be a single-core processor (single-CPU) or a multi-core processor (multi-CPU). The processor here may be a processor or a general term for multiple processing elements. For example, the processor is one or more central processing units (CPUs), or other general-purpose processors, application specific integrated circuits (ASICs), or one or more integrated circuits configured to implement an embodiment of the present invention, such as one or more microprocessors (digital signal processors, DSPs), or one or more field programmable gate arrays (field programmable gate arrays, FPGAs), or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor may execute various functions of the electronic device by running or executing software programs stored in the memory and calling data stored in the memory.
[0082] In a specific implementation, as an embodiment, the processor may include one or more CPUs, such as Figure 7 The CPU0 and CPU1 shown in the figure are, of course, only exemplary.
[0083] The memory is used to store the software program for executing the solution of the present invention, and the execution is controlled by the processor. The specific implementation method can refer to the above method embodiment, which will not be repeated here.
[0084] Optionally, the memory may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may be integrated with the processor or exist independently and accessed through the interface circuit ( Figure 7 The processor is coupled to the processor (not shown), which is not specifically limited in this embodiment of the present invention.
[0085] The transceiver may include a receiver and a transmitter ( Figure 7 The receiver is used to implement the receiving function, and the transmitter is used to implement the sending function. The transceiver can be integrated with the processor or exist independently and communicate with the electronic device through the interface circuit ( Figure 7 (not shown) is coupled to the processor, which is not specifically limited in this embodiment of the present invention.
[0086] In addition, it should be noted that Figure 7 The structure of the electronic device shown in the figure does not constitute a limitation on the device, and the actual device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. In addition, the technical effects achieved by the electronic device when executing the method of the first embodiment above can refer to the technical effects described in the first embodiment above, so they are not repeated here.
[0087] Third embodiment
[0088] This embodiment provides a computer-readable storage medium, which stores at least one instruction, and the instruction is loaded and executed by a processor to implement the method of the first embodiment. The computer-readable storage medium may be a ROM, a random access memory, a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc. The instructions stored therein may be loaded by a processor in a terminal to execute the method.
[0089] In addition, it should be noted that the present invention can be provided as a method, an apparatus or a computer program product. Therefore, the embodiment of the present invention can be in the form of a full or partial hardware embodiment, a full or partial software embodiment or an embodiment combining software and hardware. Moreover, when implemented using software, the embodiment of the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program codes. The computer program product includes one or more computer instructions or computer programs. When the computer instructions or computer programs are loaded or executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center containing one or more available media sets. The available medium may be a magnetic medium (eg, a floppy disk, a hard disk, a magnetic tape), an optical medium (eg, a DVD), or a semiconductor medium. The semiconductor medium may be a solid state drive.
[0090] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods, terminal devices (systems), and computer program products according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, an embedded processor, or other programmable data processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0091] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, so that a series of operation steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable terminal device provide for implementing the process in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0092] It should also be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. The terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that the process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of more restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements. In addition, the term "and / or" is only an association relationship describing the associated objects, indicating that there can be three relationships, for example, A and / or B, which can represent: A exists alone, A and B exist at the same time, and B exists alone, wherein A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the objects before and after are in an "or" relationship, but it may also indicate an "and / or" relationship. Please refer to the context for specific understanding. "At least one" means one or more, and "plurality" means two or more. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can be represented by: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or plural.
[0093] In addition, it can be understood that in various embodiments of the present invention, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present invention.
[0094] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0095] In several embodiments provided by the present invention, it should be understood that the disclosed equipment, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of functional modules / units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point, the coupling or direct coupling or communication connection between each other shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms. The unit described as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit.
[0096] If the method is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0097] Finally, it should be noted that the above is only a preferred embodiment of the present invention. It should be pointed out that although the preferred embodiment of the present invention has been described, for ordinary technicians in this technical field, once the basic creative concept of the present invention is known, several improvements and modifications can be made without departing from the principles of the present invention. These improvements and modifications should also be regarded as the protection scope of the present invention. Therefore, the attached claims are intended to be interpreted as including the preferred embodiment and all changes and modifications that fall within the scope of the embodiments of the present invention.
Claims
1. A method for segmenting a lithium mica ore image based on an improved SAM model, characterized in that: include: Collect and annotate lepidolite ore images to construct a sample data set; Improve the SAM model to obtain the image segmentation model; Using the sample data set to train the image segmentation model; The lepidolite ore image to be segmented is input into the trained image segmentation model to obtain the segmentation result.
2. The method for segmenting the lepidolite ore image based on the improved SAM model as claimed in claim 1, characterized in that: The collecting of lepidolite ore images comprises: Spread the lepidolite ore flat on a glass slide; Images of the lithium mica ore spread on a glass slide under an electron scanning microscope are collected from different angles to obtain diverse images of the lithium mica ore.
3. The method for segmenting the lithium mica ore image based on the improved SAM model as claimed in claim 1, characterized in that: The step of labeling the collected lepidolite ore images includes: Annotating the collected lepidolite ore image by using the SAM model to obtain a first original annotated image; The first original annotated image is corrected using a preset annotation tool to obtain a second original annotated image, and the second original annotated image is used as an annotated image of the corresponding lepidolite ore image.
4. The method for segmenting the lithium mica ore image based on the improved SAM model as claimed in claim 1, characterized in that: The constructing of the sample data set includes: Convert the format of the lepidolite ore image and its corresponding annotated image; The format-converted lepidolite images and their corresponding annotated images are divided into a training set and a validation set according to a preset ratio.
5. The method for segmenting the lithium mica ore image based on the improved SAM model as claimed in claim 1, characterized in that: The SAM model is improved to obtain an image segmentation model, including: The self-attention mechanism in the SAM model is replaced by the dilated flash attention mechanism to obtain an improved SAM model; Taking the SAM model as the teacher model and the improved SAM model as the student model, the preset knowledge distillation method is used to transfer the knowledge from the SAM model to the improved SAM model to obtain the image segmentation model.
6. The method for segmenting the lithium mica ore image based on the improved SAM model as claimed in claim 5, characterized in that: The preset knowledge distillation method is a dynamic layered distillation method.
7. The method for segmenting the lithium mica ore image based on the improved SAM model as claimed in claim 4, characterized in that: Using the sample data set to train the image segmentation model includes: First, the image segmentation model is trained using the data of the training set to form an initial image segmentation model; then, the data of the verification set is input into the initial image segmentation model to verify the image segmentation and generate a corresponding verification segmentation image; wherein the verification process includes comparing the verification segmentation image with the annotated image in the verification set and calculating the segmentation accuracy; comparing the calculated segmentation accuracy with a preset accuracy threshold, if the calculated segmentation accuracy is higher than the preset accuracy threshold, it means that the current image segmentation model has met the quality requirements of image segmentation, otherwise, the model does not meet the requirements.
8. The method for segmenting the lepidolite ore image based on the improved SAM model as claimed in claim 1, characterized in that: The image of the lithium mica ore to be segmented is input into the trained image segmentation model to obtain the segmentation results, including: The image of the lithium mica ore to be segmented is input into the trained image segmentation model, and the trained image segmentation model is used to segment the image of the lithium mica ore to be segmented into a mica image, a feldspar image and a quartz image.
Citation Information
Patent Citations
Mica content detection device and method
CN117269164A
Segmentation all-in-one model optimization method and device based on memory efficient attention mechanism
CN118734899A
Cited By
Graphite ore image segmentation method based on improved YOLO11-seg model
CN120782783A
Lithium mineral microscopic image segmentation method and device
CN120808338A