A metal identification system and method employing a general inductive sensor and image processing

By combining multiple general-purpose inductive proximity sensors and image processing technology with a neural network model, this method achieves efficient identification of multiple metals, solving the problems of low efficiency, high cost, and significant environmental interference in existing technologies, and providing a safe and low-cost metal identification method.

CN115908799BActive Publication Date: 2025-12-30NANJING UNIV OF AERONAUTICS & ASTRONAUTICS
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211389000.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-08
Publication Date
2025-12-30
Estimated Expiration
2042-11-08

AI Technical Summary

Technical Problem

Existing metal identification technologies suffer from low efficiency, high cost, susceptibility to environmental interference, and insecurity. In particular, single-channel and multi-channel identification technologies based on general-purpose inductive sensors require complex equipment development and control systems.

Method used

Multiple general-purpose inductive proximity sensors are used to detect metals simultaneously. Combined with image processing technology, neural network model interpolation and image segmentation are used to identify the location and type of different metals, reducing the difficulty of excitation control and data acquisition, and achieving efficient identification of multiple metals.

Benefits of technology

It achieves efficient identification of different metals, has strong anti-interference capabilities, is safe and reliable, has good adaptability, low equipment cost, simple data processing, and avoids the danger of ionizing radiation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115908799B_ABST
    Figure CN115908799B_ABST
Patent Text Reader

Abstract

The application discloses a metal recognition system and method using general inductive sensors and image processing, and the method comprises the following steps: (1) when randomly scattered metal materials on a conveying belt pass through a measuring area above a sensor group at a constant speed, the sensor outputs a current signal, and a computer indirectly reads the current size at a certain frequency through a collector and stores the current size in a two-dimensional array according to a certain rule; (2) after interpolation and densification of the data in the two-dimensional array, the data are normalized to the range of [0, 255] and rounded, and the data are processed as a gray-scale image; (3) after a series of image processing such as segmentation and erosion, the image corresponding to each metal is obtained; (4) the maximum value of the gray-scale value of each metal image and the maximum gradient are calculated; and (5) a neural network classification model is used to judge the type of each metal. The application has the advantages that general inductive proximity sensors are used, acquisition and control are simple, and the recognition efficiency is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of inductive sensor recognition technology, specifically relating to a metal recognition system and method that uses a general-purpose inductive sensor and image processing. Background Technology

[0002] With my country's increasing demand for metals, the production of scrap metal is also growing rapidly, making scrap metal recycling crucial. In the scrap metal recycling process, scrap metal sorting plays a vital role, leading to the development of numerous metal identification technologies.

[0003] Existing metal identification technologies include X-ray identification, visual identification, and inductive sensor identification. X-ray identification primarily sorts materials based on the intensity of their X-ray spectra, and has a wide range of applications, widely used in the pre-selection of metals, non-metallic minerals, and other rare ores. It can identify and classify light and heavy metals within a certain size range. However, it involves ionizing radiation, requiring high safety protection standards, and the equipment is expensive. Visual identification distinguishes metals based on their surface color and texture, but it can only be used for materials with obvious color characteristics and is easily affected by metal corrosion, surface dirt, or other deposits. Inductive sensor identification utilizes the eddy current effect of metals to identify them, and can be used to distinguish metals with significant differences in conductivity. Because inductive sensor identification is unaffected by the surface condition of the object being measured, it has excellent application prospects. However, among the existing inductive identification technologies, those based on general-purpose inductive sensors are all single-channel identification technologies, which can only identify a single material passing through, resulting in low efficiency. On the other hand, multi-channel identification technologies that can identify multiple materials passing through simultaneously require specially designed and developed sensors, as well as control of their excitation signals and acquisition of responses to excitation signals at different frequencies. This makes the control and acquisition system complex and costly.

[0004] To address the aforementioned issues, this invention proposes a metal recognition system and method employing a general-purpose inductive sensor and image processing. By using multiple inductive proximity sensors (which are general-purpose sensors, hereinafter referred to as inductive sensors or sensors) for simultaneous detection, the difficulty of excitation control and data acquisition is reduced, while enabling the recognition of different metals. Summary of the Invention

[0005] Objective of the Invention: The technical problem to be solved by this invention is to address the shortcomings of existing metal recognition technologies by providing a metal recognition system and method that employs a general-purpose inductive sensor and image processing. Specifically, it uses multiple current-output inductive proximity sensors. When randomly distributed metals on a conveyor belt pass through the detection area of ​​the sensor group, the current signal output by the sensor group is processed by a data acquisition unit to generate a computer-readable digital signal. After the computer collects current data for a period of time, a pre-trained neural network interpolation model is used to interpolate to obtain relatively dense data. This data is converted into grayscale images. After a series of image processing techniques, the image data corresponding to each metal can be extracted separately, and the maximum grayscale value and maximum gradient of each metal image, as well as the location of each metal image, can be calculated. Finally, the location of the metal is determined based on the location of each metal image, and the type of metal is determined based on the maximum grayscale value and maximum gradient of each metal image. Compared to existing metal identification technologies, such as X-ray identification and visual identification, the inductive sensor identification technology involved in this invention has excellent anti-interference capabilities, being largely unaffected by metal surface deposits, metal shape, and surface gloss; it also exhibits good environmental adaptability, unaffected by environmental factors such as noise, light, and dust; the identification process is safe and reliable, producing no hazardous factors similar to ionizing radiation; and the equipment is inexpensive, significantly reducing identification costs. Compared to existing multi-channel inductive sensor identification technologies, the technology proposed in this invention offers convenient data acquisition and processing, requiring only current data acquisition, and the data volume is small, making the corresponding data processing process more convenient; the inductive proximity sensor used is a general-purpose sensor, requiring no custom development, and is convenient to control and acquire data.

[0006] A metal recognition system employing a general-purpose inductive sensor and image processing includes a conveyor belt, a transmission device, a driver, a sensor group, a data collector, and a computer;

[0007] The conveyor belt is used to transport metal, and its speed is v;

[0008] The transmission device is used to drive the conveyor belt;

[0009] The driver is used to receive computer instructions and control the drive of the transmission device according to the instructions;

[0010] The sensor group includes N s A plurality of inductive sensors are used to generate current signals and are all located below the conveyor belt and arranged in a straight line. The distance between the centers of adjacent inductive sensors is w, and the distance between the top of the plurality of inductive sensors and the upper surface of the conveyor belt is h.

[0011] The data acquisition unit is used to acquire the current signal generated by the sensor group and store the current signal in its internal register in the form of data;

[0012] The computer is used to control the driver, read the data stored in the collector, determine the type of metal, and calculate the location of the metal.

[0013] A metal identification method employing a general-purpose inductive sensor and image processing includes the following steps:

[0014] 1) Metals of different shapes and sizes, randomly scattered on the conveyor belt, continuously pass through the detection area above the sensor group. Multiple inductive sensors simultaneously output current signals. The data collector acquires these current signals and stores them as data in its internal register. The computer records these signals every time interval T. c Read the data stored in the collector once, where n is a given integer greater than 1;

[0015] 2) After reading M c After a certain number of data cycles, the read data will be stored in a container of size M. c ×N s two-dimensional array data p In the middle, M c Given a positive integer, group data obtained from the same inductive sensor into the same column, and data obtained at the same time into the same row, with the column order corresponding to the installation position of the inductive sensor and the row order corresponding to time T. c Corresponding sequence;

[0016] 3) Generate a size of M c ×(nN s An empty two-dimensional array data (-n+1) i , the two-dimensional array data p The elements in the data are filled into the two-dimensional array data. i In detail:

[0017] Using a pre-trained neural network interpolation model IntNNmodel, with a two-dimensional array data p two adjacent data in a row p [X i ,Y i ], data p [X i ,Y i +1] is the input to the neural network interpolation model IntNNmodel, which outputs n-1 values, arranged according to the two-dimensional array data. pThe sorting of each row in the table names the n-1 values ​​as [X] i ,Y i [1], [X] i ,Y i [2],…,[X] i ,Y i [n-1]; Fill the output of the neural network interpolation model IntNNmodel into the two-dimensional array data according to equations (1) and (2). i middle:

[0018] data i [n·X i ,n·Y i ] = data p [X i ,Y i (1)

[0019] data i [n·X i ,n·Y i +i i ] = [X i ,Y i ][i i (2)

[0020] In the formula X i =0,1,2…,(M c -1), Y i =0,1,2,…,(N s -1), and Y i ≠(N s -1)), data i [n·X i ,n·Y i ] is a two-dimensional array data i The nth·X i row, nth Y i The element at column number, data p [X i ,Y i ] is a two-dimensional array data p The Xth i row, Y i The element at column number, data i [n·X i ,n·Y i +i i ] is a two-dimensional array data i The nth·X i row, nth Y i +i i The element at column i i Let i be the sequence number, and ii =1,2,…,n-1;

[0021] 4) Transfer the two-dimensional array data i After normalizing the values ​​of each element in the array to the range [0, 255] and rounding them down, the two-dimensional array data is then... i The values ​​of all elements in the array are used as the grayscale values ​​of the pixels, and the data is stored in a two-dimensional array. i The correspondence between the positions of elements and image pixel coordinates is equivalent to a matrix of size M. c ×(nN s a grayscale image of (-n+1) pixels;

[0022] 5) The grayscale image is segmented to obtain several independent regions. According to the position of each region in the grayscale image, each region is placed in an image of the same size as the grayscale image and all pixels have a grayscale value of 0. This results in several grayscale images containing only one region, called sub-grayscale images. These sub-grayscale images are stored in the image array Sons, where each element of the image array Sons is a sub-grayscale image.

[0023] 6) Completely segment the sub-grayscale images in the image array Sons to obtain several grayscale images that contain only one metal corresponding to the data, which are called single metal grayscale images;

[0024] 7) Determine the coordinates (x, y) of the metal in the grayscale image according to formula (3). k ,y k ), where (x1,y1),(x2,y2),(x3,y3)... are the coordinates of all non-zero grayscale pixels in the single-metal grayscale image, and mean() means to calculate the mean of all quantities within the parentheses;

[0025] (x k ,y k )=mean((x1,y1),(x2,y2),(x3,y3),…) (3)

[0026] 8) Calculate the grayscale gradient of all pixels in the single-metal grayscale image according to formula (4), where (x,y) is the coordinate of a certain pixel, and Gray(x-1,y) and Gray(x+1,y) represent the grayscale values ​​of pixel coordinates (x-1,y) and pixel coordinates (x+1,y); if pixel coordinates (x,y) are located on the boundary of the single-metal grayscale image, such that one or both of pixel coordinates (x-1,t) and pixel coordinates (x+1,t) do not exist, then the grayscale value of the non-existent point Gray(x,y) is used to replace the grayscale value of the non-existent point for calculation. By comparing the grayscale values ​​and grayscale gradients of all pixels, the maximum grayscale value Gray is obtained. max and maximum gradient Grad max ;

[0027]

[0028] 9) Using the trained neural network classification model ClfNNmodel, classify the grayscale values ​​of each single-metal grayscale image based on the maximum grayscale value Gray. max Maximum gradient Grad max To determine the type of metal.

[0029] Preferably, the training process of the neural network interpolation model IntNNmodel in step 3) is as follows:

[0030] 31) A certain amount of metal is randomly scattered in a certain area on the conveyor belt; the certain area is of size (N). s +1)w×M t The rectangular region of Δl, where M t It is a given positive integer, Δl is the value of the conveyor belt at time T. c The distance moved internally, i.e., Δl = T c v, the length of the rectangular region is (N) s +1)w's edge is perpendicular to the direction of the conveyor belt's movement, and its upper left vertex coincides with the center position of the leftmost inductive sensor, where the left side of the conveyor belt's forward movement direction is considered left, and the forward movement direction of the conveyor belt is considered up.

[0031] 32) Move all inductive sensors synchronously from left to right, with a step size of Δl. After moving n-1 times, return the inductive sensors to their original positions. Then move the conveyor belt forward a distance Δl, repeating this process until the scanning of the certain area described in step 31) is completed, and then stop moving. Record the current signal output by each inductive sensor at each position to obtain the current signal I[X]. s ,Y s ][i s ]; where X sY represents the number of times the conveyor belt moves when the current signal is collected. s This indicates the number of times the inductive sensor has moved since its last return to its original position when acquiring this current signal, i. s This indicates the serial number of the inductive sensor that collected the current signal, where the leftmost inductive sensor is the first one, and X... s =0,1,…,M t Y s =0,1,…,(n-1),i s =1,2,…,N s ;

[0032] 33) Generate a space of size (M) t +1)×nN s empty two-dimensional array data s According to formula (5), the current signal I[X] collected in step 32) is... s ,Y s ][i s Fill in the two-dimensional array data s In the middle, where data s [X s ,n·(i s -1)+Y s ] represents a two-dimensional array data s The Xth s row, nth (i s -1)+Y s ) elements of the column;

[0033] data s [X s ,n·(i s -1)+Y s ] = I[X s ,Y s ][i s (5)

[0034] 34) From the two-dimensional array data s Extract all combinations of the following forms, data s [X t ,Y t ], data s [X t ,Y t +1],…,data s [X t ,Y t +n], where data s [X t ,Y t +n] represents data s The Xtht row, Y t +n columns of elements, and X t =0,1,…,M t Y t =0,1,…,(n·N) s -n-1);

[0035] 35) Use all the combinations extracted in step 34) as training samples in the neural network training set TrainSet. Each training sample contains n+1 elements. Define TrainSet[i] t ][j t [i] is the i-th node in the neural network training set TrainSet. t The j-th training sample t There are elements, and i t =1,2,3,…,j t =0,1,2,…,n; if the i-th t The first element of each training sample is data. s [X t ,Y t If the remaining elements of the training sample correspond as shown in equation (6), then the relationship between the elements is as follows:

[0036] TrainSet[i t ][j t ] = data s [X t ,Y t +j t (6)

[0037] 36) The neural network interpolation model IntNNmodel includes n-1 sub-models IntNNmodel[i m ], where i m Let i be the index of the sub-model. mdl =1,2,…,n-1; each of the sub-models is a neural network model with 2 inputs and 1 output; with the first element of the training sample TrainSet[i t ][0] and the last element TrainSet[i t [n-1] are used as the first and second inputs respectively, with the element TrainSet[i t ][i m The sub-model IntNNmodel[i] is trained using the sigmoid function as the activation function and the output ] as the output. m The sub-model output value is defined as output[i] mCombine all the sub-models to obtain a neural network interpolation model IntNNmodel with 2 inputs and n-1 outputs. The outputs of each sub-model are ordered as output[1], output[2], ..., output[n-1].

[0038] Preferably, step 5) involves segmenting the grayscale image into several independent regions as follows:

[0039] 51) Set a seed point, wherein the seed point satisfies the following conditions: the gray value of the point is greater than the set threshold T1 and the point has no assigned location; the growth criterion is set as follows: the point is within the 4-neighborhood of the seed point or the newly generated point in the region and the gray value of the point is greater than the threshold T1.

[0040] 52) Scan all pixels of the grayscale image. When a pixel that meets the conditions of the seed point is found, pause the scan and use that point as the seed point for growth. Specifically, find all pixels in the grayscale image that meet the growth conditions, and assign the pixels that meet the conditions as new points to the region where the seed point is located. Repeat the process of finding new points until there are no more points that meet the growth criteria. Then, one round of growth is completed and an independent region is obtained.

[0041] 53) After completing one round of growth, continue scanning from the paused point and grow again when the next seed point is found; until all pixels of the grayscale image are scanned and there are no new seed points, the image segmentation is completed, and several independent regions are obtained.

[0042] Preferably, the process of completely segmenting the sub-grayscale images in the image array Sons in step 6) is as follows:

[0043] 61) Find the peak points of all gray values ​​in the sub-grayscale image and assume that each peak point corresponds to a metal. If the number of peak points in a sub-grayscale image is 0 or 1, it is assumed that there is only one metal in the sub-grayscale image and it is directly stored in the result array Results; otherwise, continue with subsequent processing.

[0044] 62) Amplify the grayscale values ​​of the peak point and the pixels within a certain range around it according to formula (7), where (x p ,y p ) represents the coordinates of a peak point or a pixel near the peak point, whose grayscale value before magnification is Gray(x). p ,y p ), Gray p (x p ,y p ) is its magnified grayscale value, α is the magnification factor and is greater than 1, and k depends on (x p,y p The distance from the peak point, k is maximized when the distance is 0;

[0045] Gray p (x p ,y p ) = Gray(x p ,y p )×α k (7)

[0046] 63) Perform a sequential scan of the sub-grayscale image, targeting all pixel coordinates (x, y) that meet the conditions. c ,y c The pixel coordinates (x) are reduced according to equation (8). c ,y c A point whose 4-neighborhood pixels contain at least one pixel with a gray value of 0 and whose own gray value is not 0:

[0047] Gray c (x c ,y c ) = Gray(x c ,y c )×b i ×c j (8)

[0048] In the formula Gray(x c ,y c (x) is the pixel coordinate (x) before scaling down. c ,y c The grayscale value of Gray c (x c ,y c (x) is the pixel coordinate after scaling down. c ,y c The gray value of the pixel is denoted as , b is the edge shrinkage factor and b < 1, i is the number of points with a gray value of 0 in the 4-neighborhood of the pixel, c is the valley shrinkage factor and c < 1, and j is the number of points with a gray value higher than the pixel in the 4-neighborhood of the pixel.

[0049] 64) Set a threshold T2. If the gray value of a certain pixel (8) is reduced and the resulting gray value is less than t2, then set the gray value of that pixel to 0.

[0050] 65) Continue to extract independent regions in the sub-grayscale image using the method in step 5), where the threshold is set to T2. If only one region can be extracted, the surface sub-grayscale image has not yet been split, then repeat steps 63)-64); if two or more regions can be extracted, the surface sub-grayscale image has been split, and continue with the subsequent steps.

[0051] 66) According to the position of each region in the sub-grayscale image, each region is placed in a blank image of the same size as the sub-grayscale image, resulting in several grayscale images containing only one region, called grandchild grayscale images. The grandchild grayscale images are stored in the image array NewSons.

[0052] 67): After processing all the sub-grayscale images in the image array Sons using steps 61)-66), the image array NewSons stores the grandchild grayscale images generated from all the sub-grayscale images. Replace the images in the image array Sons with the grandchild grayscale images in the image array NewSons to become new sub-grayscale images.

[0053] 68) Repeat steps 61)-67) to process all new sub-grayscale images in the image array Sons. If new sub-grayscale images are generated, continue to repeat steps 61)-67). If no new sub-grayscale images are generated, that is, all sub-grayscale images have been split into images containing only one metal and have been stored in the result array Results in step 61), then all splitting has been completed, and all images in the result array Results are output as results.

[0054] Preferably, the process of finding the peak points of all gray values ​​in the sub-grayscale image in step 61) is as follows:

[0055] 611): Sequentially scan the sub-grayscale image. If a certain pixel is the point with the largest grayscale value within a 5×5 pixel range centered on it, the point is considered a peak point, its position is recorded, and all peak points are found in this way.

[0056] 612): If the number of peaks found is 0 or 1, it is assumed that there is only one metal in the image, and no further steps are performed; the number of peaks is directly output. Otherwise, there may be multiple metals in the image, and further processing is required before output.

[0057] 613: Consider the pixel coordinates (x, y) corresponding to any two peak points. p1 ,y p1 ),(x p2 ,y p2 If the coordinates (x, y) of any pixel point on the line connecting them are... v ,y v Gray value of Gray(x) v ,y v If equation (9) is satisfied, then the pixel coordinates (x) are considered to be... p1 ,y p1 ),(x p2 ,y p2() represents the peak points of different metals; conversely, if there is no such pixel on the line connecting the two points, the two peak points are considered to belong to the same metal.

[0058] 0.5×(Gray(x p1 ,y p1 )+Gray(x p2 ,y p2 ))-Gray(x v ,y v )≥T3 (9)

[0059] Where T3 is a given threshold, Gray(x) p1 ,y p1 ) and Gray(x p2 ,y p2 ) respectively represent (x p1 ,y p1 ),(x p2 ,y p2 The grayscale values ​​of the two points;

[0060] S614: After determining all pairwise combinations of peak points, if there are two or more peak points (x... p1 ,y p1 ),(x p2 ,y p2 ),(x p3 ,y p3 If the elements belong to the same metal, then the new pixel coordinates (x, y, y) are calculated according to formula (10). p0 ,y p0 The peak points of the metal are selected as the final result; all peak points are then output as the final result.

[0061] (x p0 ,y p0 )=mean((x p1 ,y p1 ),(x p2 ,y p2 ),(x p3 ,y p3 ),…) (10)

[0062] Preferably, the training process of the neural network classification model ClfNNmodel in step 9) is as follows:

[0063] 91) Prepare the K that needs to be distinguished. m Samples of various metals are required, with at least V samples of each metal type, and the number of samples of different metal types being roughly equal. These metal samples are randomly and sequentially distributed on a conveyor belt. Following steps 1)-8), the current signals output by the sensor group are collected as the metal samples pass through the detection area of ​​the inductive sensor. The maximum grayscale value (Gray) corresponding to each metal sample is calculated.max and maximum gradient Grad max ;

[0064] 92) Using the maximum grayscale value corresponding to all metal samples (Gray) max and maximum gradient Grad max Using the types of metal samples as the training set, train a 2-input, K-type vector generator. m The output feedforward neural network ClfNNmodel, specifically based on Gray max and Grad max As input, the confidence probability of each type of metal is output.

[0065] Compared with the prior art, the significant advantages of the technical solution of this invention are as follows:

[0066] (1) Compared with existing metal identification technologies, it has good anti-interference ability and is basically unaffected by metal surface attachments, metal shape and surface gloss.

[0067] (2) Compared with existing metal recognition technologies, it has better adaptability to the environment and is not affected by factors such as noise, light, and dust in the environment.

[0068] (3) Compared with existing metal identification technologies, the identification process is safe and reliable and does not produce any dangerous factors similar to ionizing radiation.

[0069] (4) Compared with existing multi-channel inductive sensor identification technology, data acquisition and processing are convenient. Only current data needs to be collected, and the amount of data is small, so the corresponding data processing process is also more convenient.

[0070] (5) Compared with existing multi-channel inductive sensor identification technology, the inductive proximity sensor used is a general sensor that does not require custom development and is easy to control and acquire. Attached Figure Description

[0071] Figure 1 This is a schematic diagram of the experimental apparatus of the present invention.

[0072] Figure 2 Diagram showing the relationship between data acquisition and motor control.

[0073] Figure 3 This is a flowchart of the identification method mentioned in this invention.

[0074] Figure 4 It is the original grayscale image obtained after the collected data has been interpolated and transformed.

[0075] Figure 5 It is a sub-grayscale image obtained after the original grayscale image has undergone simple image segmentation.

[0076] Figure 6 It is a single-metal grayscale image obtained after complete segmentation.

[0077] Figure 7 The result of overlaying all single-metal grayscale images. Detailed Implementation

[0078] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments, and the advantages of the present invention above and in other aspects will become clearer.

[0079] This invention discloses a metal recognition system and method employing a general-purpose inductive sensor and image processing. The system includes a conveyor belt, a motor and its transmission device, a driver, a sensor array, a data acquisition unit, and a computer.

[0080] The conveyor belt is used to transport metal materials, and the speed of movement is v;

[0081] The motor and its transmission device are used to drive the conveyor belt.

[0082] The driver is used to receive computer instructions and control the motor rotation according to the instructions;

[0083] The sensor group refers to N s An inductive sensor, used to generate current signals, is located below the conveyor belt and arranged in a straight line. The distance between the centers of adjacent sensors is w (w is greater than the diameter of the sensor), and the distance between the top of the sensor and the upper surface of the conveyor belt is h (h is greater than the thickness of the conveyor belt).

[0084] The data acquisition unit is used to acquire the current signal generated by the sensor group, and the current magnitude can be obtained by reading the value of its internal register;

[0085] The computer is used to control the driver, read data from the collector, perform neural network interpolation, image segmentation, determine the type of metal, and calculate the location of the metal.

[0086] like Figure 1 The diagram shown is a system hardware schematic (the computer, data acquisition unit, and driver are not shown in the diagram). Figure 2 The diagram shows the relationship between data acquisition and motor control. The computer issues instructions to the driver, thereby indirectly controlling the rotation of the motor and the movement of the conveyor belt. The current signals generated by the sensor group are processed by the data acquisition unit to obtain digital signals. The computer reads the values ​​of the registers in the data acquisition unit to obtain the magnitude of the current output by each sensor.

[0087] The method includes the following steps:

[0088] First, a neural network interpolation model needs to be trained, and the process is as follows:

[0089] S31: Randomly distribute some metal materials in a certain area on the conveyor belt; the certain area refers to a region of size (N). s +1)w×M t The rectangular region of Δl (where M) t T is a given positive integer, Δl is the distance the conveyor belt moves in each reading cycle, and Δl = T c v), the length of the rectangle is (N) s +1)w's edge is perpendicular to the direction of the conveyor belt's movement, and its upper left vertex (with the left side of the conveyor belt's forward movement direction as left and the forward movement direction of the conveyor belt as top) coincides with the center position of the leftmost sensor.

[0090] In this embodiment, N s =7, w=40mm, M t =50,T c =0.2s, v=25mm / s, Δl=T c v = 0.2s × 25mm / s = 5mm, then the size of the rectangular area is 280mm × 250mm.

[0091] S32: Move all sensors synchronously from left to right, with a step size of Δl. After moving n-1 times, return the sensors to their original positions. Then, move the conveyor belt forward a distance Δl and repeat the above steps. After completing the scanning of the certain area described in S31, stop moving. Record the current output of each sensor at each position to obtain a series of current value data I[X]. s ,Y s ][i s ]; where X s Y represents the number of times the conveyor belt moved during the data collection process. s This indicates the number of times the sensor has moved since its last return to its original position when this data was collected, i. s This indicates the sensor number that collected the data (the leftmost sensor is the first one), and X s =0,1,…,M t Y s =0,1,…,(n-1),i s =1,2,…,N s ;

[0092] In this embodiment, n = 8, and moving n-1 times specifically means moving the sensor 7 times before returning it to its original position.

[0093] S33: Generate a size of (M) t +1)×nN s empty two-dimensional array data s Fill the current value data collected in S32 into data according to formula (5). sIn the middle, where data s [X s ,n·(i s -1)+Y s ] represents data s The Xth s row, nth (i s -1)+Y s ) elements of the column;

[0094] data s [X s ,n·(i s -1)+Y s ] = I[X s ,Y s ][i s (5)

[0095] S34: From data s Extract all combinations of the following forms, data s [X t ,Y t ], data s [X t ,Y t +1],…,data s [X t ,Y t +n], where data s [X t ,Y t ] represents data s The Xth t row, Y t The elements of column X are the same as above, and X... t =0,1,…,M t Y t =0,1,…,(n·N) s -n-1);

[0096] S35: Use all combinations extracted in S34 as samples in the neural network training set TrainSet. Each sample contains n+1 elements, and each element is associated with the data. s The correspondence between elements in TrainSet is as follows: Define TrainSet[i t ][j t ] is the i-th node in TrainSet t The j-th sample t There are elements, and i t =1,2,3,…,j t =0,1,2,…,n; if the i-th t The first element of each sample is data. s[X t ,Y t If the remaining elements of the sample correspond as shown in equation (6), then the relationship between the remaining elements of the sample is as shown in equation (6).

[0097] TrainSet[i t ][j t ] = data s [X t ,Y t +j t (6)

[0098] In this embodiment, each sample of TrainSet contains 9 elements, namely TrainSet[i t ][0], TrainSet[i t [1], ..., TrainSet[i t [8].

[0099] S36: The neural network model IntNNmodel includes n-1 sub-models IntNNmodel[i m ], where i m Let i be the index of the sub-model. mdl =1,2,…,n-1; Each sub-model is a neural network model with 2 inputs and 1 output; The first element of the training sample is used as the starting point. t ][0] and the last element TrainSet[i t [n-1] are used as the first and second inputs respectively, with the element TrainSet[i t ][i m The output is ], and the sub-model IntNNmodel[i] is trained using the sigmoid function as the activation function. m The sub-model output value is defined as output[i]. m Combine all sub-models to obtain a neural network model IntNNmodel with 2 inputs and n-1 outputs, whose outputs are ordered as output[1], output[2], ..., output[n-1];

[0100] In this embodiment, IntNNmodel includes 7 sub-models, each containing an input layer, a hidden layer, and an output layer. The input layer has 2 nodes, the output layer has 1 node, and the hidden layer has 3 to 20 nodes, with the number of hidden layer nodes chosen to minimize the final error. Specifically, the feedforwardnet() and train() functions, built into the MATLAB software, are used to define the feedforward neural network, with TrainSet[i t ][0] and TrainSet[it [7] As input, TrainSet[i t ][i m As output, train the sub-model IntNNmodel[i m ].

[0101] Next, we need to train the neural network classification model ClfNNmodel, the process of which is as follows:

[0102] S91: Prepare the K that needs to be distinguished m Samples of various metal materials are required, with at least V samples of each type, and the number of samples of different types of metal materials being roughly equal. These metal material samples are randomly and sequentially scattered on a conveyor belt. Current data output by the sensor group is collected as the metal material samples pass through the detection area of ​​the sensor group, according to steps S1-S8. The maximum grayscale value (Gray) corresponding to each metal material sample is calculated. max and maximum gradient Grad max ;

[0103] In this embodiment, the prepared metal materials are copper, iron, and aluminum, with 50 samples of each metal material. Current data is collected, and Gray is calculated. max and Grad max The specific method is the same as the method for collecting and calculating the corresponding data in the actual subsequent work, namely S1-S8.

[0104] S92: Using the maximum grayscale value of all metals (Gray) max and maximum gradient Grad max Using the types of metals as the training set, train a 2-input, K-type array. m The output feedforward neural network ClfNNmodel, specifically based on Gray max and Grad max As input, the confidence probability of each type of metal is output.

[0105] In this embodiment, the classification model ClfNNmodel comprises an input layer, hidden layers, and an output layer. The input layer has 2 nodes, the output layer has 3 nodes, and the hidden layer has 17 nodes (i.e., 2 inputs and 3 outputs). Specifically, it uses the built-in feedforward neural network definition function feedforwardnet() and training function train() in the MATLAB software. max and Grad max As input, the confidence probability of each type of metal is output. For example, if a metal is copper, its three confidence probabilities are 1, 0, and 0, where 1 is the confidence probability of copper and the other two are the confidence probabilities of iron and aluminum.

[0106] After training the neural network interpolation model and the neural network classification model, you can begin the actual work, as follows: Figure 3 As shown, it specifically includes the following:

[0107] S1: Metal materials of different shapes and sizes, randomly distributed on the conveyor belt, continuously pass through the detection area above the sensor group. Multiple inductive sensors simultaneously output current signals, which are collected by the data acquisition unit. The computer processes these current signals every T seconds. c The data in the internal register of the data acquisition unit is read once to obtain the current magnitude, and the reading cycle T is controlled. c , making (where n is a given integer greater than 1);

[0108] In this embodiment, n = 8.

[0109] S2: Read M c After data from one period (M) c Given an integer greater than 1, store the collected data in a container of size M. c ×N s two-dimensional array data p In this way, data measured by the same sensor are in the same column, data measured at the same time are in the same row, and the order of the columns corresponds to the sensor installation position, and the order of the rows corresponds to the time sequence.

[0110] In this embodiment, M is taken. c =51, and N s The value is the same as in S31, taking N. s =7, then data p The size is 51×7.

[0111] S3: Generate a space of size M c ×(nN s An empty two-dimensional array data (-n+1) i Data is processed according to formula (1). p Fill the elements in the data i In the middle; using the pre-trained neural network interpolation model IntNNmodel, with data p two adjacent data items in a row of an array p [X i ,Y i ], data p [X i ,Y i +1] is the input to the neural network model, resulting in n-1 output values, which are named [X] according to their order. i ,Y i [1], [X] i,Y i [2],…,[X] i ,Y i [n-1]; Fill the interpolation model output into the data according to equation (2). i middle;

[0112] data i [n·X i ,n·Y i ] = data p [X i ,Y i (1)

[0113] data i [n·X i ,n·Y i +i i ] = [X i ,Y i ][i i (2)

[0114] In the formula X i =0,1,2…,(M c -1), Y i =0,1,2,…,(N s -1)(Y in equation (2) i ≠(N s -1))(Note that in this patent, the row and column numbers of all arrays start from 0), data i [n·X i ,n·Y i ] is the array data i The nth·X i row, nth Y i The element at column number, data p [X i ,Y i ]、data i [n·X i ,n·Y i +i i ] Same as above, i i Let i be the sequence number, and i i =1,2,…,n-1;

[0115] In this embodiment, data i The size is 51×49, and the outputs of the neural network interpolation model are [X i ,Y i [1], [X] i ,Y i [2],…,[X] i ,Y i][7].

[0116] S4: Transfer the two-dimensional array data i After normalizing the values ​​of each element in the data to the range [0, 255] and rounding them down, the data is then... i The values ​​of all elements in the array are used as the grayscale values ​​of the pixels, and a matrix of size M is generated according to the positional correspondence. c ×(nN s a grayscale image of (-n+1) pixels;

[0117] In this embodiment, the obtained grayscale image is as follows: Figure 4 As shown, the dark color represents the background color, and the light color represents the metal.

[0118] S5: Segment the image to obtain several independent regions. According to the position of each region in the image, place each grayscale image region in an image of the same size as the image and with all pixels having a grayscale value of 0. This results in several grayscale images containing only one region, called sub-grayscale images. Store these images in the image array Sons (where each element is a sub-grayscale image).

[0119] In this embodiment, a sub-grayscale image is obtained as follows: Figure 5 As shown, the black part has a grayscale value of 0, and the light-colored part is an extracted area, which contains multiple metals.

[0120] S6: Completely segment the sub-grayscale images in Sons to obtain several grayscale images that contain only the corresponding data of one metal, which are called single-metal grayscale images;

[0121] In this embodiment, a single grayscale image is obtained as follows: Figure 6 As shown, it contains only one metal, as indicated by the light-colored portion in the image. Figure 7 The image shown is a grayscale image data. img The result of superimposing several single-metal grayscale images obtained after complete segmentation.

[0122] S7: Determine the position of the metal in the original grayscale image according to formula (3), where (x k ,y k (x1,y1), (x2,y2), (x3,y3), etc. are the coordinates of all non-zero gray values ​​of pixels in the single-metal grayscale image. mean() means to calculate the mean of all quantities within the parentheses.

[0123] (x k ,y k)=mean((x1,y1),(x2,y2),(x3,y3),…) (3)

[0124] S8: Calculate the grayscale gradient of all pixels in the single-metal grayscale image according to formula (4), where (x,y) is the coordinate of a certain pixel and its grayscale gradient is Grad(x,y), while Gray(x-1,y) etc. represent the grayscale values ​​of pixel (x-1,y), etc. If pixel (x,y) is located on the image boundary such that one or two of the points (x-1,y) etc. do not exist, then the grayscale value of pixel (x,y) Gray(x,y) is used to replace the grayscale value of the non-existent point for calculation. By comparing the grayscale values ​​and grayscale gradients of all pixels, the maximum grayscale value Gray is obtained. max and maximum gradient Grad max ;

[0125]

[0126] S9: Using the trained neural network classification model ClfNNmodel, classify the grayscale values ​​of each single-metal grayscale image based on the maximum grayscale value (Gray). max Maximum gradient Grad max To determine the type of metal.

[0127] Step S5, which involves image segmentation, utilizes a self-seeking seed region growing image segmentation algorithm, including the following:

[0128] S51: The conditions for a seed point are set as follows: the gray value of the point is greater than the threshold T1 and the point has no affiliation (does not belong to any grown area); the growth criteria are set as follows: the point is within 4 neighborhoods of the seed point (or the newly grown point in the area) and the gray value of the point is greater than the threshold T1.

[0129] In this embodiment, T1 is set to 51.

[0130] S52: Scan all pixels in the image. When a pixel that meets the conditions for a seed point is found, the scan is paused and growth is performed using that pixel as the seed point. Specifically, all pixels in the image that meet the growth conditions are searched for and the pixels that meet the conditions are assigned as new points to the region where the seed point is located. The process of searching for new points is repeated until there are no more pixels that meet the growth criteria. At this point, one round of growth is completed and an independent region is obtained.

[0131] S53: After completing one round of growth, continue scanning from the paused point and grow again when the next seed point is found; until all pixels of the image have been scanned and there are no new seed points, the image segmentation is completed, and several independent regions are obtained.

[0132] Step S6 involves complete segmentation of the sub-grayscale image, specifically using an erosion algorithm, including the following:

[0133] S61: Find all grayscale peaks in the sub-grayscale image and assume that each peak corresponds to a metal. If the number of peaks in a sub-grayscale image is 0 or 1, it is assumed that there is only one metal in the image and is directly stored in the results array Results; otherwise, continue with subsequent processing.

[0134] S62: Amplify the grayscale values ​​of the peak point and the pixels within a certain range around it according to formula (7), where (x p ,y p () represents a peak point or a pixel near the peak point, whose grayscale value before magnification is Gray(x). p ,y p ), Gray p (x p ,y p ) is its magnified grayscale value, α is the magnification factor (α>1), and k depends on (x) p ,y p The distance from the peak point, k is maximized when the distance is 0;

[0135] Gray p (x p ,y p ) = Gray(x p ,y p )×α k (7)

[0136] In this embodiment, α = 1.4, k = 3 at the peak point, k = 2 at the 8-neighborhood of the peak point, and k = 1 at the 24-neighborhood of the peak point (excluding the 8-neighborhood).

[0137] S63: Perform a sequential scan of the sub-grayscale image, targeting all points (x) that meet the conditions. c ,y c (That is, at least one of the four neighboring pixels of this point has a gray value of 0 and its own gray value is not 0), and it is reduced according to formula (8);

[0138] Gray c (x c ,y c ) = Gray(x c ,y c )×b i ×c j (8)

[0139] In the formula Gray(x c ,y c ) is the pixel before shrinking (x)c ,y c The grayscale value of Gray c (x c ,y c (x) is the pixel after scaling down. c ,y c The gray value of the pixel is denoted as b, which is the edge shrinkage factor (b<1), i is the number of points with a gray value of 0 in the 4-neighborhood of the pixel, c is the valley shrinkage factor (c<1), and j is the number of points with a gray value higher than the pixel in the 4-neighborhood of the pixel.

[0140] In this embodiment, b = 0.8 and c = 0.9 are used.

[0141] S64: Set a threshold T2. If the gray value of a certain pixel is reduced according to formula (8) and the resulting gray value is less than T2, then set the gray value of that pixel to 0.

[0142] In this embodiment, T2 is set to 25.

[0143] S65: Using the image segmentation method described in S5 (the threshold T1 used is set to T2 used in S64), extract independent regions in the sub-grayscale image. If only one region can be extracted, the surface sub-grayscale image has not yet been split, then repeat S63-S64; if two or more regions can be extracted, the surface sub-grayscale image has been split, and subsequent steps can be continued.

[0144] S66: According to the position of each region in the image, place each grayscale image region in a blank image of the same size as the sub-grayscale image to obtain several grayscale images containing only one region, called grandchild grayscale images. Store the grandchild grayscale images in the image array NewSons.

[0145] S67: After processing all the sub-grayscale images in Sons using S61-S66, NewSons saves the grandchild grayscale images generated from all the sub-grayscale images. Replace the images in Sons with the grandchild grayscale images in NewSons to become new sub-grayscale images.

[0146] S68: Repeat S61-S67 to process all new sub-grayscale images in Sons. If new sub-grayscale images are generated, continue to repeat S61-S67. If no new sub-grayscale images are generated, that is, all sub-grayscale images have been split into images containing only one metal and stored in the result array Results in S61, then all splitting has been completed. Output all images in the result array Results as the result.

[0147] The method for finding the peak point in step S61 specifically includes:

[0148] S611: Sequentially scan the sub-grayscale image. If a certain pixel is the point with the largest grayscale value within a 5×5 pixel range centered on it, consider that point as a peak point, record its position, and use this method to find all peak points.

[0149] S612: If the number of peaks found is 0 or 1, it is assumed that there is only one metal in the image, and no further steps are performed; the number of peaks is directly output. Otherwise, there may be multiple metals in the image, and further processing is required before output.

[0150] S613: Consider any two peak points (x) p1 ,y p1 ),(x p2 ,y p2 If any pixel (x) on the line connecting them... v ,y v Gray value of Gray(x) v ,y v ) satisfies equation (9) (where T3 is a given threshold, Gray(x) p1 ,y p1 ) and Gray(x p2 ,y p2 ) respectively represent (x p1 ,y p1 ),(x p2 ,y p2 If the gray values ​​of two points are equal, then it is considered that (x) p1 ,y p1 ),(x p2 ,y p2 () represents the peak points of different metals; conversely, if there is no such pixel on the line connecting the two points, the two peak points are considered to belong to the same metal.

[0151] 0.5×(Gray(x p1 ,y p1 )+Gray(x p2 ,y p2 ))-Gray(x v ,y v )≥T3 (9)

[0152] In this embodiment, T3 is set to 64.

[0153] S614: After determining all pairwise combinations of peak points, if there are two or more peak points (x... p1 ,y p1 ),(x p2 ,y p2 ),(x p3 ,y p3If the metals are of the same type, then the new coordinates (x, y) can be calculated according to equation (10). p0 ,y p0 The peak points of the metal are identified by the peak points; finally, all peak points are output as the result.

[0154] (x p0 ,y p0 )=mean((x p1 ,y p1 ),(x p2 ,y p2 ),(x p3 ,y p3 ),…) (10)

[0155] This invention provides a metal recognition system and method employing a general-purpose inductive sensor and image processing. Many methods and approaches exist for implementing this technical solution; the above description is merely a preferred embodiment of the invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principles of this invention, and these improvements and modifications should also be considered within the scope of protection of this invention. All components not explicitly stated in this embodiment can be implemented using existing technologies.

Claims

1. A metal recognition method based on a metal recognition system, the metal recognition system comprising a conveyor belt, a transmission device, a driver, a sensor group, a collector and a computer; the conveyor belt is used for conveying metal, and its moving speed is v; the transmission device is used for driving the conveyor belt; the driver is used for receiving the computer instructions and controlling the transmission device to drive according to the instructions; the sensor group comprises N s inductive sensors, the inductive sensors are used for generating current signals, and are arranged in a "one" shape below the conveyor belt, the distance between the centers of adjacent inductive sensors is w, and the distance between the top of the inductive sensors and the upper surface of the conveyor belt is h; the collector is used for collecting the current signals generated by the sensor group, and storing the current signals in the form of data in the internal register thereof; the computer is used for controlling the driver, reading the data stored in the collector, judging the metal type and calculating the metal position; characterized in that, The method comprises the following steps: 1) Metals of different shapes and sizes, randomly scattered on the conveyor belt, continuously pass through the detection area above the sensor group. Multiple inductive sensors simultaneously output current signals. The data collector acquires these current signals and stores them as data in its internal register. The computer records these signals every time interval T. c Read the data stored in the collector once, where n is a given integer greater than 1; 2) After reading data of M c periods, the read data is placed in a two-dimensional array data c with a size of M s × N p , M c is a given integer greater than 1, and data obtained by the same inductive sensor is placed in the same column, data obtained at the same time is placed in the same row, and the arrangement order of the columns corresponds to the installation position of the inductive sensor, and the arrangement order of the rows corresponds to the time T c in sequence; 3) Generate a size of M c ×(nN s An empty two-dimensional array data (-n+1) i , the two-dimensional array data p The elements in the data are filled into the two-dimensional array data. i In detail: Using a pre-trained neural network interpolation model IntNNmodel, with a two-dimensional array data p two adjacent data in a row p [X i ,Y i ], data p [X i ,Y i +1] is the input to the neural network interpolation model IntNNmodel, which outputs n-1 values, arranged according to the two-dimensional array data. p The sorting of each row in the table names the n-1 values ​​as [X] i ,Y i [1], [X] i ,Y i [2],…,[X] i ,Y i [n-1]; Fill the output of the neural network interpolation model IntNNmodel into the two-dimensional array data according to equations (1) and (2). i middle: data i [n·X i ,n·Y i ]=data p [X i ,Y i ] (1) data i [n·X i ,n·Y i +i i ]=[X i ,Y i ][i i ] (2) where X i = 0, 1, 2,..., (M c - 1), Y i = 0, 1, 2,..., (N s - 1), and Y i ≠ (N s - 1), data i [n · X i , n · Y i ] is the element in the n · X i th row and n · Y i th column of the two-dimensional array data i , data p [X i , Y i ] is the element in the X p th row and Y i th column of the two-dimensional array data i , data i [n · X i , n · Y i + i i ] is the element in the n · X i th row and n · Y i + i i th column of the two-dimensional array data i , i i is a serial number, and i i = 1, 2,..., n - 1. 4) normalize the value of each element in the two-dimensional array data i to the interval [0, 255] and take the integer, and then take the value of all elements in the two-dimensional array data i as the gray value of the pixel point, and correspond the element in the two-dimensional array data i to the position of the image pixel coordinate to be equivalent to a gray-scale image image with a size of M c × (nN s -n+1) pixels; 5) segmenting the gray image image to obtain a plurality of independent regions, and placing each region in a gray image with the same size as the gray image image and all pixel gray values of 0 according to the position of each region in the gray image image, to obtain a plurality of gray images containing only one region, referred to as sub-gray images, and storing the sub-gray images in an image array Sons, each element of the image array Sons being a sub-gray image; 6) completely segmenting the sub-gray images in the image array Sons to obtain a plurality of gray images containing only one metal corresponding data, referred to as single-metal gray images; 7) determining the coordinates (x k ,y k ) of the metal in the gray scale image image according to formula (3), wherein (x1,y1), (x2,y2), (x3,y3)… are the coordinates of all pixel points with a gray scale value not equal to 0 in the single-metal gray scale image, and mean() represents the mean value of all quantities within the parentheses; (x k ,y k ) = mean((xi, yi), (x2, y2), (x3, y3),... ) (3) 8) The gray value gradient of all pixels in the single-metal gray image is calculated according to formula (4), wherein (x, y) is the coordinate of a certain pixel, and Gray(x-1, y) and Gray(x+1, y) represent the gray values of the pixel coordinate (x-1, y) and the pixel coordinate (x+1, y); if the pixel coordinate (x, y) is located at the boundary of the single-metal gray image, so that one or both of the pixel coordinate (x-1, y) and the pixel coordinate (x+1, y) do not exist, then the gray value of the pixel coordinate (x, y) Gray(x, y) is used to replace the gray value of the non-existing point for calculation, and by comparing the gray values and the gray value gradients of all pixels, the maximum value of the gray value Gray max and the maximum gradient Grad max are obtained. 9) using the trained neural network classification model ClfNNmodel, determine the kind of metal from the maximum value of the gray scale values Gray max , the maximum gradient Grad max of each single metal gray scale image.

2. A metal recognition method using a general inductance sensor and image processing according to claim 1, wherein, The training process of the neural network interpolation model IntNNmodel in step 3) is as follows: 31) randomly scattering metal in areas on the conveyor belt; said areas are of size (N s +1)w x M t Δl, where M t is a given positive integer and Δl is the distance moved by the conveyor belt in time T c , i.e. Δl = T c v, the length of the rectangular area being the side of (N s +1)w perpendicular to the direction of movement of the conveyor belt and its upper left corner coinciding with the center position of the leftmost inductive sensor, left being the left side in the direction of positive movement of the conveyor belt, the direction of positive movement of the conveyor belt being upwards; 32) Synchronously move all inductive sensors from left to right with a step size of Δl, after moving n-1 times, return the inductive sensors to their original positions; then make the conveyor belt move forward by a distance of Δl, in this way until the scanning of the area in step 31) is completed, stop moving; record the current signal output by each inductive sensor at each position, obtain the current signal I[X s ,Y s ][i s ]; wherein X s represents the number of times the conveyor belt moves when collecting the current signal, Y s represents the number of times the inductive sensor moves after the last time it is returned to its original position when collecting the current signal, i s represents the serial number of the inductive sensor collecting the current signal, wherein the leftmost inductive sensor is the first one, and X s = 0, 1, …, M t , Y s = 0, 1, …, (n-1), i s = 1, 2, …, N s ; 33) Generate a size of (M) t +1)×nN s empty two-dimensional array data s According to formula (5), the current signal I[X] collected in step 32) is... s ,Y s ][i s Fill in the two-dimensional array data s In the middle, where data s [X s ,n·(i s -1)+Y s ] represents a two-dimensional array data s The Xth s row, nth (i s -1)+Y s ) elements of the column; data s [X s ,n·(i s -1)+Y s ]=I[X s ,Y s ][i s ] (5) 34) Extract all combinations of the following form from a two-dimensional array data s data s [X t ,Y t ], data s [X t ,Y t +1],..., data s [X t ,Y t +n], where data s [X t ,Y t +n] denotes the element of data s in row X t , column Y t +n, and X t = 0,1,...,M t , Y t = 0,1,...,(n·N s -n-1) ; 35) Take all the combinations extracted in step 34) as training samples in a neural network training set TrainSet, each training sample contains n+1 elements, define TrainSet[i t ][j t ] as the j t th element of the i t th training sample in the neural network training set TrainSet, and i t =1,2,3,…,j t =0,1,2,…,n; if the first element of the i t th training sample is data s [X t ,Y t ], then the corresponding relationship of the remaining elements of the training sample is shown in formula (6); TrainSet[i t ][j t ] = data s [X t ,Y t +j t ] (6) 36) The neural network interpolation model IntNNmodel comprises n-1 sub-models IntNNmodel[i m ], wherein i m is the serial number of the sub-model, and i m = 1, 2, …, n-2; each of the sub-models is a neural network model with 2 inputs and 1 output; the first element TrainSet[i t ][0] and the last element TrainSet[i t ][n-1] of the training sample are taken as the first input and the second input, respectively, the element TrainSet[i t ][i m ] is taken as the output, and the sigmoid function is taken as the activation function, to train the sub-model IntNNmodel[i m ] and define the output value of the sub-model as output[i m ]; all the sub-models are combined to obtain a neural network interpolation model IntNNmodel with 2 inputs and n-1 outputs, and the order of the outputs of the sub-models is output[1], output[2], …, ouptut[n-1].

3. A metal recognition method using a general inductance sensor and image processing according to claim 2, wherein, The implementation process of step 5) for segmenting the gray image image to obtain a plurality of independent regions is as follows: 51) setting a seed point, the seed point satisfying: the gray value of the point being greater than a set threshold T1 and the point not belonging to any region; the growth criterion being set as: the point being within the 4-field of the seed point or a new point of the region and the gray value of the point being greater than the threshold T1; 52) scanning all pixel points of the gray image image, when a pixel point satisfying the condition of the seed point is found, the scanning is paused, and growth is performed with the point as the seed point, specifically, all pixel points satisfying the growth condition in the gray image image are found, the points satisfying the condition are regarded as new points and are attributed to the region of the seed point, and the process of constantly finding new points is repeatedly performed, until there is no point satisfying the growth criterion, one round of growth is completed, and a plurality of independent regions are obtained; 53) after one round of growth is completed, the scanning is continued from the place where the scanning is paused, and growth is performed again when the next seed point is found; after all pixel points of the gray image image are scanned and there is no new seed point, the image segmentation is completed, and a plurality of independent regions are obtained.

4. The metal recognition method using a general inductance sensor and image processing according to claim 3, wherein, The implementation process of step 6) for completely segmenting the sub-gray images in the image array Sons is as follows: 61) finding all peak points of the gray values in the sub-gray image, and considering each peak point to correspond to a metal, if the number of peak points in a sub-gray image is 0 or 1, it is considered that there is only one metal in the sub-gray image, and the sub-gray image is directly stored in the result array Results; otherwise, subsequent processing is continued; 62) The gray value of the peak point and its surrounding pixel points is enlarged according to formula (7), wherein (x p ,y p ) is the coordinate of the peak point or a pixel point near the peak point, the gray value before enlargement is Gray(x p ,y p ), Gray p (x p ,y p ) is the gray value after enlargement, a is the enlargement coefficient and is greater than 1, k depends on the distance of (x p ,y p ) from the peak point, and k takes the maximum value when the distance is 0; Gray p (x p ,y p ) = Gray(x p ,y p ) x a k (7) 63) Perform a sequential scan of the sub-grayscale image, targeting all pixel coordinates (x, y) that meet the conditions. c ,y c The pixel coordinates (x) are reduced according to equation (8). c ,y c A point whose 4-neighborhood pixels contain at least one pixel with a gray value of 0 and whose own gray value is not 0: Gray c (x c ,y c ) = Gray(x c ,y c ) x b i x c j (8) where Gray(x c ,y c ) is the gray value of the pixel point coordinate (x c ,y c ) before the reduction, Gray c (x c ,y c ) is the gray value of the pixel point coordinate (x c ,y c ) after the reduction, b is the edge reduction coefficient and b < 1, i is the number of points with a gray value of 0 in the 4-neighborhood of the pixel point, c is the valley reduction coefficient and c < 1, and j is the number of points with a higher gray value than the pixel point in the 4-neighborhood of the pixel point. 64) setting a threshold T2, if the gray value of a pixel point after being reduced is less than T2, the gray value of the point is set to 0; 65) using the method of step 5) to continue extracting independent regions in the sub-gray image, wherein the threshold is set to T2, if only one region can be extracted, it is considered that the sub-gray image has not been split, and steps 63) to 64) are repeated; if two or more regions can be extracted, it is considered that the sub-gray image has been split, and subsequent steps are continued; 66) According to the position of each region in the sub-gray image, each region is placed in a blank image with the same size as the sub-gray image, and a number of gray images containing only one region are obtained, which are called grand- gray images, and the grand-gray images are stored in the image array NewSons; 67) After all the sub-gray images in the image array Sons are processed using steps 61) to 66), the image array NewSons stores all the grand-gray images generated by the sub-gray images, and the grand-gray images in the image array NewSons are used to replace the images in the image array Sons to become new sub-gray images; 68) Repeat steps 61) to 67) to process all new sub-gray images in the image array Sons, and if there are new grand-gray images generated, continue to repeat steps 61) to 67); if there are no new grand-gray images generated, that is, all sub-gray images have been split into images containing only one metal, and the result array Results has been stored in step 61), then the entire splitting has been completed, and all images in the result array Results are output as the result.

5. The metal identification method using a general inductance sensor and image processing according to claim 4, wherein, The implementation process of finding the peak points of all gray values in the sub-gray image in step 61) is as follows: 611) Scan the sub-gray image sequentially, if a pixel point is the point with the maximum gray value in the 5x5 pixel range centered on it, it is considered as a peak point, its position is recorded, and all peak points are found in this way; 612) If the number of peak points found is 0 or 1, it is considered that there is only one metal in the image, and the subsequent steps are not performed, and the number of peaks is directly output; otherwise, there are multiple metals in the image, and the subsequent processing is continued and then output; 613)Consider any two peak point corresponding pixel point coordinates (x p1 ,y p1 ),(x p2 ,y p2 ), if the gray value Gray(x v ,y v ) of any one pixel point coordinate (x v ,y v ) on the line satisfies formula (9), then consider that the pixel point coordinates (x p1 ,y p1 ),(x p2 ,y p2 ) are different metal peak points; otherwise, if there is no such pixel point on the line, consider that the two peak points belong to the same metal; 0.5 x (Gray(x p1 ,y p1 ) - Gray(x p2 ,y p2 )) - Gray(x v ,y v ) ≥ T3 (9) Where T3 is a given threshold, Gray(x) p1 ,y p1 ) and Gray(x p2 ,y p2 ) respectively represent (x p1 ,y p1 ),(x p2 ,y p2 The grayscale values ​​of the two points; S614: After judging all the peak points of two combinations, if two or more peak points (x p1 ,y p1 ),(x p2 ,y p2 ),(x p3 ,y p3 ) belong to the same metal, then according to formula (10) (x p0 ,y p0 ) = mean((x p1 ,y p1 ),(x p2 ,y p2 ),(x p3 ,y p3 ),…) (10) The new pixel point coordinates (x p0 ,y p0 ) are found as the peak point of the metal; finally all the peak points are output as the result.

6. The metal identification method using a general inductance sensor and image processing according to claim 5, wherein, The training process of the neural network classification model ClfNNmodel in step 9) is as follows: 91) prepare K m A sample of different kinds of metals, and the number of each kind of metal sample is not less than V, and the number of different kinds of metal samples is the same; randomly distribute these metal samples in random order on the conveyor belt, collect the current signal output by the sensor group when the metal sample passes through the inductive sensor detection area according to steps 1)-8), and calculate the maximum value Gray max of the gray value corresponding to each metal sample max ; 92) with the maximum value of gray level Gray max and the maximum gradient Grad max and the kind of metal sample as the training set, a 2-input, K m output feedforward neural network ClfNNmodel is trained, specifically with Gray max and Grad max as inputs, and the confidence probability of each kind of metal sample as output.

Citation Information

Patent Citations

  • An intelligent medical image segmentation method based on three-dimensional reconstruction

    CN109509199A

  • Detection method, detection system, equipment and medium

    CN114445317A