Brown Rice Germ Integrity Identification Based on Deep Learning Network

For the quality inspection of brown rice, the segmentation of connected brown rice and the identiﬁcation of germ integrity are very important. However, there is no better traditional algorithm to achieve better segmentation and recognition results. This paper improves the brown rice (BR) segmentation algorithm based on background skeleton. The candidate matching points are obtained by the background skeleton method, and the optimal matching points are found by the ant colony algorithm. Experimental results show that the proposed segmentation algorithm achieves 96% accuracy, indicating that it can eﬀectively suppress the interference from the endosperm surface. After segmentation is complete, identiﬁcation of embryo integrity is performed. Firstly, a convolutional neural network (CNN) is built to identify the germ direction; then, the germ direction is normalized; ﬁnally, an improved Inception-v3 network is built to identify the germ integrity. On the basis of the Inception-v3 network, additional branches are added to improve the detection accuracy of small objects. In addition, mutual-channel loss and mlpconv are added to enable the model to better approximate the abstraction of the latent space. The experimental results show that the comprehensive recognition accuracy of the proposed algorithm is as high as 94.83%, which is signiﬁcantly higher than the current mainstream recognition algorithms.


Introduction
Brown rice (BR), which is high in nutrients, is currently very popular; as a result, ensuring the quality of BR production is critical [1]. During production and processing, BR germ integrity is primarily manually and subjectively determined, which is a low-efficiency process, and the BR germ integrity cannot be quantitatively analyzed [2]. e BR quality is determined by how well the germ portion can be preserved. e amount of germ preserved in each BR grain has a direct impact on BR processing quality. e less the germ is preserved, the greater the loss of nutrients in BR is [3]. erefore, it is necessary to not only preserve the germ of BR but also maximally increase the preserved extent of the germ of each BR grain during processing. us, it is necessary to examine the BR germ integrity during processing.
Machine vision is being increasingly applied in agriculture. An increasing number of studies have focused on the use of machine vision to examine rice quality. Machine vision can improve rice quality testing efficiency while also overcoming the effects of subjective factors, reducing test errors, and increasing test speed and accuracy. In recent years, Courtois et al. [4] proposed the use of image analysis techniques to assess the breakage of and cracks in parboiled rice grains. Lin et al. [5] proposed a method for splitting touching rice grains based on their contour curvature. Using a support vector machine, Sun et al. [6] evaluated and analyzed the chalkiness of connected rice grains. Payman et al. [7] developed a rice quality index test system based on expert vision.
In this study, BR germ integrity is comprehensively examined by image segmentation and identification. Wang et al. [8] improved the watershed algorithm to address the problem of oversegmentation of targets in image segmentation involving small connected targets. Jia et al. [9] inhibited the effects of noise on segmentation by bitmap cutting and region merging. Some researchers used various edge detection operators in the segmentation and extraction of images with targets and backgrounds that have significantly different features [10][11][12][13]. In a fully convolutional network (FCN), fully connected layers (in a conventional network) are treated as convolutional layers, and deconvolutional layers are connected. An FCN can generate a pixel segmentation map by upsampling [14,15].
Another method of detection is to use a target detection algorithm to directly identify and classify the targets in the original image, rather than using an image segmentation algorithm to extract single targets. Progress has been made since Krizhevsky et al. [16] proposed AlexNet [17]. At present, in computer vision tasks, convolutional neural networks are used to segment and classify targets [18][19][20]. In 2012, a major improvement was made to ImageNet [21][22][23]. Various deep learning methods, represented by convolutional neural networks (CNNs), have been used extensively well in terms of numerous vision tasks, including object detection. e single shot multibox detector (SSD) [23][24][25] performs exceedingly well in terms of detection accuracy and speed. In computer vision tasks, the use of multiresolution processing data will improve the overall level of image segmentation and classification [26,27]. e SSD was proposed in 2016 to address the problem of you-only-lookonce (YOLO) algorithms in target positioning having insufficient detection accuracy [28][29][30]. e main idea of the SSD is the dense and uniform sampling of an image at various locations. e SSD was established on the concept of anchor points in faster region-CNNs (R-CNNs) [31,32]. In the SSD, various prior frames are used to predict the proportion and length-to-width ratio (LWR) of the boundary frame of an object during sampling. e features are then extracted, classified, and regressed using a CNN. ere is only one step in the entire procedure. In order to detect targets, the SSD employs a pyramidical feature layer group. e shallow feature map has a smaller receptive field, so it can predict a small target, while the deep feature map has a larger receptive field, so it can predict a large target. In the SSD, however, feature layers of various scales are unrelated to one another, and feature complementarity between feature layers is lacking. As a result, the SSD is relatively inefficient in detecting general and small targets. In August 2020, Li et al. [33] investigated a deep learning based algorithm for marine target detection and segmentation with a 32.7% improvement in detection accuracy. In July 2021, Krishnamoorthy et al. [34] used the Inception ResNetV2 model to identify infectious organisms in rice plant leaves with a detection accuracy of 95.6%. In August 2021, Yang et al. [35] proposed a temporal feature-based segmentation (TFBS) model for accurate crop mapping using time-series SAR images. In October 2021, Lan et al. [36] proposed two improved recognition models MobileNetV2-UNet and FFB-BiSeNetV2 for the identification of rice weeds with an accuracy of 93%. In the same month, Wang et al. [37] proposed a small target detection algorithm based on Mask R-CNN model with a detection accuracy of 66.5%. In December 2021, Guo et al. [38] proposed an image segmentation and deep learning based method to automatically identify rice grains and calculate rice fructification rate with good results. In the same month, Wang and Qiu [39] used an unsupervised classification method for fast localization of small targets to improve detection efficiency.
In the process of processing, the quality testing of brown rice is of great significance for retaining nutrients and reducing food waste. Among them, the segmentation of connected BR and the detection of germ integrity are extremely important. However, the above algorithms are unable to effectively identify all the rice grains in an image and have difficulties with the connected rice grains in particular.
e main contributions of this study are summarized as follows: (1) e BR germ integrity is classified by image segmentation combined with image identification. Single rice grains are extracted from connected rice grains using the proposed segmentation algorithm. en, the BR germ integrity is classified based on an improved Inception-v3 model.
(2) e background skeleton-based segmentation algorithm is improved [40]. e region growing algorithm and ant colony algorithm [41][42][43][44] are integrated into reference-point matching to improve the matching accuracy for skeleton endpoints. (3) Two neural network (NN) models are used to identify BR germ integrity. First, the visual geometry group (VGG) model is used to identify and classify the directions of the BR germs. en, the Inception-v3 model is structurally improved to increase the identification accuracy.

Preprocessing.
ere are two steps to preprocessing a BR image. (1) After binarization, small, scattered white areas are often generated in an image due to the miscellaneous items on the platforms where the husks, bran, and rice are placed during production and processing as well as noise from some image processing procedures. ese small areas may subsequently affect the identification of the effective connected areas and thus need to be eliminated. (2) e training set is image preprocessed to enhance the features of the germ portion in the images in order to improve subsequent training performance for the germ integrity of single rice grains.

Image Preprocessing.
In the first step of image preprocessing, conventional spatial and frequency domain filters cannot simply and effectively eliminate the small areas, whereas a morphological filter can easily eliminate them. To eliminate the small areas, a structural element with a suitable dimension can be used to erode the original image. After erosion, these small areas can be eliminated. An erosion operation, on the other hand, enlarges the voids and separates the previously connected regions. A rice area can also be reduced by an erosion operation. To eliminate the negative effects of an erosion operation, a dilation operation can be subsequently performed. e combination consisting of first an erosion operation and a subsequent dilation operation is referred to as an opening operation. e "。" in the following equation is the operator of an opening operation and signifies that a structural element is first used to erode the image and then dilate the results of the erosion operation. We have A morphological filter is used to remove the small white area in the following left image. A 5 × 5 square is used as a structural element. e comparison image shows that the small white area is removed. e results are shown in Figure 1.

Image Segmentation Preprocessing.
In the second step of image segmentation preprocessing, the training set is subjected to top-hat transformation to enhance the germ features in the image.
is step involves reducing the grayscale levels of the dark regions and increasing the grayscale levels of the bright regions using the following equation to increase the contrast: (2) Figure 2(a) shows the original image. Figure 2(b) shows the result of politeness transformation. As a result, after the contrast stretching process, there is a sharper contrast between the germs and other parts of rice. is is beneficial to the subsequent germ integrity identification training.

Image Segmentation.
To segment small targets, this paper uses an improved image segmentation algorithm based on background skeleton features. In addition, the endpoint matching process in this algorithm is improved. To facilitate the analysis of BR grain features, it is necessary to separate the BR and the background based on image preprocessing. e background in the image is black, and its grayscale level differs relatively significantly from that of the BR in the image. To segment the BR grains, this study first uses a threshold segmentation algorithm. e image is segmented using the threshold segmentation algorithm based on the grayscale level.
is method is applied to distinguish the BR foreground image from background image and then converts the grayscale image into a binary image. e segmentation equation is shown as follows: where m(x, y) is the grayscale image, g(x, y) is the binary image, and N is the segmentation threshold (N is calculated using a classic and highly robust algorithm-the maximum between-class variance (Otsu) algorithm). A threshold is calculated using the Otsu algorithm primarily on the basis of maximum between-class difference between grayscale levels on the BR and the background. Based on the grayscale probability distribution, the Otsu algorithm for digital images is represented by the following equations: where z is the set grayscale segmentation threshold (grayscale levels are classified into classes A and B), P i is the probability of each gray level, w 0 and w 1 are the probability sums of grayscale levels for classes A and B, respectively, the probability measures of classes A and B grayscale levels are μ 0 and μ 1 , respectively, and σ 2 is the between-class variance. e optimum segmentation threshold T that leads to a maximum σ 2 is calculated by traversing z � [0, 255]. e segmentation threshold for the grayscale BR image is calculated using the Otsu algorithm. Grayscale levels greater and less than the segmentation threshold in the image are set to 1 and 0, respectively. us, a binary BR image is obtained. Figure 3 is a binary BR image obtained by processing a grayscale BR image.
Background segmentation is followed by region segmentation. Based on the similarities between the spatial regions, in the region segmentation process, the regions are merged according to the similarity criteria. Below, the region growing algorithm is primarily used to segment the regions in the binary BR image to complete the marking and characterization of the regions.
In region marking, the same connected components in an image are assigned the same mark, and different connected regions are differentiated with different marks. A binary image is used to mark the connected regions. e background is labeled with the same label (generally 0). Finally, the image is transformed into a mark matrix. e main algorithm used in region marking is region growing, which was originally used in grayscale image region segmentation. e idea of this algorithm is as follows. A seed pixel is set or found in the region that needs to be segmented. e region is expanded with this seed pixel as its initial point. Subsequently, the pixels within the neighborhood of the seed pixel are examined to determine their similarities to the seed pixel. e pixels that meet the similarity criteria are merged into the seed region. After that, until no more pixels meet the similarity criteria, the newly formed region is used as a seed for the similarity judgment and region merging steps. Finally, the merged region is one connected region that is independent.
After subjecting the binary BR image to the background segmentation and region marking procedures, it is necessary to further segment different regions by marking their geometric properties. A method for describing the region features, which is involved in the extraction of the shape features from the binary BR image, is described by the following. e BR features include the perimeter, area, direction of the long axis, and center of gravity. e perimeter of a BR grain is the length of the boundary of the region. On a two-dimensional plane, the perimeter of a region can be approximately calculated by counting the number of pixels of its boundary. Sometimes, to obtain a more accurate representation, pixels are treated as points, and the bend and linear boundaries of a right angle are distinguished by chaincode representations. When the chain-code value is an odd number (i.e., bend boundary), the length is denoted by . When the chain-code value is an even number (i.e., linear boundary), the length is denoted by 1. us, the perimeter p is represented by the following: where N e is the number of chain codes with even-number values and N o is the number of chain codes with oddnumber values. e area of a region is its basic property. For the region R in the BR image, its area is calculated based on the number of pixels contained within it. e area of the region R is represented by the following: e above equation calculates the cumulative number of pixels in all the regions plus 1.
e position of a target region in the image is characterized by its center of gravity. In the binary BR image, all the pixels within the region have a value of 1 and thus follow a uniform distribution. Let (x i , y i ) be the coordinates of the position of a pixel in the image. e equation for calculating the center of gravity is as follows: where x and y are the coordinates of the position of the center of gravity and S R is the area of the region. During BR identification correction, the direction of each BR grain plays an important role and is the main feature parameter for extraction correction. Under normal circumstances, for a long and narrow region, the direction of the long side of its minimum bounding rectangle is selected as the direction of its long axis.
where μ pq is the central moment of the region, f(x, y) is the pixel value of the point (x, y) in the region, and θ is the angle of the direction of the long axis. e connected regions in the binary BR image are marked using the region growing algorithm, as shown in Figure 4. In this paper, the connected regions of the image after binarization are numbered, and each number is at the center of each connected domain. e connected rice grains are segmented after the BR image has been subjected to the background threshold segmentation and region segmentation procedures. To segment the connected rice grains in the image, it is necessary to first determine the positions of the connected regions. e connected regions in the BR image are marked and described during the region segmentation procedure. Two of them were selected as examples for analysis. e original image is shown in Figure 5(a). First, the image is binarized, as shown in Figure 5 en, according to the calculation, the minimum convex hull (MCH) (i.e., minimum convex polygon) of each connected domain image is obtained. e MCH image is shown in Figure 5(c). Furthermore, the MCH region's area is calculated using the region marking method. Equations (12) and (13) can be used to determine the connected regions.
where i ∈ [1, m], f(i) is applied to judge the region connection condition (f(i) � 1 means that the current region is a connected region; f(i) � 0 means the current region is a nonconnected region), A(i) is the area of the region, convex is the area of the MCH in the region, S is the ratio of the area of the region to the area of the MCH, and H is the area threshold (H is set based on the area of a single rice grain in the binary image; in this study, H is set to 2,400, which is a little bit smaller than the area of a single rice grain in the binary image). After determining the connected regions, it is necessary to calculate the segmentation endpoints. us, an operation is performed on the binary image and the MCH image using equation (14). A binary image of the background image for connected rice grains within the MCH region is thus obtained, as shown in Figure 5(d).
where A(x, y) is the binary image of the MCH in the connected region, B(x, y) is the binary image of connected BR grains, and C(x, y) is the binary image of the background of the image of the connected BR grains.
In the binary image, the connected features between BR grains images have been completely extracted, so the background image is represented by a curve. e topographic and connection features in the background image are preserved in the skeleton image, as shown in Figure 5(e). e following shows the calculation of the skeleton: where ⊖ is defined as the morphological erosion operator, the background image is represented by  Journal of Food Quality function returns the value of 0. Detailed calculation method is shown as follows: where M(x, y) is a 3 × 3 neighborhood with A (x,y) as the center, A (x,y) is a pixel with the value of 1 in the background skeleton feature image, SM(x, y) is totaled elements in M(x, y), and the skeleton endpoint extraction function is represented by f M (x, y). e background skeleton endpoints are fixed in binary image. Because some skeleton endpoints are formed by the MCH boundary, not all of these skeleton endpoints can be defined as segmentation endpoints. us, the edges of the minimum convex image are detected based on the Sobel operator equations (21)-(23) to extract its boundary curve. en, the minimum Euclidian distance between the boundary curve of MCH and each skeleton endpoint is calculated. e results form a minimum Euclidian distance set. e nonsegmentation endpoints are then removed based on |G| � where A is the binary image of the MCH, G is the gradient of the image, G x and G y are, respectively, represented by the gradient of the image in x-axis and y-axis direction. ϕ is defined as the direction angle of gradient, J is defined as the set of the minimum Euclidian distances between endpoints and MCH, N is defined as total of endpoints, th is the segmentation endpoint distance judgment threshold (th is set to 4), Td i � 1 means that the point is a segmentation endpoint, and Td i � 0 means that the point is not a segmentation endpoint. In Figure 5(f ), the minimum distances between shaded endpoints and boundary contours are no more than th. us, these shaded endpoints need to be removed. In comparison, the white endpoints are determined to be segmentation endpoints.  Figure 6). In order to more distinctly show the spatial positional relationship in the image, an original contour curve of the background region of binary image is plotted (solid line T′ in Figure 6). In Figure 6, X is the selected segmentation endpoint as reference.

Feature Point Matching Steps
rough traversal of the pixels of the boundary curve T, the boundary point (X 2 ) closest to the reference segmentation endpoint is determined between the vector XX 2 .
en, the boundary curve where the boundary point X 2 is located is smoothed by filtering boundary spike noise, as shown in equation (27). Based on smooth handling of contour curve, the points (X 1 and X 3 ) near X 2 are selected.
us, matching direction angle of the reference endpoint is determined on the basis of X 1 , X 2 , and X 3 . e specific algorithm of matching angle is calculated by the following equations: where A X is defined as dilated skeleton image, A is original skeleton of binary image, B is defined as a 2radius circular structural element, A (i) is defined as coordinates of the contour boundary, X i is defined as Journal of Food Quality coordinates of boundary points after smooth handling of boundary curve, X mid is defined as the midpoint between X 1 and X 3 , and θ is defined as the angle of the vector X mid X 2 ������� �→ and the horizontal x-axis (i.e., the direction angle of the reference point; θ � [− π, π)).
(2) e selected reference point is matched with the corresponding segment end point, referring to the angle of the end point, and ±45°is selected as the matching radiating region (the shaded region in Figure 7). In Figure 7, the shaded region shows the search area for the points to be matched.
During the matching process, a seed image is first generated using the region generation algorithm. e seed image can be obtained by eroding the binary image multiple times with structural elements differing in shape and size. e seed image, unlike the binary image obtained during the background threshold segmentation process, does not place a premium on BR contour integrity. In the generation of the binary image needed for the seed image, there is no need to reduce the contrast, because this also reduces the clarity of the boundaries and, thereby, causes the boundaries to connect with one another. To avoid insufficiently clear gaps between the BR grains during binarization due to uneven lighting, the image can be subjected to a top-hat transformation with a relatively large structural element first. e following equation shows the top-hat transformation equation (31), where f is the input image, B is the structural element, and g is the output image. Figure 8(a) shows the binary image of connected BR grains. Figure 8(b) shows the obtained seed image.
Afterwards, a reference point randomly selected is considered as the center of the circle and the length of rice grain is regarded as the radius with the purpose of searching all reference points in the circle. Meanwhile, the image is considered as the grid map and the pixels of reference points are treated as coordinates; then the routine is planned by the ant colony algorithm. e shortest path of all reference points in the ergodic circle is calculated (the starting point and the ending point are not connected). e ant colony algorithm is constructed by a kind of biological heuristic optimization algorithm with regard to cooperative behaviors of ant colony in foraging, because its significant globally researching capability is widely applied in combinational optimization problems. Based on distance matrix D, the ant colony algorithm is used to calculate a group of patrol order X for minimization of patrol distance function V(X). e number of patrol points δ and the number of ants in its colony m and distance matrix D are known; then all points passed by ant K are recorded in tabu list t k . After the first loop, the tabu list is reset to zero; then ants are free to select again. Based on pheromone and the distribution of heuristic information, the state transition probabilities of ants are identified in its movement process, as expressed in Here, p k ij is state transition probability, the larger number indicates the greater probability of selecting the next point for ants. i and j indicate, respectively, the current node and the next node. τ ij (t) is the amount of pheromone on the line of i and j at t moment. η ij (t) is heuristic function. a k is searchable nodes collection not in tabu list. a is pheromone index of relative importance. β is visibility index of relative importance. d ij is the data of line i and line j in distance matrix D. According to equations (1) and (2) to execute the choice of next node until all patrol points are traversed, the length of motion path for each ant is recorded as L k (k � 1, 2, . . . m); meanwhile, the current shortest path L min and patrol order X are recorded. en the pheromone is updated pursuant to following equation and Δτ ij is reset to 0, as expressed in The k th ant passes through node(i, j) ,

0,
The k th ant doed not passes through node(i, j) .
Here, pheromone concentration τ ij (t) is pheromone concentration in previous t time. Δτ ij is the increasing number of pheromone in the node within unit interval. Δτ k ij (t) is the increasing number of pheromone ant K. ρ is volatility coefficient of pheromone. L k is the distance from the starting point to the end walked by ant K. θ is enhancement coefficient of pheromone. When iterations are up to its maximum Ncmax, jump out of the loop and then output the optimal patrol path X at this time as the final result. e shortest path planned by ant colony algorithm is as shown in image.
After shortest-distance path planned, the first step is to identify which two consecutive points are matching endpoints in the path and then select two points according to the order planned by the ant colony algorithm.
rough the shortest distance between the reference endpoint and seed image, the nearest seed from two endpoints is judged whether it is the same one or not. If the seeds are the same one, then they are matched endpoints. Otherwise, they are unmatched endpoints. e specific judgment method is as expressed in Figure 9. e result as shown in Figure 10 is concluded from the path planning and distance judgment of seeds. In the image, the endpoints of black line are matched endpoints. en the rest of endpoints are reused to execute endpoint matching through ant colony algorithm until the endpoints are finally matched.

Image Identification.
is study presents a CNN model for identifying BR germ positions as well as a CNN model for classifying BR germ integrity. In addition, these two models are used in combination to calculate the BR germ integrity.

Identification of the Germ Direction.
After grain image segmentation, the images of the single BR grains show that the germ is generally located in the upper left, upper right, lower left, or lower right corner of the grain. e direction of the germ is relatively notable. Furthermore, the images of single BR grains have already been corrected horizontally along the long axis. As a result, the germ can only go in four different directions. us, there are only four types of VGG network outputs. erefore, no complex feature parameters are needed, as shown in Figure 11.

Germ Integrity Identification.
By position identification, the images of the BR germs are rotated to ensure that they are in the same direction. en, the germ integrity is identified using an optimized Inception-v3 model. e simplest method for improving a network is to increase its depth and breadth and increase the numbers of hidden layers and neurons in each layer. However, there are some problems with this method. is method leads to a larger parameter space, renders fitting easier, and requires more computational resources. e deeper the network is, the easier it is for the gradient to vanish, and the more difficult it is to optimize the network. e core of the Inception-v3 model involves the use of 1 × 1, 3 × 3, and 5 × 5 small convolutional layers to replace the large convolutional layers of the network. is can significantly reduce the number of weighting parameters. Figure 12 shows the results obtained using the Inception-v3 model.
During the training process, the activation input value of the deep NN deepens prior to nonlinear transformation, resulting in the movement of the NN distribution. e convergence is slow during training because the overall distribution gradually becomes a nonlinear function. is Journal of Food Quality 9 results in the vanishing of the gradient of the low-level NN during backpropagation. e batch normalization method normalizes each data output (mean: 0; variance: 1) as well as the mean and standard deviation of the data after the convolution pool, as shown in the following equation: e Inception-v3 model is used in combination with a proposed loss function, which is referred to as the mutualchannel loss (MC-loss) function, to distinguish the features of different channels. In addition, the MC-loss function is used to limit the distribution of the channels. e MC-loss function contains two channel-related components, namely, a discriminality component and a diversity component [28]. Figure 13 shows the overall model framework.
e input image X ∈ R W×H is used as the input of the basic network. e depth feature F ∈ R N×W×H corresponding to the image is extracted, where N is the number of channels of the depth feature and W and H are the width and height of each feature map, respectively. In addition, it is required that N equal c × ξ, where c is the total number of classes in the training dataset and ξ is the number of feature maps allocated to each class. erefore, the n th -dimensional feature map of the depth feature F can be represented by F n ∈ R WH , n � 1, 2, ... , N. Moreover, the depth feature of the class i can be represented by F i ∈ R ξ×WH , i � 0, 1, 2, ... , c-1, as expressed in the following equation: Inputting two optimization objectives with different purposes into two different branches facilitates their calculation and optimization. In Figure 13, the cross-entropy loss branch treats the feature as input.
rough a fully connected layer, the conventional classification loss L CE is calculated. e cross-entropy loss can drive the network to extract the meaningful discriminality information and focus on the global discriminality region. In addition, the MC-loss branch supervises the network, allowing it to learn features and focus on different local discriminality regions. Subsequently, an ultimate loss function is obtained by adding the MC-loss weighted by μ and L CE . us, the loss function of the whole network is as follows: In addition, the MC-loss is obtained by a weighted addition of a discriminality component loss L dis and a diversity component loss L div . us, the MC-loss is defined as follows: e left boxes in Figure 14show the procedure for the distinguishability component. e diversity component is used to measure the similarities between the feature channels. As shown by the right side of Figure 14, the diversity component can drive the feature channels of the same group to become different, as shown in Figure 14.
e orthogonal classification layer adds an improved dropout, which reduces unnecessary link items of various categories, as shown in the following equation: M is a mask matrix of W, constant diagonal matrix, as expressed in the following equation: Based on Inception-v3 model, two branches are added. e first branch is the original germ rice image branch. e second branch is adding mlpconv to the Inception-v3 model which can help the model to better approximate the abstract representation of the potential space. e simple convolutional neural network cannot extract the abstract features of the germ well, and the inception structure is too   complicated, due to the small size of the brown rice germ. erefore, mlpconv is used to effectively extract the germ characteristics through the subsequent 1 * 1 convolution. Figure 15 shows the structure.
At the same time, ResNet is added into the second branch [45][46][47]. ese residual connections allow us to have a deeper network structure without increasing parameters. e second branch is multiple MBR connection including mlpconv, batch normalization, and ReLU. e integral structure is as shown in Figures 16 and 17. e input image is divided into three parts. rough the improved Inception-v3 loss function, the first part becomes the original part (the input image is 299 * 299). In the second part (the input image is 35 * 35; after upsampling it becomes 225 * 225), the BR germs are extracted based on the position direction. As the germ portion is too small in size, the number of pixels is increased by upsampling. Subsequently, the germ image is transferred to 7-layer MBR network. rough the MBR network, the deeper abstract features of the germ can be extracted. It is beneficial to improve the detection accuracy of embryo integrity. e upper part of the network focuses on the extraction of the overall features of brown rice, and the lower part of the network focuses on the feature extraction of the germ part of brown rice. Combining the two parts not only preserves the overall information of the rice, but also accurately detects the integrity of the germ. Finally, the first two parts are combined with the original germ image by global average pooling and input into a complete connection layer. Figure 18 shows the network structure.
During the production and processing of BR, all the processing procedures are completed by experienced workers through visual assessment, which ensures processing quality and facilitates the adjustment of the equipment. Human visual assessment is based on a general feeling and cannot accurately determine the germ integrity. To more accurately describe the germ integrity of BR and improve its quality, BR grains are classified by observation into eight types, ranging from germ-free BR to whole-germ BR. e classification of each type of BR is based on the germ integrity. Figure 19 shows the results.

Segmentation Experiment.
Connected BR grains were segmented using the improved background skeleton-based segmentation algorithm proposed in this study. Figure 20 shows the segmentation results.
In view of the limitations of the background skeletonbased segmentation algorithm for single rice grains, the original endpoint matching method was improved in this study. A segmentation experiment on multiple connected BR grains was performed by integrating the region growing algorithm. In addition, the image of the most complex BR grain connection condition was used in a comparison experiment. Figures 21 and 22 show the experimental results for the segmentation of randomly distributed BR grains.
Images are of various types of cereals in which rice grains are connected on a small scale. ese images were processed using the classic range-transformation watershed algorithm, the edge detection algorithm with different operators, the region growing algorithm, a fully convolutional NN (FCNN), and the proposed algorithm. e ultimate segmentation results obtained using these four algorithms are shown in Figures 23-27.
During the extraction of single BR grains, operations, such as image rotation, were performed. As a result, the BR grains were horizontal throughout the process. Figure 28 shows the results for single rice grains.
To examine the segmentation performance for various BR grains, 2000 grain samples were collected for three types of BR grains differing in LWR. e connected BR grains were segmented (25 images were collected for each 2000 grains). For the range-transformation watershed algorithm, the edge detection algorithm with different operators, the region growing algorithm, the FCNN, and the proposed algorithm, the number of correctly segmented BR grains and the segmentation time were determined. In addition, the accuracy of each algorithm was calculated. Correct segmentation should ensure that single BR grains are completely segmented and that there are no oversegmentation lines in the BR grains. Tables 1-6 summarize the results.
Tables 1-6 summarize the results. e average segmentation accuracies of the classic range-transformation watershed algorithm, the edge detection algorithm, the region growing algorithm, the FCNN, and the proposed algorithm for the three types of BR grains differing in LWR (long, short, and intermediate) were 72.6%, 83.67%, 90.9%, 91.3%, and 94.96%, respectively. e segmentation accuracy of the proposed algorithm was higher than those of the other segmentation algorithms. With regard to the computational time for the segmentation operation, of the three algorithms, the proposed algorithm required the longest computational time.
is is mainly because the proposed algorithm involves a relatively large number of steps in the segmentation operation and is more complex, thus requiring more computational time in processing. Because of this, the proposed algorithm effectively inhibited erroneous segmentation, had a higher segmentation accuracy, and provided more valid images of BR grains for the subsequent extraction of single BR grains.

Germ Direction Identification Experiment.
e 6,000 BR grains obtained after image segmentation were used as a training set. A total of 500 training iterations using the VGG  model were performed. In addition, the accuracy of the VGG model was examined by k-fold cross-validation. e accuracy of the VGG model was found to be 98.6%, meeting the accuracy requirements for germ position and direction identification.

Germ Integrity Identification Experiment.
First, the position of the germ of each single BR grain was determined using the germ position identification model. en, the BR grains were rotated so that their germs were in the same direction.
A total of 500 training iterations were performed using the improved Inception-v3 model. Afterwards, training was performed in intervals of 10. e accuracy of the improved Inception-v3 model was examined based on the test set.   Ultimately, the error rate on the test set converged to 5.9%. After 80 training iterations, there was a significant decrease in the rate of convergence. After 500 training iterations, k-fold cross-validation showed that the identification accuracy of the optimized Inception-v3 model was 95.3%. First, an experiment was conducted to examine the germ integrity of single BR grains. In the experiment, Daohuaxiang-2 BR grains with various levels of germ integrity were used as samples.
e whole batch of BR grains was first classified by visual observation according to the eight-type BR classification standard. For each type, 700 grains were selected for testing. A total of 5600 BR grain samples were used. e number of BR grains that could be collected from each image was limited. erefore, after manual identification, the samples were divided into eight groups. Each group consisted of 25 BR grains. ese samples were then subjected to image collection analysis. Image collection was    performed a total of five times. Finally, the manual classification and identification results were compared with the BR test results. Table 6 summarizes the experimental comparison results. In this section, the optimized Inception-v3 model was used to identify the germ integrity. To demonstrate its advantages, the optimized Inception-v3 model was compared with several currently popular deep network identification models (VGGnet16, VGGnet19, Inception-v3, and ResNet50). e performance of these models was evaluated. In addition, a comparison with the original dataset was performed. Table 7 summarizes the experimental comparison results.      A comparison of the models in Table 7 shows that the identification accuracy (94.97%) of the optimized Inception-v3 model was higher than those of the other models. As the initialization parameters for training the BR identification model, this model learned domain knowledge from large amounts of easily accessible same-domain data.
is addressed the problem of insufficient training data for the BR identification task and further improved the identification accuracy.
Finally, an overall and comprehensive image segmentation and identification experiment was performed to examine the germ integrity. e segmentation algorithm was used to determine the position of each BR grain (first segment according to the background skeleton, and then recognize through the improved Inception-v3 network (BSF)). e BSF network was compared with faster R-CNN, SSD, and YOLO-v3 in terms of accuracy. Table 8 summarizes the experimental comparison results.
A comparison of the methods in the above table shows that the identification accuracy (94.83%) of the BSF network was higher than those of the other algorithms. As a result, the BSF network performed relatively well in image segmentation. e recall rate of the BSF network was far higher than those of the other detection algorithms.

Conclusions
In this study, the background skeleton-based algorithm for image segmentation is improved. Besides, segmented endpoints are obtained by detecting skeleton features of the background images of connected BR grains. Meanwhile, adopting segmentation endpoint matching algorithm is beneficial for achieving segmentation successfully. is paper addresses image problems of connected BR grains. And the algorithm accuracy applied to image segmentation of connected BR grains in various shapes is above 96% as presented in this paper. In addition, this algorithm is suitable for segmenting images with large regions of connected BR grains and is highly robust. Moreover, compared to the classic segmentation algorithm, this algorithm is suitable for relatively wide BR grains.
In addition, two networks are proposed to identify germ integrity. A position network model is used to unify the directions of BR germs. Furthermore, an algorithm based on an improved Inception-v3 model is proposed for determining BR germ integrity. e network outputs are divided into eight categories based on their germ integrity. e accuracy of the proposed algorithm is higher than those of other NN algorithms. e comprehensive accuracy of the proposed algorithm is 94.83%. is algorithm can effectively suppress interference from the endosperm surface of BR.
Finally, an overall detection function is achieved based on background skeleton features and the deep learning network algorithm. First, identifying a large number of connected BR grains can ensure high accuracy performance. Second, this can also help rapidly and accurately determine the positions of BR grains. In the experiment, this method was found effective in identifying the germ integrity of a large number of BR grains.

Data Availability
e data used to support the findings of this study are included within the article.

Conflicts of Interest
e authors declare that they have no conflicts of interest.