Intelligent ore sorting method and system for implementing BP neural network by FPGA
Patent Information
- Application Number
- CN202610795155.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-04
- Publication Date
- 2026-08-21
AI Technical Summary
[0004]本发明的目的就在于解决当物料或环境光照发生变化时,现有FPGA色选方法应对能力不足,导致矿石识别效率偏低的问题,而提出一种FPGA实现BP神经网络的矿石智能分选方法及系统
本发明提出了一种FPGA实现BP神经网络的矿石智能分选方法,通过图像增强解决低光照环境下色彩被暗环境掩盖失真和图像细节丢失问题,基于像素筛选可有效剔除背景冗余数据,大幅降低FPGA硬件处理负荷,连通域检测能精准合并同一物料、确定坐标并剔除微小杂质;特征提取将矿石特征量化为标准向量,适配BP神经网络高效推理;最后结合分类标签与位置信息实现吹阀精准分选,在FPGA上完成全流程硬件化执行,兼顾了分选实时性与识别准确率。
Smart Images

Figure CN122605740A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of ore sorting technology, specifically relating to an intelligent ore sorting method and system using FPGA-implemented BP neural network. Background Technology
[0002] Ores are rock aggregates containing usable minerals. They are the core foundation for extracting industrial raw materials such as metals and non-metals, and are widely used in metallurgy, building materials, and chemical industries. They are important raw materials for industrial production and infrastructure construction. Based on the differences in the physical and chemical properties of ores, useful ores are separated from waste rock, and ores of different qualities are sorted. This process removes useless gangue impurities, improves the grade and utilization value of the ores, reduces energy consumption and costs in subsequent smelting and processing, and simultaneously classifies and screens ores of different grades to achieve efficient utilization of mineral resources and reduce resource waste.
[0003] In the current development of ore sorting technology, the FPGA color sorting method relies on image processing algorithms such as median filtering, binarization, and morphological processing to achieve material sorting and identification. It only has a good recognition effect on customized targets. When the material or ambient light changes, its ability to cope with changes is insufficient, resulting in low ore identification efficiency. Summary of the Invention
[0004] The purpose of this invention is to solve the problem that existing FPGA color sorting methods are insufficient in their ability to cope with changes in materials or ambient light, resulting in low ore identification efficiency. Therefore, this invention proposes an intelligent ore sorting method and system based on FPGA-implemented BP neural networks.
[0005] In a first aspect of this invention, a method for intelligent ore sorting using an FPGA-implemented BP neural network is first proposed, the method comprising: The original image of the ore to be sorted is acquired, the original image is enhanced to obtain the final enhanced image, the final enhanced image is pixel-filtered to obtain the effective material pixels, and the effective material pixels are stored. Obtain valid material pixels within the storage node, filter out valid material pixels belonging to the same ore from the valid material pixels, merge the valid material pixels belonging to the same ore into an ore connected region, and determine the location information of the ore connected region. Feature vectors are obtained by extracting features from the connected components of the ore. The feature vectors are then input into a BP neural network for inference to obtain the classification labels of the ore to be sorted. A blow valve signal is generated based on the classification label and location information of the ore to be sorted, and the blow valve equipment is controlled to perform the sorting operation based on the blow valve signal.
[0006] Optionally, the original image is enhanced to obtain an enhanced image, the process being as follows: Extract the pixel data of the three channels of the original image, and substitute the pixel data into the preset atmospheric scattering model to obtain the initial image; Obtain the grayscale pixel data of the initial image, iterate through the number of pixels corresponding to each intensity level in the grayscale pixel data, and calculate and sum the number of pixels for each grayscale level to obtain the image entropy coefficient; The three-channel pixel data of the initial image are obtained, and the effective pixel ratio is filtered out. The minimum effective pixel ratio in the three channels is extracted as the information fidelity coefficient. The optimal transmittance is calculated based on the image entropy coefficient and the information fidelity coefficient, and the initial enhanced image is calculated based on the optimal transmittance and the pixel data of the three channels of the original image. The first preset operation is performed on the initial enhanced image to obtain the final enhanced image.
[0007] Optionally, performing a first preset operation on the initial enhanced image to obtain the final enhanced image includes: Extract the three-channel pixel data of the initial enhanced image, and perform filtering processing on the pixel data of each channel to obtain the optimized pixel data of each channel; The optimized pixel data of each channel are re-merged based on the coordinate information of the pixels in the initial enhanced image to obtain the color image; The pixel values of the RGB channels in the color image are converted into the YIQ color space using a transformation matrix to obtain the component data of each pixel; the component data includes a luminance component, a first chromaticity component, and a second chromaticity component. The second preset operation is performed on the component data to obtain the final enhanced image.
[0008] Optionally, a second preset operation is performed on the component data to obtain the final enhanced image, including: Extract all pixel values corresponding to the luminance component, calculate the mean and standard deviation of the pixel values, and calculate the upper limit of luminance stretching based on the mean and standard deviation; Iterate through the minimum value of the pixel value corresponding to the luminance component, and calculate the stretched pixel value of a single pixel based on the minimum value, the upper limit of luminance stretching, and the pixel value corresponding to the luminance component. The enhanced luminance component is obtained by replacing the pixel value corresponding to the original luminance component with the stretched pixel value of a single pixel. The enhanced luminance component, the first chromaticity component, and the second chromaticity component are merged to obtain the enhanced component data. The enhanced component data is then restored to the pixel values of the RGB channels using an inverse transformation matrix to obtain the final enhanced image.
[0009] Optionally, the final enhanced image is subjected to pixel filtering to obtain effective material pixels, including: The final enhanced image is segmented into 128 rows of target data; the target data contains 2047 24-bit pixel data. Using 24-bit pixel data as the processing object, 8-bit red channel components and 8-bit blue channel components are extracted pixel by pixel, and the effective material pixels are obtained by filtering according to the first preset rule: The preset rule is as follows: A pixel is considered a valid material pixel when the 8-bit red channel brightness value plus the color difference threshold is not less than the 8-bit blue channel brightness value, and five consecutive pixels meet this condition. Pixels that do not meet the condition are identified as background pixels and are directly removed.
[0010] Optionally, filtering out valid material pixels belonging to the same ore block from valid material pixels includes: The effective material pixels within the storage node are parsed to obtain the material segment data of a single material segment; the material segment data includes row number, column start position, column end position, and material pixel data; Get the current row of material segment data and the previous row of material segment data, and filter out the same valid material pixels belonging to the same ore according to the second preset rule; The second preset rule is: First, determine row continuity: Is the current row number equal to the previous row number + 1? If so, verify the column position overlap rule: The start position of the previous row column ≤ the end position of the current row column, and the end position of the previous row column ≥ the start position of the current row column. If both row continuity and column position overlap rules are satisfied, the current row material segment data and the previous row material segment data will be merged into the same ore connectivity domain, and the row range and column range of the material will be updated. If the conditions are not met, mark it as a new material.
[0011] Optionally, feature vectors are obtained by extracting features from the connected components of the ore, including: Step 1: Extract the 8-bit red channel brightness value of each pixel in the connected domain of the ore and use it as the write operation address in memory. Read the count value currently stored at the write operation address. Step 2: Increment the current count by 1, and check if the count after incrementing by 1 has reached the upper limit of memory width; If the memory width limit is reached, the memory width limit will remain unchanged, and no write operation will be performed. If the memory width limit is not reached, the new count value after incrementing by 1 is retained; Step 3: Write the new count value back to the corresponding write operation address in memory to complete the feature statistics of a single pixel; Step 4: Repeat steps 1 to 3 for each pixel in the ore connected domain until all pixels have been counted; Step 5: Starting from memory write operation address 0 and ending at write operation address 255, read the count value of each address in ascending order of write operation address. Combine the 256 count values read in sequence into a continuous 256-dimensional data to obtain the feature vector.
[0012] Optionally, the valve blowing equipment is controlled to perform a sorting operation based on the valve blowing signal, including: The location information of the ore connectivity domain is mapped to the corresponding valve position coordinates of the blow valve through a preset lookup table; The blow valve signal is assigned a value based on the classification label of the ore to be sorted: If the category label is defective, the 64-bit data bit corresponding to the mapped blow valve position will be assigned a valid flag bit; If the category label is "good material", keep the blow valve signal as 64-bit all 0 data; The assigned blow valve signal is sent in sequence, and the corresponding blow valve plate is driven to perform a striking action based on the blow valve signal. Defective materials are knocked out by the blow valve, while good materials pass through normally without the blow valve action.
[0013] In a second aspect of this invention, a smart ore sorting system implementing a BP neural network using an FPGA is proposed, the system comprising: The acquisition module is used to acquire the original image of the ore to be sorted, enhance the original image to obtain the final enhanced image, perform pixel filtering on the final enhanced image to obtain the effective material pixels, and store the effective material pixels; The filtering module is used to obtain valid material pixels within the storage node, filter out valid material pixels belonging to the same ore from the valid material pixels, merge the valid material pixels belonging to the same ore into ore connected domains, and determine the location information of the ore connected domains. The extraction module is used to extract features from the connected components of the ore to obtain feature vectors, and input the feature vectors into the BP neural network for inference to obtain the classification label of the ore to be sorted. The control module is used to generate a valve blowing signal based on the classification label and location information of the ore to be sorted, and to control the valve blowing equipment to perform the sorting operation based on the valve blowing signal.
[0014] The beneficial effects of this invention are: This invention proposes an intelligent ore sorting method using a BP neural network implemented on an FPGA. Image enhancement addresses the issues of color distortion and image detail loss caused by the dark environment in low-light conditions. Pixel-based filtering effectively removes redundant background data, significantly reducing the FPGA hardware processing load. Connectivity detection accurately merges materials of the same type, determines coordinates, and removes minute impurities. Feature extraction quantifies ore features into standard vectors, adapting to efficient BP neural network inference. Finally, combining classification labels and location information enables precise sorting via a blower valve. The entire process is executed in hardware on the FPGA, balancing real-time sorting with high recognition accuracy. Attached Figure Description
[0015] The invention will now be further described with reference to the accompanying drawings.
[0016] Figure 1 A flowchart of an intelligent ore sorting method using an FPGA-implemented BP neural network, provided as an embodiment of the present invention; Figure 2 This is a schematic diagram of the storage parsing process provided in an embodiment of the present invention; Figure 3 A schematic diagram of the feature extraction process provided in an embodiment of the present invention; Figure 4 A schematic diagram of the valve control process provided in an embodiment of the present invention; Figure 5 This is a framework diagram of an intelligent ore sorting system based on an FPGA-implemented BP neural network, provided as an embodiment of the present invention. Detailed Implementation
[0017] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The term "and / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and B can represent: A alone, A and B simultaneously, and B alone. Furthermore, descriptions involving "first," "second," etc., in this invention are for descriptive purposes only and should not be construed as indicating or implying their relative importance or implicitly specifying the number of technical features indicated. Therefore, features defined with "first" or "second" can explicitly or implicitly include at least one of those features. Additionally, the technical solutions of the various embodiments can be combined with each other, but this must be based on the ability of those skilled in the art to implement them. When the combination of technical solutions is contradictory or cannot be implemented, it should be considered that such a combination of technical solutions does not exist and is not within the scope of protection claimed by the present invention.
[0018] Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0019] This invention provides a method for intelligent ore sorting using a BP neural network implemented on an FPGA. See also... Figure 1 , Figure 1 This is a flowchart illustrating an intelligent ore sorting method using a BP neural network implemented on an FPGA, provided as an embodiment of the present invention. The method includes the following steps: S1. Acquire the original image of the ore to be sorted, enhance the original image to obtain the final enhanced image, perform pixel screening on the final enhanced image to obtain the effective material pixels, and store the effective material pixels. S2, obtain the valid material pixels within the storage node, filter out the valid material pixels belonging to the same ore from the valid material pixels, merge the valid material pixels belonging to the same ore into an ore connected domain, and determine the location information of the ore connected domain. S3, extract features from the connected components of the ore to obtain feature vectors, and input the feature vectors into the BP neural network for inference to obtain the classification labels of the ore to be sorted; S4 generates a blow valve signal based on the classification label and location information of the ore to be sorted, and controls the blow valve equipment to perform the sorting operation based on the blow valve signal.
[0020] This invention provides an intelligent ore sorting method based on an FPGA-implemented BP neural network. The method addresses the issues of color distortion and image detail loss due to darkness in low-light environments through image enhancement. Pixel-based filtering effectively removes redundant background data, significantly reducing the FPGA hardware processing load. Connectivity detection accurately merges materials of the same type, determines coordinates, and eliminates minute impurities. Feature extraction quantifies ore features into standard vectors, adapting to efficient BP neural network inference. Finally, combining classification labels and location information enables precise sorting via a blower valve. The entire process is executed in hardware on the FPGA, balancing real-time sorting with high recognition accuracy.
[0021] In one implementation, storing the effective material pixels includes: Step 1: First write 3 fixed bytes to RAM (memory): 0xFFFFFF (line frame header marker), then write 3 bytes of the current line number, splitting the 24-bit line number into high, middle and low bytes; Step 2: Write a fixed 3 bytes: 0xFEFEFE, to mark the start of a material segment; Write 3 bytes of data (the column coordinates of the first pixel of the material segment in the row), and write each pixel of the segment sequentially, with each pixel occupying 3 bytes (R, G, B), until all pixels of the segment are written; Write a fixed 3 bytes: 0xFDFDFD, to mark the end of a material segment; write 3 bytes of data (the column coordinates of the last pixel of the material segment in that row). Step 3: If there is another material in the row, return to Step 2 and rewrite a new material data; If there are no more materials in the row, the row is stored and the process returns to step 1 to start again after the next row of data arrives.
[0022] In one implementation, the BP neural network consists of three functional layers: Input layer: 256 feature dimensions, the number of neurons corresponds to the input feature dimensions, responsible for receiving pixel data and generating 256 feature dimension data after feature processing; Hidden layer: 128 feature dimensions, usually 1-3 layers are set, this patent currently implements 1 layer, and nonlinear transformation is achieved through ReLU activation function; Output layer: Corresponding to the target variable dimension, it completes the final result output and can distinguish the ore grade accordingly. Currently, it is implementing the identification of good and bad materials.
[0023] In one embodiment, the enhanced image is obtained by enhancing the original image, and the process is as follows: Extract pixel data from the three channels of the original image, and substitute the pixel data into a preset atmospheric scattering model to obtain the initial image; Obtain the grayscale pixel data of the initial image, iterate through the number of pixels corresponding to each intensity level in the grayscale pixel data, and calculate and sum the number of pixels for each grayscale level to obtain the image entropy coefficient; The three-channel pixel data of the initial image are obtained, and the effective pixel ratio is filtered out. The minimum effective pixel ratio in the three channels is extracted as the information fidelity coefficient. The optimal transmittance is calculated based on the image entropy coefficient and information fidelity coefficient. The initial enhanced image is then calculated based on the optimal transmittance and the pixel data of the three channels of the original image. Perform the first preset operation on the initial enhanced image to obtain the final enhanced image.
[0024] In one implementation, the pixel data is substituted into a preset atmospheric scattering model to obtain the initial image. The process is as follows: in, Let (x, y) be the pixel data of the initial image at (x, y). Here, A represents the pixel data at (x, y) of the original image, and A is the preset global atmospheric light value, which is set to 0.1 in the experiment. This is the preset initial transmittance.
[0025] In one implementation, the image entropy coefficient and information fidelity coefficient are calculated as follows: in, The image entropy coefficient, This represents the number of pixels corresponding to intensity i, where N is the total number of pixels in the initial image; in, As an effective pixel-based determination factor, This is the three-channel pixel data of the initial image. This represents the percentage of effective pixels across the three channels. This is the information fidelity coefficient.
[0026] In one implementation, an initial enhanced image is calculated based on the optimal transmittance and pixel data from the three channels of the original image, including: The optimal transmittance is obtained by multiplying the image entropy coefficient and the information fidelity coefficient through preset control parameters. The initial enhanced image is obtained by replacing the initial transmittance in the atmospheric scattering model with the optimal transmittance.
[0027] In one implementation, in the ore sorting scenario, ore images taken in low light conditions will have problems such as overall dimness, extremely low contrast between ore and surrounding rock or impurities, and obscuring and blurring of ore texture and mineral features, making it impossible to accurately identify ore boundaries, grade and impurity distribution. At the same time, direct enhancement is prone to pixel value overflow (too bright or too dark), resulting in loss of ore features. Therefore, the above methods are needed to enhance contrast. The contrast level of the ore image is quantified by image entropy, and the R / G / B three-channel pixel values are constrained to be within the effective range to avoid overflow by information fidelity. Then, the two are fused to solve for the optimal transmittance to restore a clear ore image. This achieves the effect of greatly improving the contrast of low-light ore images, clearly highlighting the difference between the ore and the background, completely preserving the surface texture and mineral details of the ore, and eliminating abnormal pixel distortion. This provides a high-quality, clear image foundation for the subsequent accurate sorting, identification and classification of ore.
[0028] In one embodiment, performing a first preset operation on an initial enhanced image to obtain a final enhanced image includes: Extract the three-channel pixel data of the initial enhanced image, and perform filtering processing on the pixel data of each channel to obtain the optimized pixel data of each channel; The optimized pixel data of each channel are re-merged based on the coordinate information of the pixels in the initial enhanced image to obtain the color image; The pixel values of the RGB channels in the color image are converted to the YIQ color space using a transformation matrix to obtain the component data of each pixel; the component data includes the luminance component, the first chromaticity component, and the second chromaticity component. The second preset operation is performed on the component data to obtain the final enhanced image.
[0029] In one implementation, filtering processing is performed on the pixel data of each channel, specifically including: Minimum filtering and median filtering are performed on the pixel data of the R, G, and B channels respectively. The pixel data after minimum filtering and median filtering are added together to obtain the optimized pixel data for each channel.
[0030] In one implementation, the pixel values of the RGB channels in a color image are converted to the YIQ color space using a transformation matrix, including: in, Represents the pixel values of the RGB three channels. Represents the component data of the YIQ color space; It should be noted that the parameters in this transformation matrix are not fixed and should be adjusted according to the experimental environment.
[0031] In one implementation, since the brightness information and color information are coupled together in the RGB image after contrast enhancement and color restoration, directly adjusting the brightness will destroy the repaired color data, and it is impossible to maintain color integrity while increasing brightness. Therefore, it is necessary to convert the RGB color space to the YIQ color space; this enables complete decoupling and separation of the luminance component from the first and second chromaticity components, providing conditions for subsequent separate stretching and enhancement of the luminance component. This ensures that the restored color information is not interfered with or damaged during the optimization of low-light image brightness and restoration of dark details, allowing brightness enhancement and color fidelity to be achieved simultaneously.
[0032] In one embodiment, performing a second preset operation on the component data to obtain the final enhanced image includes: Extract all pixel values corresponding to the luminance component, calculate the mean and standard deviation of the pixel values, and calculate the upper limit of luminance stretching based on the mean and standard deviation; Iterate through the minimum value of the pixel value corresponding to the luminance component, and calculate the stretched pixel value of a single pixel based on the minimum value, the upper limit of luminance stretching, and the pixel value corresponding to the luminance component. The enhanced luminance component is obtained by replacing the pixel value corresponding to the original luminance component with the stretched pixel value of a single pixel. The enhanced luminance component, the first chromaticity component, and the second chromaticity component are merged to obtain the enhanced component data. The enhanced component data is then restored to the pixel values of the RGB channels using an inverse transformation matrix to obtain the final enhanced image.
[0033] In one implementation, the stretched pixel value of a single pixel is calculated based on the minimum value, the upper limit of brightness stretching, and the pixel value corresponding to the brightness component, including... in, This is the average of all pixel values corresponding to the luminance component. The standard deviation of all pixel values corresponding to the luminance component. This is the upper limit for brightness stretching. This is a preset adjustment factor; This represents the pixel value after stretching a single pixel. This represents all pixel values corresponding to the luminance component at (x, y). This represents the minimum pixel value corresponding to the luminance component.
[0034] In one implementation, after color restoration and YIQ color space conversion, the brightness component of the low-light image suffers from problems such as concentrated brightness distribution, narrow dynamic range, and severe lack of brightness in dark areas, making it impossible to clearly present image details. Therefore, linear stretching enhancement of the luminance component is required. This method can effectively broaden the dynamic range of the luminance component, improve the brightness of dark areas, restore image details and textures that are obscured by low light, and make the luminance distribution more uniform and natural without affecting the first and second chromaticity components.
[0035] In one embodiment, pixel filtering of the final enhanced image to obtain effective material pixels includes: The final enhanced image is segmented into 128 rows of target data; the target data contains 2047 24-bit pixel data. Using 24-bit pixel data as the processing object, 8-bit red channel components and 8-bit blue channel components are extracted pixel by pixel, and the effective material pixels are obtained by filtering according to the first preset rule: The default rules are: A pixel is considered a valid material pixel when the 8-bit red channel brightness value plus the color difference threshold is not less than the 8-bit blue channel brightness value, and five consecutive pixels meet this condition. Pixels that do not meet the condition are identified as background pixels and are directly removed.
[0036] In one implementation, the enhanced image is screened for material pixels. The purpose is to accurately remove invalid background pixels by combining the red-blue light difference threshold with the continuous pixel constraint rule, and retain only the valid material pixels corresponding to the ore and store them in a structured manner according to a custom protocol, which greatly reduces the amount of data to be processed and the FPGA computing load. By combining color discrimination rules with continuous pixel verification, the screening bias caused by single-pixel misjudgment is avoided. The dedicated protocol packaging and storage method is adapted to the high-speed processing characteristics of FPGA hardware. While ensuring the accuracy of material identification, lightweight preprocessing of image data is achieved, laying an efficient data foundation for subsequent ore connectivity detection, feature extraction and neural network inference.
[0037] In one embodiment, filtering out valid material pixels belonging to the same ore block from valid material pixels includes: The valid material pixels within the storage node are parsed to obtain the material segment data of a single material segment; the material segment data includes the row number, column start position, column end position, and material pixel data; Get the current row of material segment data and the previous row of material segment data, and filter out the same valid material pixels belonging to the same ore according to the second preset rule; The second preset rule is: First, determine row continuity: Is the current row number equal to the previous row number + 1? If so, verify the column position overlap rule: The start position of the previous row column ≤ the end position of the current row column, and the end position of the previous row column ≥ the start position of the current row column. If both row continuity and column position overlap rules are satisfied, the current row material segment data and the previous row material segment data will be merged into the same ore connectivity domain, and the row range and column range of the material will be updated. If the conditions are not met, mark it as a new material.
[0038] In one implementation, see [link to implementation details]. Figure 2 , Figure 2 This is a schematic diagram of the storage parsing process provided in an embodiment of the present invention; the process of parsing the valid material pixels within the storage node is as follows: In the diagram, the letters have the following meanings: IDLE: Idle state, GET_ROW: Get row information, WAIT_COL: Wait for column frame header, GET_COL: Get column start position, STONE_DATA: Read ore (material) pixel data, WAIT_END: Wait for column frame tail, END: Get column end position / End parsing; The state machine is in the row detection state by default, continuously reading RAM data and identifying the fixed row frame header 0xFFFFFF; when the row frame header is detected, the subsequent row number data is extracted and latched to complete the header identification of a single row of data, and then it jumps to the column frame header detection state. In the single-row data parsing process, the state machine identifies the fixed column frame header 0xFEFEFE, confirms the starting position of a single segment of material data, extracts and latches the column starting position data corresponding to the material segment, and then enters the material pixel reading state. Read and cache the RGB pixel data of the material corresponding to the segment byte by byte, while continuously detecting the fixed column frame end 0xFDFDFD; after detecting the column frame end, extract and latch the column termination position data of the material segment to complete the complete parsing of a single segment of material data; If there are multiple segments of material pixel data in the current row, the state machine automatically returns to the column frame header detection state and continues to parse the next segment of material. If all material segments in the current row have been parsed, the system will reset to the initial row frame header detection state and wait for the parsing of the next row of data to be triggered.
[0039] In one implementation, material pixel segment information is extracted through protocol parsing, and material pixels belonging to the same ore are merged into a complete ore connected region according to the row continuity and column position overlap rules. At the same time, its overall position information is determined, small impurities are removed, and cross-frame ore merging is achieved, providing a reliable ore region and coordinate basis for subsequent feature extraction and precise valve sorting. By combining state machine analysis with dual-condition attribution determination, and adapting to the high-speed processing logic of FPGA hardware, it can accurately distinguish between independent ores and interference noise, realize the regular extraction of complete ores, and output accurate location information.
[0040] In one embodiment, feature extraction of the ore connected domain to obtain a feature vector includes: Step 1: Extract the 8-bit red channel brightness value of each pixel in the connected domain of the ore and use it as the write operation address in memory. Read the count value currently stored at the write operation address. Step 2: Increment the current count by 1, and check if the count after incrementing by 1 has reached the upper limit of memory width; If the memory width limit is reached, the memory width limit will remain unchanged, and no write operation will be performed. If the memory width limit is not reached, the new count value after incrementing by 1 is retained; Step 3: Write the new count value back to the corresponding write operation address in memory to complete the feature statistics of a single pixel; Step 4: Repeat steps 1 to 3 for each pixel in the ore connected domain until all pixels have been counted; Step 5: Starting from memory write operation address 0 and ending at write operation address 255, read the count value of each address in ascending order of write operation address. Combine the 256 count values read in sequence into a continuous 256-dimensional data to obtain the feature vector.
[0041] In one implementation, see [link to implementation details]. Figure 3 , Figure 3 The present invention provides a schematic diagram of the feature extraction process; the feature extraction process and working principle are as follows: Using the 24-bit RGB pixel data of the output ore connectivity domain as input, the pixel data is split into channels, and the 8-bit red channel brightness value is extracted. The red channel brightness value is directly used as the read and write operation address of the 256-bit depth feature statistical RAM to complete the mapping of pixel features to storage address. Before a single ore feature extraction begins, a global zeroing operation is performed on the 8-bit wide, 256-depth statistical RAM to initialize the count values of all storage addresses to 0, thereby eliminating interference from historical statistical data. Using the generated RAM address as an index, read the current count value at the corresponding address; increment the count value by 1 and check for 8-bit data width overflow. If there is no overflow, write the updated count value back to the original address; if there is an overflow, keep the maximum value unchanged and complete the feature counting of a single ore pixel. The process involves iterating through all material pixels within the ore connectivity region, repeatedly performing the address mapping, count reading, incrementing and updating, and data write-back operations until all pixels within the ore connectivity region have been counted.
[0042] After the full pixel statistics are completed, the count values corresponding to each address are read in ascending order from 0 to 255. The 256 consecutively read count values are then combined in an ordered manner to generate a 256-dimensional ore feature vector.
[0043] In one implementation, the pixel color distribution information of the ore connected domain is transformed into standardized feature data that can be directly recognized by the BP neural network. The frequency statistics of the red channel pixel values are used to achieve quantitative representation of the ore color and texture features, providing regular and effective input for subsequent neural network classification and reasoning. Hardware-based histogram statistics are achieved using the FPGA's on-chip RAM. The 8-bit red channel value is used as the storage address to complete fast counting and updates without complex floating-point operations. This significantly improves real-time processing while ensuring the accuracy of feature representation, and is suitable for the hardware execution requirements of high-speed online ore sorting.
[0044] In one embodiment, controlling the valve blowing device to perform a sorting operation based on a valve blowing signal includes: The location information of the ore connectivity domain is mapped to the corresponding valve position coordinates of the blow valve through a preset lookup table; The blow valve signal is assigned a value based on the classification label of the ore to be sorted: If the category label is defective, the 64-bit data bit corresponding to the mapped blow valve position will be assigned a valid flag bit; If the category label is "good material", keep the blow valve signal as 64-bit all 0 data; The assigned blow valve signal is sent in sequence, and the corresponding blow valve plate is driven to perform a striking action based on the blow valve signal. Defective materials are knocked out by the blow valve, while good materials pass through normally without the blow valve action.
[0045] In one implementation, see [link to implementation details]. Figure 4 , Figure 4 The present invention provides a schematic diagram of the valve control process; the valve control process and working principle are as follows: The idle state machine is initially in the idle standby state by default, waiting for the valid input of ore connectivity location information and BP neural network classification labels. At this time, the blow valve control signal remains at a completely invalid level, and there is no blow valve action. After receiving valid ore data, the position waiting and valve position mapping state enters this state. The overall row and column position information of the ore is converted into the corresponding physical valve position coordinates on the blow valve plate through a preset mapping relationship, so as to complete the precise matching of the ore position to the blow valve execution position. The valve blowing signal generation status is based on the classification label output by the BP neural network to assign the valve blowing logic value: if the ore is bad material, the corresponding valve position control signal after mapping is set to an effective level; if it is good material, the corresponding valve position signal is kept at an invalid level, thus completing the logical generation of the sorting valve blowing signal. The valve blowing signal output status follows the system's synchronous line frequency timing, synchronously outputting the generated valve blowing control signal to the valve blowing drive circuit to ensure that the valve blowing triggering time is strictly aligned with the ore conveying position, thereby achieving precise valve blowing. After the valve control process for a single piece of ore is completed and the reset state is ended, the state machine automatically resets to the IDLE state, clears the current valve position and signal data, and waits for the next piece of ore data to enter before entering the next round of sorting control cycle.
[0046] In one implementation, a matching blow valve control signal is generated based on the ore classification label and the location information of the connected domain. By controlling the blow valve equipment, unqualified ore is accurately knocked out and qualified ore is transported normally, thus completing the automated and intelligent sorting of ore. An FPGA state machine is used to implement valve timing control and valve position mapping, accurately mapping the ore position to the physical valve position. Combined with the classification results, the valve action is dynamically triggered, ensuring real-time responsiveness in high-speed sorting scenarios. It also achieves precise control of the impact position and triggering timing. The hardware execution is efficient and stable, and it is suitable for the continuous ore sorting needs in industrial sites.
[0047] Based on the same inventive concept, this invention also provides an intelligent ore sorting system using an FPGA-implemented BP neural network. See also... Figure 5 , Figure 5A framework diagram of an intelligent ore sorting system based on a BP neural network implemented using an FPGA, provided in an embodiment of the present invention, includes: The acquisition module is used to acquire the original image of the ore to be sorted, enhance the original image to obtain the final enhanced image, perform pixel filtering on the final enhanced image to obtain the effective material pixels, and store the effective material pixels; The filtering module is used to obtain valid material pixels within the storage node, filter out valid material pixels belonging to the same ore from the valid material pixels, merge the valid material pixels belonging to the same ore into ore connected domains, and determine the location information of the ore connected domains. The extraction module is used to extract features from the connected components of the ore to obtain feature vectors, and input the feature vectors into the BP neural network for inference to obtain the classification label of the ore to be sorted. The control module is used to generate a valve blowing signal based on the classification label and location information of the ore to be sorted, and to control the valve blowing equipment to perform the sorting operation based on the valve blowing signal.
[0048] The foregoing has described one embodiment of the present invention in detail, but this content is merely a preferred embodiment and should not be considered as limiting the scope of the present invention. All equivalent variations and modifications made within the scope of the claims of this invention should still fall within the scope of the claims of this invention.
Claims
1. A method for intelligent ore sorting using an FPGA-implemented BP neural network, characterized in that, The method includes: The original image of the ore to be sorted is acquired, the original image is enhanced to obtain the final enhanced image, the final enhanced image is pixel-filtered to obtain the effective material pixels, and the effective material pixels are stored. Obtain valid material pixels within the storage node, filter out valid material pixels belonging to the same ore from the valid material pixels, merge the valid material pixels belonging to the same ore into ore connected regions, and determine the location information of the ore connected regions. Feature vectors are obtained by extracting features from the connected components of the ore. The feature vectors are then input into a BP neural network for inference to obtain the classification labels of the ore to be sorted. A blow valve signal is generated based on the classification label and location information of the ore to be sorted, and the blow valve equipment is controlled to perform the sorting operation based on the blow valve signal.
2. The intelligent ore sorting method using a BP neural network implemented on an FPGA according to claim 1, characterized in that, The enhanced image is obtained by enhancing the original image. The process is as follows: Extract the pixel data of the three channels of the original image, and substitute the pixel data into the preset atmospheric scattering model to obtain the initial image; Obtain the grayscale pixel data of the initial image, iterate through the number of pixels corresponding to each intensity level in the grayscale pixel data, and calculate and sum the number of pixels for each grayscale level to obtain the image entropy coefficient; The three-channel pixel data of the initial image are obtained, and the effective pixel ratio is filtered out. The minimum effective pixel ratio in the three channels is extracted as the information fidelity coefficient. The optimal transmittance is calculated based on the image entropy coefficient and the information fidelity coefficient, and the initial enhanced image is calculated based on the optimal transmittance and the pixel data of the three channels of the original image. The first preset operation is performed on the initial enhanced image to obtain the final enhanced image.
3. The intelligent ore sorting method using a BP neural network implemented on an FPGA according to claim 2, characterized in that, Performing a first preset operation on the initial enhanced image to obtain the final enhanced image includes: Extract the three-channel pixel data of the initial enhanced image, and perform filtering processing on the pixel data of each channel to obtain the optimized pixel data of each channel; The optimized pixel data of each channel are re-merged based on the coordinate information of the pixels in the initial enhanced image to obtain the color image; The pixel values of the RGB channels in the color image are converted into the YIQ color space using a transformation matrix to obtain the component data of each pixel; the component data includes a luminance component, a first chromaticity component, and a second chromaticity component. The second preset operation is performed on the component data to obtain the final enhanced image.
4. The intelligent ore sorting method using a BP neural network implemented on an FPGA according to claim 3, characterized in that, Performing a second preset operation on the component data yields the final enhanced image, including: Extract all pixel values corresponding to the luminance component, calculate the mean and standard deviation of the pixel values, and calculate the upper limit of luminance stretching based on the mean and standard deviation; Iterate through the minimum value of the pixel value corresponding to the luminance component, and calculate the stretched pixel value of a single pixel based on the minimum value, the upper limit of luminance stretching, and the pixel value corresponding to the luminance component. The enhanced luminance component is obtained by replacing the pixel value corresponding to the original luminance component with the stretched pixel value of a single pixel. The enhanced luminance component, the first chromaticity component, and the second chromaticity component are merged to obtain the enhanced component data. The enhanced component data is then restored to the pixel values of the RGB channels using an inverse transformation matrix to obtain the final enhanced image.
5. The intelligent ore sorting method using a BP neural network implemented on an FPGA according to claim 1, characterized in that, Pixel filtering of the final enhanced image to obtain effective material pixels includes: The final enhanced image is segmented into 128 rows of target data; the target data contains 2047 24-bit pixel data. Using 24-bit pixel data as the processing object, 8-bit red channel components and 8-bit blue channel components are extracted pixel by pixel, and the effective material pixels are obtained by filtering according to the first preset rule: The preset rule is as follows: A pixel is considered a valid material pixel when the 8-bit red channel brightness value plus the color difference threshold is not less than the 8-bit blue channel brightness value, and five consecutive pixels meet this condition. Pixels that do not meet the condition are identified as background pixels and are directly removed.
6. The intelligent ore sorting method using a BP neural network implemented on an FPGA according to claim 1, characterized in that, Filter out the effective material pixels that belong to the same ore block and include: The effective material pixels within the storage node are parsed to obtain the material segment data of a single material segment; the material segment data includes row number, column start position, column end position, and material pixel data; Get the current row of material segment data and the previous row of material segment data, and filter out the same valid material pixels belonging to the same ore according to the second preset rule; The second preset rule is: First, determine row continuity: Is the current row number equal to the previous row number + 1? If so, verify the column position overlap rule: The start position of the previous row column ≤ the end position of the current row column, and the end position of the previous row column ≥ the start position of the current row column. If both row continuity and column position overlap rules are satisfied, the current row material segment data and the previous row material segment data will be merged into the same ore connectivity domain, and the row range and column range of the material will be updated. If the conditions are not met, mark it as a new material.
7. The intelligent ore sorting method using a BP neural network implemented on an FPGA according to claim 1, characterized in that, Feature vectors are obtained by extracting features from the connected components of the ore, including: Step 1: Extract the 8-bit red channel brightness value of each pixel in the connected domain of the ore and use it as the write operation address in memory. Read the count value currently stored at the write operation address. Step 2: Increment the current count by 1, and check if the count after incrementing by 1 has reached the upper limit of memory width; If the memory width limit is reached, the memory width limit will remain unchanged, and no write operation will be performed. If the memory width limit is not reached, the new count value after incrementing by 1 is retained; Step 3: Write the new count value back to the corresponding write operation address in memory to complete the feature statistics of a single pixel; Step 4: Repeat steps 1 to 3 for each pixel in the ore connected domain until all pixels have been counted; Step 5: Starting from memory write operation address 0 and ending at write operation address 255, read the count value of each address in ascending order of write operation address. Combine the 256 count values read in sequence into a continuous 256-dimensional data to obtain the feature vector.
8. The intelligent ore sorting system based on a BP neural network implemented in FPGA according to claim 1, characterized in that, The valve blowing equipment is controlled to perform sorting operations based on the valve blowing signal, including: The location information of the ore connectivity domain is mapped to the corresponding valve position coordinates of the blow valve through a preset lookup table; The blow valve signal is assigned a value based on the classification label of the ore to be sorted: If the category label is defective, the 64-bit data bit corresponding to the mapped blow valve position will be assigned a valid flag bit; If the category label is "good material", keep the blow valve signal as 64-bit all 0 data; The assigned blow valve signal is sent in sequence, and the corresponding blow valve plate is driven to perform a striking action based on the blow valve signal. Defective materials are knocked out by the blow valve, while good materials pass through normally without the blow valve action.
9. An intelligent ore sorting system implementing a BP neural network using FPGA, characterized in that, The system includes: The acquisition module is used to acquire the original image of the ore to be sorted, enhance the original image to obtain the final enhanced image, perform pixel filtering on the final enhanced image to obtain the effective material pixels, and store the effective material pixels; The filtering module is used to obtain valid material pixels within the storage node, filter out valid material pixels belonging to the same ore from the valid material pixels, merge the valid material pixels belonging to the same ore into ore connected domains, and determine the location information of the ore connected domains. The extraction module is used to extract features from the connected components of the ore to obtain feature vectors, and input the feature vectors into the BP neural network for inference to obtain the classification labels of the ore to be sorted. The control module is used to generate a valve blowing signal based on the classification label and location information of the ore to be sorted, and to control the valve blowing equipment to perform the sorting operation based on the valve blowing signal.