CN109859199B - Method for detecting quality of freshwater seedless pearls through SD-OCT image - Google Patents

Method for detecting quality of freshwater seedless pearls through SD-OCT image Download PDF

Info

Publication number
CN109859199B
CN109859199B CN201910114133.4A CN201910114133A CN109859199B CN 109859199 B CN109859199 B CN 109859199B CN 201910114133 A CN201910114133 A CN 201910114133A CN 109859199 B CN109859199 B CN 109859199B
Authority
CN
China
Prior art keywords
image
pearl
pixel
gradient
point
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910114133.4A
Other languages
Chinese (zh)
Other versions
CN109859199A (en
Inventor
周扬
石龙杰
岑岗
陈正伟
汪凤林
周武杰
岑跃峰
黄�俊
张晨光
马伟锋
刘铁兵
施秧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Lover Health Science and Technology Development Co Ltd
Original Assignee
Zhejiang Lover Health Science and Technology Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Lover Health Science and Technology Development Co Ltd filed Critical Zhejiang Lover Health Science and Technology Development Co Ltd
Priority to CN201910114133.4A priority Critical patent/CN109859199B/en
Publication of CN109859199A publication Critical patent/CN109859199A/en
Application granted granted Critical
Publication of CN109859199B publication Critical patent/CN109859199B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention discloses a method for detecting the quality of fresh water non-nucleus pearls based on an SD-OCT image. Collecting an SD-OCT image of the freshwater non-nucleated pearl, separating a background and a target of the freshwater non-nucleated pearl, flattening and translating the target area, cutting an area with obvious characteristics in the target area, and performing noise reduction processing on the area to obtain a characteristic image; extracting positive gradient features, negative gradient features and texture features of the feature image; selecting a pearl SD-OCT image with classified types as a sample, creating and inputting the sample into a BP neural network model for training; and after training, predicting and identifying the condition to be detected and outputting the category of whether pearls exist. The method has a good noise reduction effect on the SD-OCT image of the pearl, can more conveniently extract the characteristics of the image, solves the problems of poor noise reduction effect and difficult characteristic extraction of the image, and has good classification robustness and accuracy.

Description

Method for detecting quality of freshwater seedless pearls through SD-OCT image
Technical Field
The invention relates to a method for detecting pearl quality by using a pearl image, in particular to a method for detecting the quality of a fresh water seedless pearl by using an SD-OCT image.
Background
The existing method adopts a noise reduction algorithm combining median filtering and BM3D algorithm to the pearl SD-OCT image, so that the denoising effect is not obvious, more speckle noise still exists, a larger error is generated on the extraction target of the pearl SD-OCT image with unobvious defects and the background boundary, and the method has no universality; the features extracted by the existing method are only limited to acquiring the positive gradient feature and the negative gradient feature of the upper boundary and the lower boundary of the defect layer, the feature selection is less, and errors are easy to occur; the threshold values of the positive gradient feature and the negative gradient feature are set to distinguish defective pearls from non-defective pearls, the classification method is simple, the practicability is poor, only pearls with obvious defects and pearls without defects can be distinguished, and the SD-OCT images of pearls with unobvious features cannot be distinguished.
The method has the advantages of poor image noise reduction effect, simple algorithm for extracting the boundary between the image background and the target, great limitation, small quantity of extracted image features, poor distinguishing method between flawless pearls and defective pearls and no universality.
Disclosure of Invention
In order to solve the problems in the background art, the invention provides a method for detecting the quality of a freshwater non-nucleated pearl of an SD-OCT image.
As shown in fig. 1, the technical scheme adopted by the invention is as follows:
1) acquiring an SD-OCT image of the freshwater non-nucleated pearl, wherein 10% of image lines on the top of the image do not contain targets;
2) separating the background and the target of the pearl SD-OCT image, and extracting a target area;
3) flattening and translating the target area, cutting an area with obvious characteristics in the target area, and performing noise reduction processing on the area to obtain a characteristic image;
4) extracting positive gradient features, negative gradient features and texture features of the feature image;
5) selecting a pearl SD-OCT image divided into a non-defective pearl and a defective pearl as a sample, creating and inputting the sample into a BP neural network model for training;
in the specific implementation, 100 well-classified pearl SD-OCT images are selected as samples, wherein 95 samples which can represent all pearl classes are used as training sets, and the remaining 5 samples are used as testing sets. To be used subsequently
6) Setting parameters of a BP neural network model, setting a learning rate Ir to be 0.01, and determining a coefficient R2And setting the number to be 0.9, repeating the steps for the pearl SD-OCT image of unknown category to extract and obtain positive gradient features, negative gradient features and texture features, inputting the extracted features into the trained BP neural network model by taking the extracted features as input data of the classification model, outputting the category of the pearl, and finishing the detection of whether the SD-OCT image has defective pearls.
The step 2) is specifically as follows:
2.1) the gray value of 10% of image line pixels at the top of the pearl SD-OCT image is reduced to 0 to obtain an image f;
2.2) carrying out bottom-cap transformation on the image f obtained after the processing of the step 2.1) by using a square structural element B to obtain an image Bhat(f) The calculation is as follows:
Bhat(f)=(f·b)-f
Figure RE-GDA0002025160590000021
wherein the content of the first and second substances,
Figure RE-GDA0002025160590000022
the method is characterized in that a closed operation of an image f of a square structural element b is used, wherein the closed operation is to perform corrosion operation on a pearl SD-OCT image f
Figure RE-GDA0002025160590000023
Then carrying out expansion operation theta;
2.3) for the image B after bottom-hat conversionhat(f) Carrying out multiple opening operations, wherein the formula of each opening operation is as follows:
Figure RE-GDA0002025160590000024
the starting operation is to firstly carry out comparison on the image Bhat(f) Performing an expansion operation
Figure RE-GDA0002025160590000025
And then carrying out corrosion operation theta, and when the image is not changed after the opening operation, not carrying out the opening operation.
2.4) for the image f obtained after the processing of the step 2.1), grouping each pixel with the gray value not being 0 and the pixels with the gray value not being 0 in the 8-connected region into an object, combining the adjacent objects in the 8-connected region into an object, so that each pixel at the edge of the object does not have the pixel with the gray value not being 0 in the respective 8-connected region, and then grouping the gray value of the object with the number of pixels less than 40 in the upper 50% region of the image into 0;
the 8-connected region is a pixel formed by 8 pixels at the position immediately adjacent to the upper, lower, left, right, upper left, upper right, lower left and lower right of each pixel and at the position obliquely adjacent to each other.
2.5) carrying out multiple closing operations on the image processed in the step 2.4), when the image does not change after the closing operations, not carrying out the closing operations, after the closing operations are finished, traversing each row of pixels of the image from top to bottom, stopping traversing when traversing to a pixel with a gray value of 1, and taking the row position of the pixel with the gray value of 1 as a boundary point between the target and the background in the row;
2.6) extracting the boundary points of each row according to the method in the step 2.5), connecting the boundary points of each row to form a boundary between the background area and the target area, taking the upper part of each boundary point as a background pixel point, and taking the lower part of each boundary point as a target pixel point, and forming the target area by all the target pixel points of each row.
The step 3) is specifically as follows:
3.1) calculating the line position x of the demarcation point between each column of backgrounds and the target in the target area obtained by the processing of the step 2)iCyclically up-shifting H for each column of pixelsiDistance of one pixel, obtaining a translated image, Hi=xi-1;
3.2) cutting off the left side edge and the right side edge which account for 20 percent of the image in the translated image, and then cutting off the bottom edge which accounts for 50 percent of the image;
3.3) carrying out median filtering on the cut image, and then carrying out noise reduction on the image subjected to median filtering by using a DTCTWT image noise reduction algorithm to obtain a characteristic image.
The step 4) is specifically as follows:
4.1) defining a convolution template w, and performing convolution on the characteristic image by using the convolution template w to obtain a gradient image;
4.2) taking the pixel with the gray value of the pixel more than or equal to 0 in the gradient image as a positive gradient pixel, taking the pixel with the gray value of the pixel less than 0 in the gradient image as a negative gradient pixel, taking the three positive gradient pixels with the maximum gray value in each column as positive gradient jumping points, and sequentially marking the number of lines where the three positive gradient jumping points are positioned as y according to the gray value of the positive gradient pixel from large to smalli1、yi2、yi3And will go on line yi1、yi2、yi3I represents the number of columns of pixels as the row position of the positive gradient trip point of each column;
4.3) dividing the gradient image into a plurality of image blocks by taking every 40 lines as an image block from top to bottom, wherein the last image block does not limit the number of lines; the image block with the largest number of positive gradient jumping points is taken as an area where the upper boundary of the pearl defect part is located, each row of positive gradient pixels with the largest gray value are selected in the area to serve as positive boundary point pixels between the pearl defect part and the pearl non-defect part, and the average value of the gray values of each row of positive boundary point pixels of the gradient image is taken as a positive gradient characteristic;
4.4) taking the positive demarcation point pixel of each row of the gradient image as a starting point, searching downwards for a pixel distance which accounts for 5 percent of the longitudinal total pixel of the image, taking the negative gradient pixel with the minimum gray value as a negative demarcation point pixel, wherein the negative gradient characteristic is the average value of the gray values of the negative demarcation point pixels of each row of the gradient image;
in the step 4.4), if the distance between the positive demarcation point pixel and the last line of the gradient image is less than 5% of the pixel distance of the longitudinal total pixels of the image, taking the last line of the gradient image as a lower limit, and taking the searched negative gradient pixel with the minimum gray value as the negative demarcation point pixel.
4.5) traversing the characteristic image by adopting a window of n × n, and calculating a gray level co-occurrence matrix C in the searching direction phi of 90 degrees, wherein the value C of each point in the gray level co-occurrence matrix Ci,jThe calculation is as follows:
Figure RE-GDA0002025160590000031
Figure RE-GDA0002025160590000032
wherein f (x, y) represents a characteristic image, Ci,jIs the value of the point (i, j) in the gray level co-occurrence matrix C, i and j represent the row sequence number and the column sequence number of the point in the gray level co-occurrence matrix C; x and y represent the horizontal and vertical coordinates in the window respectively,&expressing the sum relation, d phi expressing the derivation;
4.6) value C of each pixel point in the gray level co-occurrence matrix Ci,jAnd calculating the energy E of the gray level co-occurrence matrix as follows:
Figure RE-GDA0002025160590000041
4.7) value C of each pixel point in the gray level co-occurrence matrix Ci,jCalculating contrast C of gray level co-occurrence matrixconThe calculation is as follows:
Figure RE-GDA0002025160590000042
4.8) value C of each pixel point in the gray level co-occurrence matrix Ci,jComputing autocorrelation C of gray level co-occurrence matrixcorThe calculation is as follows:
Figure RE-GDA0002025160590000043
Figure RE-GDA0002025160590000044
4.9) value C of each pixel point in the gray level co-occurrence matrix Ci,jCalculating the homogeneity H of the gray level co-occurrence matrix as follows:
Figure RE-GDA0002025160590000045
the positive gradient characteristic, the negative gradient characteristic, the energy E and the contrast C are combinedconSelf-correlation of CcorAnd the texture characteristic matrix is formed by transversely splicing the homogeneity H together.
The step 5) is specifically as follows:
5.1) selecting a pearl SD-OCT image divided into a non-defective pearl and a defective pearl as a sample, processing and extracting according to the steps 2) to 4) to obtain three characteristics, and establishing a training set;
5.3) carrying out normalization processing on the texture feature matrix Input corresponding to each sample in the training set, wherein the normalization is carried out to be decimal Input' between 0 and 1, and the calculation is as follows:
Figure RE-GDA0002025160590000046
wherein max represents the maximum value in the Input data Input, and min represents the minimum value in the Input data Input;
5.4) creating a BP neural network model, which comprises an input layer, a hidden layer and an output layer, wherein the number of the input layers is set to be 0, the number of the hidden layers is set to be 1, the number of the output layers is set to be 1, and the number m of nodes of the input layer, the number h of nodes of the hidden layer and the number n of nodes of the output layer meet the following formula:
Figure RE-GDA0002025160590000051
wherein a is an integer of 0-10 of the adjusting coefficient a;
and setting the iteration times, the root mean square error MSE and the learning rate Ir of the BP neural network model, inputting the training BP neural network model by using the normalized training set, and storing the trained BP neural network model. During training, the feature data in the normalized training set is used as model input data, and the classification labels are used as model output data.
In specific implementation, simulation prediction is carried out on input data of a test set, normalization information of output data of a training set is used for carrying out inverse normalization processing on a simulation prediction result, and a detection result is optimized and verified according to a decision coefficient.
The step 6) is specifically as follows:
6.1) processing pearl samples of unknown types according to the steps 2) to 4) to obtain characteristics;
6.2) inputting the characteristics of pearl samples with unknown categories into the BP neural network model trained in the step 5) as input data for category prediction, predicting whether the categories of defective pearls are contained or not, and completing the quality detection of the freshwater seedless pearls.
The method realizes the detection of the flawless pearl in the freshwater non-nucleus pearl image by specially calculating three texture characteristics and combining BP neural network model processing, and obtains accurate classification of the pearl quality.
The method comprises the steps of separating an image background and a target by a design algorithm, flattening and translating the target, cutting out a characteristic image, denoising the characteristic image, designing a convolution template to calculate a gradient image of the characteristic image, extracting a positive gradient characteristic and a negative gradient characteristic of the gradient image, and a texture characteristic of the characteristic image, wherein the texture characteristic comprises energy, contrast, autocorrelation and homogeneity of a gray level co-occurrence matrix, training a BP neural network model by using the extracted characteristic as input data and the category of pearls as output data, training a model meeting requirements, extracting the characteristic of pearls of unknown categories, and predicting the category of the pearls by using the trained model. The key points are the extraction of the characteristics of the pearl SD-OCT image, the selection of BP neural network model parameters, a software algorithm and the logic of the whole process.
The invention has the beneficial effects that:
the method can achieve a good noise reduction effect on the SD-OCT image of the pearl, more conveniently extract the characteristics of the image, and get rid of the problems of poor noise reduction effect and difficult characteristic extraction of the image.
The method extracts various characteristics of the image, classifies the pearls by using a supervised classification method, not only ensures the robustness of classification, but also ensures the accuracy of classification, can effectively distinguish flawless pearls from defective pearls, and improves the accuracy and universality of detection.
Drawings
FIG. 1: a flow logic diagram of a pearl detection method of a pearl SD-OCT image;
FIG. 2: example collected fresh water pearl SD-OCT images, where (a) is a defect-free pearl sample and (b) is a defective pearl sample;
FIG. 3: example extracted target region;
FIG. 4: effect diagrams after flattening and translating steps of the target area of the embodiment;
FIG. 5: filtering and denoising the cut image to obtain a characteristic image;
FIG. 6: gradient images of the embodiments;
FIG. 7: the embodiment is used for an effect graph of a positive boundary and a negative boundary extracted from a defective pearl;
FIG. 8: the embodiment simulates a test result chart.
Detailed Description
The invention is described in further detail below with reference to the figures and the embodiments.
The examples of the invention are as follows:
(1) collecting an SD-OCT image of the fresh water pearl to enable 10% of rows on the upper part of the image not to occupy a target;
SD-OCT images of 100 different types of pearls are collected, for example, as shown in figure 2, and are divided into a defect-free pearl sample in figure 2(a) and a defect pearl sample in figure 2 (b).
(2) Separating the background and the target of the pearl SD-OCT image, taking the region of the target as the target region, and extracting the target region
2.1) the gray value of the upper 10 percent of line pixels of the pearl SD-OCT image is reduced to 0;
2.2) carrying out bottom-cap transformation on the pearl SD-OCT image f processed in the step 2.1) by using square structural elements B with the size of 3 x 3 to obtain an image Bhat(f) The calculation is as follows:
Bhat(f)=(f·b)-f
Figure RE-GDA0002025160590000061
the method comprises the following steps of performing closed operation on a pearl SD-OCT image f by using a square structural element b with the size of 3 x 3, wherein the closed operation is to perform corrosion operation on the pearl SD-OCT image f and then perform expansion operation;
2.3) for the image B after bottom-hat conversionhat(f) 10 open operations are carried out, and the formula of each open operation is as follows:
Figure RE-GDA0002025160590000062
specifically, image B is first alignedhat(f) Carrying out expansion operation, and then carrying out corrosion operation; see above
2.4) for the gray-scale image processed in the step 2.1), grouping each pixel with the gray-scale value not 0 together with the pixels with the gray-scale value not 0 in the 8-connected region as one object, merging the adjacent objects in the 8-connected region into one object, so that each pixel at the edge of the object does not have the pixel with the gray-scale value not 0 in the respective 8-connected region, and then grouping the gray-scale value of the object with the number of pixels less than 40 in the upper 50% region of the image as 0;
the 8-connected region is a pixel formed by 8 pixels at the position immediately adjacent to the upper, lower, left, right, upper left, upper right, lower left and lower right of each pixel and at the position obliquely adjacent to each other.
2.5) performing closed operation for 50 times on the image processed in the step 2.4), traversing each row of pixels of the image from top to bottom after the closed operation is finished, stopping traversing when a pixel with a gray value of 1 is traversed, and taking the row position where the pixel with the gray value of 1 is located as a boundary point between the target and the background in the row;
2.6) extracting the boundary points of each row according to the method in the step 2.5), connecting the boundary points of each row to form a boundary between the background area and the target area, taking the upper part of the boundary points as background pixel points, and taking the lower part of the boundary points as target pixel points, so that all the target pixel points of each row form the target area, and obtaining the result shown in fig. 3.
(3) Flattening and translating the target area, cutting the area with obvious characteristics in the target area, and denoising the area to obtain a characteristic image
3.1) calculating the line position x of each column of demarcation point between the background and the target in the target areaiCyclically up-shifting H for each column of pixelsiDistance of one pixel, obtaining a translated image, Hi=xi-1; the results are shown in FIG. 4.
3.2) cutting off the left side edge and the right side edge which account for 20 percent of the image in the translated image, and then cutting off the bottom edge which accounts for 50 percent of the image;
3.3) median filtering is carried out on the cut image, the size of a neighborhood window of the median filtering is 4 x 10, then the image after the median filtering is subjected to noise reduction by using a DTCTWT image noise reduction algorithm, and a characteristic image is obtained, wherein the result is shown in figure 5.
(4) Extracting positive gradient feature, negative gradient feature and texture feature of feature image
4.1) define a convolution template w ═ 11111; 01110; 00000; 01110; 11111 ], convolving the characteristic image by using the convolution template w to obtain a gradient image, as shown in FIG. 6;
4.2) taking the pixel with the gray value of the pixel more than or equal to 0 in the gradient image as a positive gradient pixel, taking the pixel with the gray value of the pixel less than 0 in the gradient image as a negative gradient pixel, taking the three positive gradient pixels with the maximum gray value in each column as positive gradient jumping points, and sequentially marking the number of lines where the three positive gradient jumping points are positioned as y according to the gray value of the positive gradient pixel from large to smalli1、yi2、yi3And will go on line yi1、yi2、yi3I represents the number of columns of pixels as the row position of the positive gradient trip point of each column;
4.3) dividing the gradient image into a plurality of image blocks by taking every 40 lines as an image block from top to bottom, wherein the number of lines of the last image block is not limited, namely the number of the remaining lines is taken; the image block with the largest number of positive gradient jumping points is taken as an area where the upper boundary of the pearl defect part is located, each row of positive gradient pixels with the largest gray value are selected in the area to serve as positive boundary point pixels between the pearl defect part and the pearl non-defect part, and the average value of the gray values of each row of positive boundary point pixels of the gradient image is taken as a positive gradient characteristic;
4.4) with the positive demarcation point pixel of each row of the gradient image as the starting point, searching for 20 pixel distances downwards, and taking the negative gradient pixel with the minimum gray value as the negative demarcation point pixel, wherein the negative gradient characteristic is the average value of the gray values of the negative demarcation point pixels of each row of the gradient image;
the positive and negative cutoff pixels result as shown in fig. 7.
In the step 4.4), if the distance between the positive boundary point pixel and the last line of the gradient image is less than 20 pixels, the last line of the gradient image is taken as a lower boundary, and the searched negative gradient pixel with the minimum gray value is taken as the negative boundary point pixel.
4.5) traversing the characteristic image by adopting a window of n × n, and calculating and searchingA gray level co-occurrence matrix C at 90 DEG phi, the value C of each point in the gray level co-occurrence matrix Ci,jThe calculation is as follows:
Figure RE-GDA0002025160590000081
Figure RE-GDA0002025160590000082
wherein f (x, y) represents a characteristic image, Ci,jIs the value of the point (i, j) in the gray level co-occurrence matrix C, i and j represent the row sequence number and the column sequence number of the point in the gray level co-occurrence matrix C; x and y represent the horizontal and vertical coordinates in the window respectively,&expressing the sum relation, d phi expressing the derivation;
4.6) value C of each pixel point in the gray level co-occurrence matrix Ci,jAnd calculating the energy E of the gray level co-occurrence matrix as follows:
Figure RE-GDA0002025160590000083
4.7) value C of each pixel point in the gray level co-occurrence matrix Ci,jCalculating contrast C of gray level co-occurrence matrixconThe calculation is as follows:
Figure RE-GDA0002025160590000084
4.8) value C of each pixel point in the gray level co-occurrence matrix Ci,jComputing autocorrelation C of gray level co-occurrence matrixcorThe calculation is as follows:
Figure RE-GDA0002025160590000085
Figure RE-GDA0002025160590000086
4.9) value C of each pixel point in the gray level co-occurrence matrix Ci,jComputing gray level co-occurrenceHomogeneity H of the matrix, calculated as follows:
Figure RE-GDA0002025160590000091
the positive gradient characteristic, the negative gradient characteristic, the energy E and the contrast C are combinedconSelf-correlation of CcorAnd the texture characteristic matrix is formed by transversely splicing the homogeneity H together.
(5) Selecting 100 well-classified pearl SD-OCT images as samples, wherein 50 are non-defective fresh water pearl samples and 50 are defective fresh water pearl samples, extracting the characteristics in the step 4) from 100 samples as a data set, selecting 95 samples which can represent all the classes as a training set, using the remaining 5 samples as a test set, extracting the characteristics as input data, training a BP neural network model by using the classes of the samples as output data, and creating the model for classification;
5.1) selecting 100 pearl SD-OCT images classified by experts as samples, processing and extracting according to the steps (2) to (4) to obtain three characteristics, and establishing a training set;
5.2) selecting 95 samples capable of representing all pearl categories from a data set containing 100 sample characteristics as a training set, wherein input data of the training set is characteristics extracted from 95 samples, the output number of the training set is the pearl categories corresponding to 95 samples, the rest 5 samples are used as a test set, the input data of the test set is the characteristics extracted from 5 samples, and the pearl categories corresponding to 5 samples are used as output data of the test set;
5.3) for each feature in the training set, taking all feature data under the feature as Input data to perform normalization processing, and normalizing the feature data into decimal Input' between 0 and 1, and calculating as follows:
Figure RE-GDA0002025160590000092
wherein max represents the maximum value in the Input data Input, and min represents the minimum value in the Input data Input;
5.4) creating a BP neural network model, which comprises an input layer, a hidden layer and an output layer, wherein the number of the input layers is set to be 0, the number of the hidden layers is set to be 1, the number of the output layers is set to be 1, and the number m of nodes of the input layer, the number h of nodes of the hidden layer and the number n of nodes of the output layer meet the following formula:
Figure RE-GDA0002025160590000093
wherein a is an adjusting constant, and a is an integer between 0 and 10; in specific implementation, the number m of nodes of the input layer is set to 0, the number h of nodes of the hidden layer is set to 9, the number n of nodes of the output layer is set to 1, and a is set to 8. Please check
The iteration number of the BP neural network model is set to 1000, and the root mean square error MSE is set to 10-3And setting the learning rate Ir to be 0.01, inputting the training BP neural network model by using the normalized training set, and storing the training BP neural network model. During training, the feature data in the normalized training set is used as model input data, and the classification labels are used as model output data.
Using BP neural network model to perform simulation prediction on input data of the test set, the result is shown in FIG. 8, and using normalization information of output data of the training set to perform inverse normalization processing on the simulation prediction result, and determining coefficient R2Judging the fitting degree of the trained BP neural network prediction result and the true value, and abandoning the decision coefficient R2Selecting 95 samples from 100 samples to be used as a training set to train a new model when the BP neural network model is less than 0.9, and determining a coefficient R2Models greater than 0.9 were considered qualified BP neural network models.
(6) Setting parameters of a BP neural network model, extracting the characteristics of the pearl sample with unknown category, taking the extracted characteristics as input data of a classification model, and outputting the output data which is the category of the pearl
6.1) processing the pearl sample of unknown type according to the steps to obtain characteristics;
6.2) inputting the characteristics of pearl samples with unknown categories into the BP neural network model trained in the step 5 as input data for category prediction, predicting whether the categories of defective pearls are contained or not, and completing the quality detection of the freshwater seedless pearls.

Claims (5)

1. A method for detecting the quality of fresh water non-nucleus pearls of an SD-OCT image is characterized by comprising the following steps:
1) acquiring an SD-OCT image of the freshwater non-nucleated pearl, wherein 10% of image lines on the top of the image do not contain targets;
2) separating the background and the target of the pearl SD-OCT image, and extracting a target area;
3) flattening and translating the target area, cutting an area with obvious characteristics in the target area, and performing noise reduction processing on the area to obtain a characteristic image;
4) extracting positive gradient features, negative gradient features and texture features of the feature image;
the step 4) is specifically as follows:
4.1) defining a convolution template w, and performing convolution on the characteristic image by using the convolution template w to obtain a gradient image;
4.2) taking the pixel with the gray value of the pixel more than or equal to 0 in the gradient image as a positive gradient pixel, taking the pixel with the gray value of the pixel less than 0 in the gradient image as a negative gradient pixel, taking the three positive gradient pixels with the maximum gray value in each column as positive gradient jumping points, and sequentially marking the number of lines where the three positive gradient jumping points are positioned as y according to the gray value of the positive gradient pixel from large to smalli1、yi2、yi3And will go on line yi1、yi2、yi3I represents the number of columns of pixels as the row position of the positive gradient trip point of each column;
4.3) dividing the gradient image into a plurality of image blocks by taking every 40 lines as an image block from top to bottom, wherein the last image block does not limit the number of lines; the image block with the largest number of positive gradient jumping points is taken as an area where the upper boundary of the pearl defect part is located, each row of positive gradient pixels with the largest gray value are selected in the area to serve as positive boundary point pixels between the pearl defect part and the pearl non-defect part, and the average value of the gray values of each row of positive boundary point pixels of the gradient image is taken as a positive gradient characteristic;
4.4) taking the positive demarcation point pixel of each row of the gradient image as a starting point, searching downwards for a pixel distance which accounts for 5 percent of the longitudinal total pixel of the image, taking the negative gradient pixel with the minimum gray value as a negative demarcation point pixel, wherein the negative gradient characteristic is the average value of the gray values of the negative demarcation point pixels of each row of the gradient image;
4.5) traversing the characteristic image by adopting a window of n × n, and calculating a gray level co-occurrence matrix C in the searching direction phi of 90 degrees, wherein the value C of each point in the gray level co-occurrence matrix Ci,jThe calculation is as follows:
Figure FDA0002628040670000011
Figure FDA0002628040670000012
wherein f (x, y) represents a characteristic image, Ci,jIs the value of the point (i, j) in the gray level co-occurrence matrix C, i and j represent the row number and the column number of the point in the gray level co-occurrence matrix C; x and y represent the horizontal and vertical coordinates in the window respectively,&expressing the sum relation, d phi expressing the derivation;
4.6) value C of each pixel point in the gray level co-occurrence matrix Ci,jAnd calculating the energy E of the gray level co-occurrence matrix as follows:
Figure FDA0002628040670000021
4.7) value C of each pixel point in the gray level co-occurrence matrix Ci,jCalculating contrast C of gray level co-occurrence matrixconThe calculation is as follows:
Figure FDA0002628040670000022
4.8) value C of each pixel point in the gray level co-occurrence matrix Ci,jComputing autocorrelation C of gray level co-occurrence matrixcorThe calculation is as follows:
Figure FDA0002628040670000023
Figure FDA0002628040670000024
4.9) value C of each pixel point in the gray level co-occurrence matrix Ci,jCalculating the homogeneity H of the gray level co-occurrence matrix as follows:
Figure FDA0002628040670000025
the positive gradient characteristic, the negative gradient characteristic, the energy E and the contrast C are combinedconSelf-correlation of CcorTransversely splicing the texture characteristic matrix and the homogeneity H together to form a texture characteristic matrix;
5) selecting a pearl SD-OCT image divided into a non-defective pearl and a defective pearl as a sample, creating and inputting the sample into a BP neural network model for training;
6) and (3) repeating the step 4) for the pearl SD-OCT image of unknown type to extract and obtain positive gradient features, negative gradient features and texture features, inputting the extracted features as input data of a classification model into the trained BP neural network model, outputting the type of the pearl, and finishing the detection of whether the SD-OCT image has defective pearls.
2. The method for detecting the quality of the fresh water non-nucleated pearl according to the SD-OCT image of the claim 1, wherein the method comprises the following steps: the step 2) is specifically as follows:
2.1) the gray value of 10% of image line pixels at the top of the pearl SD-OCT image is reduced to 0 to obtain an image f;
2.2) carrying out bottom-cap transformation on the image f obtained after the processing of the step 2.1) by using a square structural element B to obtain an image Bhat(f) The calculation is as follows:
Bhat(f)=(f·b)-f
Figure FDA0002628040670000031
wherein the content of the first and second substances,
Figure FDA0002628040670000032
the method is characterized in that a closed operation of an image f of a square structural element b is used, wherein the closed operation is to perform corrosion operation on a pearl SD-OCT image f
Figure FDA0002628040670000033
Then carrying out expansion operation theta;
2.3) for the image B after bottom-hat conversionhat(f) Carrying out multiple opening operations, wherein the formula of each opening operation is as follows:
Figure FDA0002628040670000034
2.4) for the image f obtained after the processing of the step 2.1), grouping each pixel with the gray value not being 0 and the pixels with the gray value not being 0 in the 8-connected region into an object, combining the adjacent objects in the 8-connected region into an object, and then grouping the gray values of the objects with the number of the pixels being less than 40 in the upper 50% region of the image into 0;
2.5) carrying out multiple closing operations on the image processed in the step 2.4), when the image does not change after the closing operations, not carrying out the closing operations, after the closing operations are finished, traversing each row of pixels of the image from top to bottom, stopping traversing when traversing to a pixel with a gray value of 1, and taking the row position of the pixel with the gray value of 1 as a boundary point between the target and the background in the row;
2.6) extracting the boundary point of each row according to the method in the step 2.5), wherein the upper part of the boundary point is used as a background pixel point, and the lower part of the boundary point is used as a target pixel point, so that all target pixel points of each row form a target area.
3. The method for detecting the quality of the fresh water non-nucleated pearl according to the SD-OCT image of the claim 1, wherein the method comprises the following steps: the step 3) is specifically as follows:
3.1) calculating the line position x of the demarcation point between each column of backgrounds and the target in the target area obtained by the processing of the step 2)iCyclically up-shifting H for each column of pixelsiDistance of one pixel, obtaining a translated image, Hi=xi-1;
3.2) cutting off the left side edge and the right side edge which account for 20 percent of the image in the translated image, and then cutting off the bottom edge which accounts for 50 percent of the image;
and 3.3) carrying out median filtering on the cut image, and then carrying out noise reduction on the image subjected to the median filtering to obtain a characteristic image.
4. The method for detecting the quality of the fresh water non-nucleated pearl according to the SD-OCT image of the claim 1, wherein the method comprises the following steps: the step 5) is specifically as follows:
5.1) selecting a pearl SD-OCT image divided into a non-defective pearl and a defective pearl as a sample, processing and extracting according to the steps 2) to 4) to obtain three characteristics, and establishing a training set;
5.3) carrying out normalization processing on the texture feature matrix Input corresponding to each sample in the training set, wherein the normalization is carried out to be decimal Input' between 0 and 1, and the calculation is as follows:
Figure FDA0002628040670000041
wherein max represents the maximum value in the Input data Input, and min represents the minimum value in the Input data Input;
5.4) creating a BP neural network model, which comprises an input layer, a hidden layer and an output layer, wherein the number of the input layers is set to be 0, the number of the hidden layers is set to be 1, the number of the output layers is set to be 1, and the number m of nodes of the input layer, the number h of nodes of the hidden layer and the number n of nodes of the output layer meet the following formula:
Figure FDA0002628040670000042
wherein a is an adjustment coefficient;
and setting the iteration times, the root mean square error MSE and the learning rate Ir of the BP neural network model, inputting the training BP neural network model by using the normalized training set, and storing the trained BP neural network model.
5. The method for detecting the quality of the fresh water non-nucleated pearl according to the SD-OCT image of the claim 1, wherein the method comprises the following steps: the step 6) is specifically as follows:
6.1) processing pearl samples of unknown types according to the steps 2) to 4) to obtain characteristics;
6.2) inputting the characteristics of pearl samples with unknown categories into the BP neural network model trained in the step 5) as input data for category prediction, predicting whether the categories of defective pearls are contained or not, and completing the quality detection of the freshwater seedless pearls.
CN201910114133.4A 2019-02-14 2019-02-14 Method for detecting quality of freshwater seedless pearls through SD-OCT image Active CN109859199B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910114133.4A CN109859199B (en) 2019-02-14 2019-02-14 Method for detecting quality of freshwater seedless pearls through SD-OCT image

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910114133.4A CN109859199B (en) 2019-02-14 2019-02-14 Method for detecting quality of freshwater seedless pearls through SD-OCT image

Publications (2)

Publication Number Publication Date
CN109859199A CN109859199A (en) 2019-06-07
CN109859199B true CN109859199B (en) 2020-10-16

Family

ID=66897735

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910114133.4A Active CN109859199B (en) 2019-02-14 2019-02-14 Method for detecting quality of freshwater seedless pearls through SD-OCT image

Country Status (1)

Country Link
CN (1) CN109859199B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110298857B (en) * 2019-06-28 2021-06-04 浙江科技学院 Automatic celadon glaze layer thickness measuring method based on SD-OCT image
CN111145222A (en) * 2019-12-30 2020-05-12 浙江中创天成科技有限公司 Fire detection method combining smoke movement trend and textural features
CN112288722B (en) * 2020-10-30 2022-07-01 浙江科技学院 Method for testing pearl luster

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559507A (en) * 2013-11-18 2014-02-05 沈阳工业大学 Method for detecting traffic signs based on combination of color feature and shape feature
CN104143087A (en) * 2014-07-24 2014-11-12 苏州大学 Contusive retina internal segment and external segment deficiency detecting method based on SD-OCT
CN105654107A (en) * 2015-09-21 2016-06-08 长春迪瑞医疗科技股份有限公司 Visible component classification method based on SVM
CN105787562A (en) * 2016-03-24 2016-07-20 上海工程技术大学 Yarn dyed fabric texture type recognition method
CN105893960A (en) * 2016-03-31 2016-08-24 杭州电子科技大学 Road traffic sign detecting method based on phase symmetry
CN105938563A (en) * 2016-04-14 2016-09-14 北京工业大学 Weld surface defect identification method based on image texture
CN106023158A (en) * 2016-05-10 2016-10-12 浙江科技学院 SD-OCT-image-based nacre layer defect identification method for fresh water non-nucleated pearl
CN106326914A (en) * 2016-08-08 2017-01-11 诸暨市奇剑智能科技有限公司 SVM-based pearl multi-classification method
CN106332713A (en) * 2016-08-16 2017-01-18 浙江科技学院 Method for identifying early-phase bruise of loquat through SD-OCT image
CN106780427A (en) * 2016-11-10 2017-05-31 浙江科技学院 A kind of bergamot pear bruise discrimination method based on OCT image
CN107392928A (en) * 2017-07-20 2017-11-24 东北大学 Breast cancer diagnosis system and method based on MRF Snake segmentations
CN108961261A (en) * 2018-03-14 2018-12-07 中南大学 A kind of optic disk region OCT image Hierarchical Segmentation method based on spatial continuity constraint

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103559507A (en) * 2013-11-18 2014-02-05 沈阳工业大学 Method for detecting traffic signs based on combination of color feature and shape feature
CN104143087A (en) * 2014-07-24 2014-11-12 苏州大学 Contusive retina internal segment and external segment deficiency detecting method based on SD-OCT
CN105654107A (en) * 2015-09-21 2016-06-08 长春迪瑞医疗科技股份有限公司 Visible component classification method based on SVM
CN105787562A (en) * 2016-03-24 2016-07-20 上海工程技术大学 Yarn dyed fabric texture type recognition method
CN105893960A (en) * 2016-03-31 2016-08-24 杭州电子科技大学 Road traffic sign detecting method based on phase symmetry
CN105938563A (en) * 2016-04-14 2016-09-14 北京工业大学 Weld surface defect identification method based on image texture
CN106023158A (en) * 2016-05-10 2016-10-12 浙江科技学院 SD-OCT-image-based nacre layer defect identification method for fresh water non-nucleated pearl
CN106326914A (en) * 2016-08-08 2017-01-11 诸暨市奇剑智能科技有限公司 SVM-based pearl multi-classification method
CN106332713A (en) * 2016-08-16 2017-01-18 浙江科技学院 Method for identifying early-phase bruise of loquat through SD-OCT image
CN106780427A (en) * 2016-11-10 2017-05-31 浙江科技学院 A kind of bergamot pear bruise discrimination method based on OCT image
CN107392928A (en) * 2017-07-20 2017-11-24 东北大学 Breast cancer diagnosis system and method based on MRF Snake segmentations
CN108961261A (en) * 2018-03-14 2018-12-07 中南大学 A kind of optic disk region OCT image Hierarchical Segmentation method based on spatial continuity constraint

Also Published As

Publication number Publication date
CN109859199A (en) 2019-06-07

Similar Documents

Publication Publication Date Title
CN111126202B (en) Optical remote sensing image target detection method based on void feature pyramid network
CN109801256B (en) Image aesthetic quality assessment method based on region of interest and global features
CN108562589B (en) Method for detecting surface defects of magnetic circuit material
CN108918536B (en) Tire mold surface character defect detection method, device, equipment and storage medium
CN112967243A (en) Deep learning chip packaging crack defect detection method based on YOLO
CN109191459B (en) Automatic identification and rating method for continuous casting billet macrostructure center segregation defect
CN109859199B (en) Method for detecting quality of freshwater seedless pearls through SD-OCT image
CN111582294B (en) Method for constructing convolutional neural network model for surface defect detection and application thereof
CN110415260B (en) Smoke image segmentation and identification method based on dictionary and BP neural network
CN109284779A (en) Object detecting method based on the full convolutional network of depth
CN108171119B (en) SAR image change detection method based on residual error network
CN111382785A (en) GAN network model and method for realizing automatic cleaning and auxiliary marking of sample
CN109003275A (en) The dividing method of weld defect image
CN112991271A (en) Aluminum profile surface defect visual detection method based on improved yolov3
CN113643268A (en) Industrial product defect quality inspection method and device based on deep learning and storage medium
CN111914902A (en) Traditional Chinese medicine identification and surface defect detection method based on deep neural network
CN111612747A (en) Method and system for rapidly detecting surface cracks of product
CN111145145A (en) Image surface defect detection method based on MobileNet
CN113221956A (en) Target identification method and device based on improved multi-scale depth model
CN115147363A (en) Image defect detection and classification method and system based on deep learning algorithm
CN113421223B (en) Industrial product surface defect detection method based on deep learning and Gaussian mixture
CN108932471B (en) Vehicle detection method
Dong et al. Fusing multilevel deep features for fabric defect detection based NTV-RPCA
CN110349119B (en) Pavement disease detection method and device based on edge detection neural network
CN111709936A (en) Ream paper defect detection method based on multi-level feature comparison

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant