Ore image segmentation optimization method and system based on edge detection
By using Canny edge detection with adaptive thresholds, pre-trained SAM model segmentation and CRF model optimization methods in ore image processing, the problem of complex boundary and noise processing in ore image segmentation is solved, and the accuracy and robustness of the segmentation results are significantly improved.
Patent Information
- Application Number
- CN202411740503.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-04-11
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When processing ore images, it is difficult to effectively deal with complex boundaries, noise and different image characteristics, resulting in a decrease in accuracy and efficiency of segmentation results, a decrease in boundary smoothness and consistency, affecting the practicality and clarity of segmentation results.
The ore image segmentation optimization method based on edge detection is adopted, and the ore particle images are obtained for preprocessing, and the edge images are extracted using the Canny edge detection algorithm with adaptive thresholds, and the edge images are segmented in combination with the pre-trained SAM model. The segmentation mask is then optimized using the CRF model and area filtering is performed to retain the target area.
It effectively improves the smoothness and consistency of segmentation boundaries, reduces noise and boundary errors, improves the accuracy and robustness of segmentation results, enables the segmentation model to better adapt to changes in the image, and improves the practicality and clarity of segmentation results.
Smart Images

Figure CN119810126A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of image processing, and in particular to an ore image segmentation optimization method and system based on edge detection. Background Art
[0002] Edge detection is an image processing technology used to identify locations in an image where pixel values change significantly (i.e., edges). Edges usually represent boundaries of objects in the image or significant feature areas. The ore image segmentation optimization method uses edge detection to extract structural information of ore images, combined with deep learning models and optimization techniques to accurately segment ore areas and exclude background or noise.
[0003] As an important part of the earth's resources, ore plays an irreplaceable role in the development of industry, agriculture, energy, science and technology. Segmentation and optimization of ore images can accurately extract the structure and boundary information of the ore, thereby improving the detection and analysis accuracy of ore particles, improving the reliability and accuracy of data, and facilitating applications such as geological research, automated detection of industrial production lines, mineral classification and resource assessment, reducing manual operations, improving analysis efficiency and scientific decision-making, and is crucial for the identification of ore components, statistics of particle size distribution, and evaluation of ore quality.
[0004] When traditional segmentation technology is used to segment photos of mineral particles taken under an electron microscope, due to problems such as irregular powder particles, high-density accumulation, occlusion, light and shadow influence, insufficient boundary processing, and sensitivity to noise and small areas, the SAM model has certain disadvantages in dealing with complex boundaries, coping with noise, and adapting to different image characteristics, resulting in noise and boundary errors in segmentation, reduced segmentation accuracy and efficiency, increased recognition difficulty, and reduced smoothness and consistency of segmentation boundaries, affecting the practicality and clarity of the segmentation results. Summary of the invention
[0005] In order to solve the technical problems that the SAM model in the prior art lacks the ability to process complex boundaries, deal with noise, and adapt to different image characteristics, resulting in certain disadvantages, such as noise and boundary errors in segmentation, decreased segmentation result accuracy and efficiency, increased recognition difficulty, decreased smoothness and consistency of segmentation boundaries, and affecting the practicality and clarity of segmentation results, the present invention provides an ore image segmentation optimization method and system based on edge detection.
[0006] The technical solution provided by the embodiment of the present invention is as follows:
[0007] First aspect
[0008] An embodiment of the present invention provides an ore image segmentation optimization method based on edge detection, comprising:
[0009] S1: Acquire an image of ore particles having ore to be detected;
[0010] S2: preprocessing the ore particle image;
[0011] S3: extracting the edge image of the preprocessed ore particle image by using the Canny edge detection algorithm with adaptive threshold;
[0012] S4: Combined with the ore particle image, the edge image is segmented through the pre-trained SAM model to obtain a segmentation mask marking the edge image boundary;
[0013] S5: inputting the ore particle image and the segmentation mask into the CRF model, optimizing the segmentation mask with the goal of minimizing the energy function value in the CRF model, and obtaining an optimized segmentation mask;
[0014] S6: performing area filtering based on an area threshold on the optimized segmentation mask, and retaining a target area representing the ore to be detected in the ore particle image;
[0015] S7: Output the target area as the segmentation result of the ore particle image.
[0016] Second aspect
[0017] An embodiment of the present invention provides an ore image segmentation optimization system based on edge detection, comprising:
[0018] processor;
[0019] A memory having computer-readable instructions stored therein, wherein when the computer-readable instructions are executed by the processor, the ore image segmentation optimization method based on edge detection as in the first aspect is implemented.
[0020] The third aspect
[0021] An embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the ore image segmentation optimization method based on edge detection as described in the first aspect is implemented.
[0022] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0023] In the present invention, an image of ore particles with ore to be detected is obtained and the ore particle image is preprocessed to ensure that the input format and size of the image meet the subsequent processing requirements. Then, the edge image of the preprocessed ore particle image is extracted by a Canny edge detection algorithm with an adaptive threshold. The edge image is segmented by a pre-trained SAM model in combination with the ore particle image to obtain a segmentation mask marking the edge image boundary. Subsequently, the segmentation mask is optimized with the goal of minimizing the energy function value in the CRF model. The CRF optimization effectively improves the smoothness and consistency of the segmentation boundary by considering the spatial relationship and similarity between pixels. Finally, the optimized image is segmented by a pre-trained SAM model. The segmentation mask is used to perform area filtering based on area threshold, and the target area representing the ore to be detected in the ore particle image is retained, and the target area is output as the segmentation result of the ore particle image, thereby ensuring that the segmentation result focuses on important target objects, improving the segmentation accuracy of the ore, effectively reducing the noise and boundary errors in the preliminary segmentation, enhancing the context understanding ability of the deep learning model, improving the accuracy of the segmentation results, and enhancing the robustness of the segmentation, so that the segmentation model can better adapt to changes in the image, ensuring the overall accuracy and robustness of the segmentation task, and improving the practicability of the segmentation results, especially in lithium ore images with more noise or complex background, making the segmentation results clearer and more reliable. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] 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.
[0025] Figure 1 A schematic diagram of a flow chart of an ore image segmentation optimization method based on edge detection provided by an embodiment of the present invention;
[0026] Figure 2 A schematic structural diagram of an ore image segmentation optimization system based on edge detection provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0027] The technical solution of the present invention is described below in conjunction with the accompanying drawings.
[0028] 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 "example" 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 "example" is intended to present the concept in a specific 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.
[0029] In order to make the technical problems, technical solutions and advantages to be solved by the present invention more clear, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.
[0030] Reference Manual Attached Figure 1 , shows a schematic flow chart of an ore image segmentation optimization method based on edge detection provided in an embodiment of the present invention.
[0031] The embodiment of the present invention provides an ore image segmentation optimization method based on edge detection, which can be implemented by an ore image segmentation optimization device based on edge detection, and the ore image segmentation optimization device based on edge detection can be a terminal or a server. The processing flow of the ore image segmentation optimization method based on edge detection can include the following steps:
[0032] S1: Acquire an image of ore particles having ore to be detected.
[0033] Among them, the ore to be tested refers to the target ore that needs to be analyzed or identified, usually refers to a specific type of ore sample, whose image is input into the system for processing. The ore particle image is a digital image of ore powder obtained by a microscope, camera or other imaging equipment, which usually reflects the size, shape, distribution and boundary characteristics of the ore particles.
[0034] It should be noted that by acquiring images of ore powder, the microstructure of the ore particles can be intuitively displayed, providing the necessary visual information for subsequent segmentation and optimization. At the same time, this step can support efficient batch testing of ore samples, reduce the uncertainty of manual observation, and improve the standardization and comparability of data.
[0035] S2: Preprocessing the ore particle image.
[0036] Among them, preprocessing refers to reading and standardizing the image, and performing standardization according to the type of image to ensure that the input format and size of the image are suitable for subsequent processing steps. By preprocessing the ore image, the efficiency and accuracy of the subsequent algorithm are significantly improved. Adjusting the image size can unify the input standard and reduce the computational complexity. Converting the image to a grayscale image can remove the interference of color information and focus on the extraction of structural features.
[0037] In a possible implementation, S2 specifically preprocesses the ore particle image, including adjusting the image size and adjusting the image grayscale.
[0038] Among them, the image is preprocessed, including adjusting the resolution (size) of the image to adapt to the input requirements of the algorithm, and converting the image into a grayscale image to simplify the calculation. Through this process, computing resources can be used more efficiently, and ore image samples of different resolutions can be adapted to meet actual application needs.
[0039] S3: Extract edge images of the preprocessed ore particle images through the Canny edge detection algorithm with adaptive threshold.
[0040] Among them, the adaptive threshold is a threshold that is dynamically adjusted according to the image content and is used to distinguish edge and non-edge pixels. The Canny edge detection algorithm is a classic edge detection method. Combined with Gaussian blur, gradient calculation, non-maximum suppression and double threshold edge connection, it can effectively detect significant edges in the image. The edge image refers to the image generated by the edge detection algorithm, which contains significant boundary information in the ore image and serves as an important basis for subsequent segmentation.
[0041] It should be noted that the improved Canny edge detection algorithm can dynamically adapt to the complex characteristics of ore images and extract more accurate and complete edge information. The introduction of adaptive thresholds solves the shortcomings of traditional fixed threshold methods in images with uneven brightness or large contrast changes, ensuring the robustness of edge detection.
[0042] In a possible implementation, S3 specifically includes:
[0043] S301: Calculate the grayscale median of the ore particle image:
[0044] v = median(I)
[0045] Among them, v represents the grayscale median, I represents the grayscale value matrix of the input ore particle image, and median represents the median symbol.
[0046] S302: Calculate the adaptive threshold according to the grayscale median:
[0047] T low =max(0,(1-σ)×v)
[0048] T high =min(255,(1+σ)×v)
[0049] Among them, T low represents the first threshold, T highrepresents the second threshold, σ represents the control factor, max represents the maximum value, and min represents the minimum value.
[0050] S303: extracting the edge image of the ore particle image according to the adaptive threshold.
[0051] It should be noted that the Canny edge detection with adaptive threshold can dynamically adjust the edge detection parameters according to the changes in image brightness and contrast, so as to more accurately extract the edges of subtle structures, effectively eliminate noise interference and retain key structural information, and provide high-quality boundary features for subsequent segmentation. Through the generation of edge images, this step lays the foundation for the precision and accuracy of ore image segmentation.
[0052] In a possible implementation manner, S303 specifically includes:
[0053] S3031: Smoothing the ore particle image through a Gaussian blur algorithm to obtain a denoised image.
[0054] Among them, the Gaussian blur algorithm is a common image processing method, which is used to smooth and reduce noise on images. It reduces isolated noise points in the image by adding the pixel value and the pixel value of its surrounding neighborhood according to the Gaussian distribution weight, while retaining the main structural features. The denoised image refers to an image with some random noise removed after being processed by methods such as Gaussian blur. It appears smoother and easier to analyze, and is suitable for subsequent operations such as edge detection.
[0055] S3032: Calculate the gradient strength and gradient direction of the denoised image.
[0056] Among them, the gradient intensity refers to the magnitude of the change in the grayscale value of each pixel in the image, reflecting the degree of change in the image brightness. The gradient direction is the direction of the grayscale value change, usually expressed as an angle.
[0057] S3033: retain the local maximum point in the gradient intensity, and use the local maximum point as the edge pixel point of the ore particle image, and remove the remaining pixel points in the ore particle image.
[0058] Among them, edge points are pixels with local maximum gradient intensity, which are considered to be edge pixels in the image and represent areas with the most significant changes in grayscale values. Other edge pixels refer to pixels that are not identified as local maximum gradient intensity. They are usually noise or non-edge pixels generated during edge detection and need to be removed.
[0059] S3034: Extract edge image according to adaptive threshold:
[0060]
[0061] Wherein, E(x,y) represents the edge image, (x,y)=1 represents (x,y) is an edge pixel, and (x,y)=0 represents (x,y) is a remaining pixel.
[0062] It should be noted that the combination of Gaussian blur and gradient calculation can effectively eliminate noise interference and retain key structural information, providing high-quality boundary features for subsequent segmentation. Through the generation of edge images, this step lays the foundation for the precision and accuracy of ore image segmentation.
[0063] S4: Combined with the ore particle image, the edge image is segmented through the pre-trained SAM model to obtain a segmentation mask marking the edge image boundary.
[0064] Among them, the SAM model (Segment Anything Model) is a pre-trained deep learning segmentation model that can generate accurate segmentation results based on the contextual information and specific annotation information in the input image. The segmentation mask refers to the binary image generated by the segmentation model, in which the target area (such as the ore boundary) is marked as the foreground and other areas are the background for subsequent processing.
[0065] It should be noted that through the pre-trained SAM model, combined with the contextual information of the edge image and the original ore image, an accurate segmentation mask can be generated. The powerful feature extraction capability of the deep learning model improves the robustness and adaptability of the segmentation. Even in complex ore images, the target area can be accurately identified. Compared with traditional algorithms, the SAM model can dynamically understand the relationship between edge information and contextual features, greatly reducing the work of manual parameter adjustment.
[0066] In a possible implementation manner, S4 is specifically:
[0067] The multi-channel input tensor composed of the ore particle image and the edge image is input into the pre-trained SAM model to learn the context information and edge information of the multi-channel input vector and generate a segmentation mask marking the edge image boundary:
[0068] M=SAM(X)
[0069] X=[I,E]
[0070] Among them, M represents the segmentation mask marking the edge image boundaries, SAM represents the SAM model, and X represents the multi-channel input tensor.
[0071] It should be noted that the segmentation mask provides high-quality initial segmentation results for subsequent optimization steps, speeds up the overall processing flow and improves the final segmentation effect, further improving the accuracy of segmentation.
[0072] S5: The ore particle image and the segmentation mask are input into the CRF model, and the segmentation mask is optimized with the goal of minimizing the energy function value in the CRF model to obtain an optimized segmentation mask.
[0073] Among them, the CRF (Conditional Random Field) model is a probabilistic graph model that combines local pixel information and global neighborhood relations to optimize image segmentation results. It improves the continuity and accuracy of segmentation boundaries by minimizing the energy function. The energy function value represents the optimization target of the segmentation result, which is composed of the single point score and neighborhood relationship score of the pixel. The goal is to adjust the mask pixel label and reduce the overall energy value so that the segmentation result is more in line with the characteristics of the target area.
[0074] It should be noted that by introducing the conditional random field (CRF) model, the preliminary segmentation mask is optimized to make the segmentation result more accurate and coherent. The CRF model combines the classification probability of local pixels and the relationship between neighborhood pixels. By minimizing the energy function, it can effectively correct the details of the segmentation boundary and avoid boundary breaks or excessive smoothing.
[0075] In a possible implementation, the energy function value includes a single point score and a neighbor relationship score of each pixel in the edge image.
[0076] Among them, the single point score is usually generated by a classification model or a segmentation model, which is the preliminary prediction probability of each pixel. The neighbor relationship score measures the similarity (such as color difference) and spatial consistency between pixels, and is used to constrain the label assignment of adjacent pixels to ensure smooth boundaries and coherent segmented areas.
[0077] It should be noted that the CRF model is widely used in image segmentation. It optimizes the segmentation results by combining the feature information of pixels (such as color, position) and neighborhood relations (such as similarity), making the segmented areas more coherent and the boundaries clearer.
[0078] In a possible implementation, S5 specifically includes:
[0079] S501: Input the ore particle image and segmentation mask into the CRF model.
[0080] S502: Determine the optimized segmentation mask with the goal of minimizing the energy function value in the CRF model:
[0081]
[0082] ψ u (y i )=-log(P(y i |M))
[0083]
[0084] Where E(y) represents the energy function value, Σ represents the summation symbol, and ψ u (y i ) represents the single-point score value of pixel i, y i represents the i-th pixel label set, y j represents the j-th pixel label set, ψ p (y i ,y j ) represents the neighbor relationship score between pixels i and j, log represents the logarithmic function, P(y i |M) represents the probability that pixel i belongs to label M, θ(y i ,y j ) represents the consistency weight between the i-th pixel label and the j-th pixel label, |I i -I j | represents the color difference between pixels i and j, exp represents the exponential function, and σ represents the scale parameter that controls the similarity.
[0085] It should be noted that CRF optimization effectively improves the smoothness and consistency of the segmentation boundary by considering the spatial relationship and similarity between pixels. CRF uses the color similarity and spatial consistency between pixels to improve the segmentation ability of complex areas. Overall, this step significantly enhances the robustness and accuracy of segmentation, providing more reliable results for subsequent analysis.
[0086] S6: performing area filtering based on an area threshold on the optimized segmentation mask, and retaining a target area in the ore particle image representing the ore to be detected.
[0087] Among them, the optimized segmentation mask is the segmentation result after optimization by the CRF model, which accurately marks the target area of the ore structure and removes pixels with blurred boundaries or uncertain classification. The area threshold is a set minimum area standard used to screen connected areas. Areas smaller than the threshold are regarded as noise or invalid targets and are removed.
[0088] Those skilled in the art can set the size of the area threshold according to actual conditions, and the present invention does not limit this.
[0089] It should be noted that the area filtering step removes noise and irrelevant small areas, ensuring that the segmentation results are concentrated on important target objects. The overall process significantly improves the segmentation accuracy of lithium ore and facilitates its subsequent processing. The area filtering technology is used to intelligently remove noise and irrelevant small areas in the segmentation results. This step ensures that the segmentation results are more focused on the main target objects and reduces interference from irrelevant areas.
[0090] In a possible implementation, S6 specifically includes:
[0091] S601: Identify connected regions in the optimized segmentation mask.
[0092] Among them, the connected region is an independent region composed of adjacent pixels. The area (number of pixels) of each connected region is calculated. All pixels have the same label (such as target area or background area). These regions are used to analyze the integrity of structural features in ore images.
[0093] S602: Calculate the area of each connected region:
[0094]
[0095] Among them, A i Represents the i-th connected region R i The area of the connected region, (x, y) represents the connected region R i The pixel coordinates within .
[0096] Specifically, the formula represents counting the pixels within the connected region, and the number of pixels obtained is the area of the corresponding connected region.
[0097] S603: Retain connected regions whose area is larger than a preset area.
[0098] It should be noted that the area of the preset region is set according to the particle properties of the ore to be detected, so as to accurately screen out the area that meets the ore particles to be detected. Those skilled in the art can set the size of the preset region according to actual conditions, and the present invention does not limit this.
[0099] S604: Generate a target area representing the ore to be detected based on the retained connected areas.
[0100] It should be noted that the segmentation results are further refined through area filtering of connected areas, and irrelevant small noise areas are removed, making the target area clearer and more accurate. This step uses connectivity and area thresholds to effectively separate the real ore particle area from the background noise or misclassified area, ensuring that the segmentation results have higher credibility. In addition, area filtering can also flexibly adjust the threshold according to different application requirements to achieve adaptability to ores of different particle sizes.
[0101] S7: Output the target area as the segmentation result of the ore particle image.
[0102] Among them, the target area refers to the area representing the actual ore structure in the ore powder image after optimization and filtering, usually removing background noise and irrelevant areas. The segmentation result is the final generated image, marking the target area boundary of the ore powder, which is the final output of the ore image segmentation.
[0103] It should be noted that the results of the entire segmentation process are clearly presented, providing high-quality input data for subsequent ore analysis, composition determination and automated testing. The final segmentation results accurately mark the particle area of the ore, remove background interference and noise, and can intuitively reflect the structural characteristics of the ore. This output form is easy to integrate with other analysis tools or models, improving the practicality and operability of the segmentation process.
[0104] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0105] In the present invention, an image of ore particles with ore to be detected is obtained and the ore particle image is preprocessed to ensure that the input format and size of the image meet the subsequent processing requirements. Then, the edge image of the preprocessed ore particle image is extracted by a Canny edge detection algorithm with an adaptive threshold. The edge image is segmented by a pre-trained SAM model in combination with the ore particle image to obtain a segmentation mask marking the edge image boundary. Subsequently, the segmentation mask is optimized with the goal of minimizing the energy function value in the CRF model. The CRF optimization effectively improves the smoothness and consistency of the segmentation boundary by considering the spatial relationship and similarity between pixels. Finally, the optimized image is segmented by a pre-trained SAM model. The segmentation mask is used to perform area filtering based on area threshold, and the target area representing the ore to be detected in the ore particle image is retained, and the target area is output as the segmentation result of the ore particle image, thereby ensuring that the segmentation result focuses on important target objects, improving the segmentation accuracy of the ore, effectively reducing the noise and boundary errors in the preliminary segmentation, enhancing the context understanding ability of the deep learning model, improving the accuracy of the segmentation results, and enhancing the robustness of the segmentation, so that the segmentation model can better adapt to changes in the image, ensuring the overall accuracy and robustness of the segmentation task, and improving the practicability of the segmentation results, especially in lithium ore images with more noise or complex background, making the segmentation results clearer and more reliable.
[0106] Reference Manual Attached Figure 2 , showing a structural schematic diagram of an ore image segmentation optimization system based on edge detection provided by the present invention.
[0107] The present invention further provides an edge detection-based ore image segmentation optimization system 20, which is applied to the above-mentioned edge detection-based ore image segmentation optimization method, comprising:
[0108] Processor 201.
[0109] The memory 202 stores computer-readable instructions. When the computer-readable instructions are executed by the processor 201, the ore image segmentation optimization method based on edge detection as in the method embodiment is implemented.
[0110] The ore image segmentation optimization system 20 based on edge detection provided by the present invention can execute the above-mentioned ore image segmentation optimization method based on edge detection and achieve the same or similar technical effects. To avoid repetition, the present invention will not elaborate on them.
[0111] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0112] In the present invention, an image of ore particles with ore to be detected is obtained and the ore particle image is preprocessed to ensure that the input format and size of the image meet the subsequent processing requirements. Then, the edge image of the preprocessed ore particle image is extracted by a Canny edge detection algorithm with an adaptive threshold. The edge image is segmented by a pre-trained SAM model in combination with the ore particle image to obtain a segmentation mask marking the edge image boundary. Subsequently, the segmentation mask is optimized with the goal of minimizing the energy function value in the CRF model. The CRF optimization effectively improves the smoothness and consistency of the segmentation boundary by considering the spatial relationship and similarity between pixels. Finally, the optimized image is segmented by a pre-trained SAM model. The segmentation mask is used to perform area filtering based on area threshold, and the target area representing the ore to be detected in the ore particle image is retained, and the target area is output as the segmentation result of the ore particle image, thereby ensuring that the segmentation result focuses on important target objects, improving the segmentation accuracy of the ore, effectively reducing the noise and boundary errors in the preliminary segmentation, enhancing the context understanding ability of the deep learning model, improving the accuracy of the segmentation results, and enhancing the robustness of the segmentation, so that the segmentation model can better adapt to changes in the image, ensuring the overall accuracy and robustness of the segmentation task, and improving the practicability of the segmentation results, especially in lithium ore images with more noise or complex background, making the segmentation results clearer and more reliable.
[0113] It should be understood that the processor in the embodiment of the present invention may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0114] It should also be understood that the memory in the embodiments of the present invention may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of random access memory (RAM) are available, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link DRAM (SLDRAM), and direct rambus RAM (DR RAM).
[0115] The above embodiments can be implemented in whole or in part by software, hardware (such as circuits), firmware or any other combination. When implemented using software, the above embodiments can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions or computer programs. When a computer instruction or computer program is loaded or executed on a computer, a process or function according to an 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. 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, computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired (such as 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 that contains one or more available media sets. The available medium can be a magnetic medium (for example, a floppy disk, a hard disk, a tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium can be a solid-state hard disk.
[0116] It should be understood that the term "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. A and B can be singular or plural. In addition, the character " / " in this article generally indicates that the associated 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.
[0117] In the present invention, "at least one" means one or more, and "more than one" 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 multiple.
[0118] It should 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.
[0119] 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.
[0120] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described equipment, devices and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0121] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of 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 is that the mutual coupling or direct coupling or communication connection 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.
[0122] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0123] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0124] If the function 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, server, or network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0125] An embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon. When the program is executed by a processor, the ore image segmentation optimization method based on edge detection as described in the method embodiment is implemented.
[0126] A computer-readable storage medium provided by the present invention can implement the steps and effects of the ore image segmentation optimization method based on edge detection in the above method embodiment. To avoid repetition, the present invention will not go into details.
[0127] The beneficial effects brought about by the technical solution provided by the embodiment of the present invention include at least:
[0128] In the present invention, an image of ore particles with ore to be detected is obtained and the ore particle image is preprocessed to ensure that the input format and size of the image meet the subsequent processing requirements. Then, the edge image of the preprocessed ore particle image is extracted by a Canny edge detection algorithm with an adaptive threshold. The edge image is segmented by a pre-trained SAM model in combination with the ore particle image to obtain a segmentation mask marking the edge image boundary. Subsequently, the segmentation mask is optimized with the goal of minimizing the energy function value in the CRF model. The CRF optimization effectively improves the smoothness and consistency of the segmentation boundary by considering the spatial relationship and similarity between pixels. Finally, the optimized image is segmented by a pre-trained SAM model. The segmentation mask is used to perform area filtering based on area threshold, and the target area representing the ore to be detected in the ore particle image is retained, and the target area is output as the segmentation result of the ore particle image, thereby ensuring that the segmentation result focuses on important target objects, improving the segmentation accuracy of the ore, effectively reducing the noise and boundary errors in the preliminary segmentation, enhancing the context understanding ability of the deep learning model, improving the accuracy of the segmentation results, and enhancing the robustness of the segmentation, so that the segmentation model can better adapt to changes in the image, ensuring the overall accuracy and robustness of the segmentation task, and improving the practicability of the segmentation results, especially in lithium ore images with more noise or complex background, making the segmentation results clearer and more reliable.
[0129] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art who is familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
[0130] There are a few points to note:
[0131] (1) The drawings of the embodiments of the present invention only relate to the structures related to the embodiments of the present invention, and other structures may refer to the general design.
[0132] (2) For the sake of clarity, in the drawings used to describe the embodiments of the present invention, the thickness of the layers or regions is exaggerated or reduced, that is, these drawings are not drawn according to the actual scale. It is understood that when an element such as a layer, film, region or substrate is referred to as being "on" or "under" another element, the element may be "directly" "on" or "under" the other element or there may be intermediate elements.
[0133] (3) In the absence of conflict, the embodiments of the present invention and the features therein may be combined with each other to obtain new embodiments.
[0134] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. The protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A method for optimizing ore image segmentation based on edge detection, characterized in that: include: S1: Acquire an image of ore particles having ore to be detected; S2: preprocessing the ore particle image; S3: extracting the edge image of the preprocessed ore particle image by using the Canny edge detection algorithm with adaptive threshold; S4: combining the ore particle image, segmenting the edge image through the pre-trained SAM model to obtain a segmentation mask marking the edge image boundary; S5: inputting the ore particle image and the segmentation mask into the CRF model, optimizing the segmentation mask with the goal of minimizing the energy function value in the CRF model to obtain an optimized segmentation mask; S6: performing area filtering based on an area threshold on the optimized segmentation mask, and retaining a target area in the ore particle image that represents the ore to be detected; S7: Outputting the target area as the segmentation result of the ore particle image.
2. The ore image segmentation optimization method based on edge detection according to claim 1 is characterized in that: The S2 specifically performs preprocessing on the ore particle image, including adjusting the image size and adjusting the image grayscale.
3. The ore image segmentation optimization method based on edge detection according to claim 1 is characterized in that: The S3 specifically includes: S301: Calculate the grayscale median of the ore particle image: v = median(I) Wherein, v represents the grayscale median, I represents the grayscale value matrix of the input ore particle image, and median represents the median symbol; S302: Calculate the adaptive threshold according to the grayscale median: T low =max(0,(1-σ)×v) T high =min(255,(1+σ)×v) Among them, T low represents the first threshold, T high represents the second threshold, σ represents the control factor, max represents the maximum value, and min represents the minimum value; S303: Extracting an edge image of the ore particle image according to the adaptive threshold.
4. The ore image segmentation optimization method based on edge detection according to claim 3 is characterized in that: The S303 specifically includes: S3031: Smoothing the ore particle image by using a Gaussian blur algorithm to obtain a denoised image; S3032: Calculate the gradient strength and gradient direction of the denoised image; S3033: retaining the local maximum point in the gradient intensity, and taking the local maximum point as the edge pixel point of the ore particle image, and removing the remaining pixel points in the ore particle image; S3034: Extracting the edge image according to the adaptive threshold: Wherein, E(x,y) represents the edge image, (x,y)=1 represents (x,y) is an edge pixel, and (x,y)=0 represents (x,y) is a remaining pixel.
5. The ore image segmentation optimization method based on edge detection according to claim 1 is characterized in that: The S4 is specifically: The multi-channel input tensor composed of the ore particle image and the edge image is input into the pre-trained SAM model to learn the context information and edge information of the multi-channel input vector and generate a segmentation mask marking the edge image boundary: M=SAM(X) X=[I,E] Among them, M represents the segmentation mask marking the edge image boundaries, SAM represents the SAM model, and X represents the multi-channel input tensor.
6. The method for optimizing ore image segmentation based on edge detection according to claim 1, characterized in that: The energy function value includes a single point score value and a neighbor relationship score value of each pixel point in the edge image.
7. The method for optimizing ore image segmentation based on edge detection according to claim 1, characterized in that: The S5 specifically includes: S501: inputting the ore particle image and the segmentation mask into the CRF model; S502: Determine the optimized segmentation mask with the goal of minimizing the energy function value in the CRF model: ψ u (y i )=-log(P(y i |M)) Where E(y) represents the energy function value, Σ represents the summation symbol, and ψ u (y i ) represents the single-point score value of pixel i, y i represents the i-th pixel label set, y j represents the j-th pixel label set, ψ p (y i ,y j ) represents the neighbor relationship score between pixels i and j, log represents the logarithmic function, P(y i |M) represents the probability that pixel i belongs to label M, θ(y i ,y j ) represents the consistency weight between the i-th pixel label and the j-th pixel label, |I i -I j | represents the color difference between pixels i and j, exp represents the exponential function, and σ represents the scale parameter that controls the similarity.
8. The method for optimizing ore image segmentation based on edge detection according to claim 1, characterized in that: The S6 specifically includes: S601: Identify connected regions in the optimized segmentation mask; S602: Calculate the area of each connected region: Among them, A i Represents the i-th connected region R i The area of the connected region, (x, y) represents the connected region R i Pixel coordinates within ; S603: retaining the connected regions whose area is larger than the preset area; S604: Generate a target area representing the ore to be detected based on the retained connected areas.
9. An ore image segmentation optimization system based on edge detection, characterized in that: include: processor; A memory having computer-readable instructions stored thereon, wherein when the computer-readable instructions are executed by the processor, the ore image segmentation optimization method based on edge detection as described in any one of claims 1 to 8 is implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the ore image segmentation optimization method based on edge detection as described in any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Road detection algorithm of fusion of area and edge information
CN106228138A
ROI region extraction method based on semantic segmentation model and conditional random field
CN116630610A
Image segmentation method, system and device and storage medium
CN117422873A
Transform-based cabin cable segmentation method
CN118279333A
Cited By
Image segmentation method, image segmentation device, electronic equipment and storage medium
CN120047480A
Fault zone internal structure area calculation method, device, equipment, medium and product
CN120318304A
Particle distribution detection method and device based on particle density
CN120635005A