Duck egg surface crack detection method and system based on image analysis

By performing color classification and collision simulation on duck eggs, collecting and classifying image samples, and improving the neural network model, the problem of possible damage to duck eggs and insufficient sample data during the detection process in the existing technology has been solved, and efficient and accurate duck egg crack detection has been achieved.

CN119359731APending Publication Date: 2025-01-24BEIJING NANKOU DUCK BREEDING TECH CO LTD +1

Patent Information

Application Number
CN202411936599.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-01-24

AI Technical Summary

Technical Problem

The existing duck egg crack detection technology has blind spots in the acquisition image, and the duck egg color cannot be distinguished from the duck egg color during the detection process. While it cannot ensure that it is not damaged to the duck egg during the detection process, an effective deep learning model is established with few sample data.

Method used

By obtaining a certain number of duck eggs, classify them according to the color of the duck egg shell, and perform collision simulation to generate cracks; collect duck egg surface images, and perform image classification to construct a duck egg image sample set; improve the prototype network and construct a duck egg surface crack detection Neural network and model training were performed to obtain a duck egg crack detection model.

Benefits of technology

During the testing process, it is guaranteed to be damaged to duck eggs, and an effective deep learning model is established with less sample data, which improves the accuracy and efficiency of the detection, and avoids the existence of the blind spot area.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119359731A_ABST
    Figure CN119359731A_ABST
Patent Text Reader

Abstract

The invention discloses a duck egg surface crack detection method and system based on image analysis, and relates to the technical field of duck egg crack detection, and the method comprises the following steps: obtaining a certain number of duck eggs, classifying the duck eggs according to duck egg shell colors, and carrying out collision simulation to generate cracks; collecting duck egg surface images, and constructing a duck egg image sample set; improving the prototype network, and constructing an original crack detection model; performing model training on the original crack detection model based on the duck egg image sample set to obtain a duck egg crack detection model; collecting a plurality of images of a to-be-detected duck egg, and detecting duck egg surface cracks by using the duck egg crack detection model; the method is used for solving the problems that in an existing duck egg crack detection technology, blind spot areas exist in collected images, duck egg colors are not distinguished for model training, and a deep learning model for duck egg crack detection cannot be established under the condition of less sample data while it is guaranteed that the duck eggs are not damaged in the detection process.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of duck egg crack detection, and in particular to a method and system for detecting duck egg surface cracks based on image analysis. Background Art

[0002] Duck eggs are prone to cracks during production, transportation, packaging and storage. These cracks not only affect the appearance quality of duck eggs, but may also lead to microbial invasion and accelerate the deterioration of duck eggs. Therefore, developing an efficient and accurate duck egg crack detection technology is of great significance to ensuring the quality of duck eggs.

[0003] Existing crack detection technologies for duck eggs mainly include acoustic vibration detection and computer vision detection. Acoustic vibration detection is based on the fact that cracks on duck egg shells will change their structure. When struck, the sounds produced by cracked egg shells and intact egg shells are completely different. The duck eggs are lightly tapped at the equator by a mechanical device to analyze the difference in acoustic frequency response between cracked eggs and normal eggs, thereby making a judgment. However, the detection process is easily affected by the surrounding environment and can easily cause secondary damage to the duck eggs. For example, a patent application with publication number CN114544772A discloses a crack detection device and method for duck eggs based on a convolutional neural network and a sound spectrum. The solution is to strike the duck eggs to be detected with a hammer to obtain a sound signal of striking the duck eggs, and then analyze the sound signal to determine whether the duck eggs have cracks. Although it is possible to determine whether the duck eggs have cracks under certain circumstances, the collected sound signals are easily affected by the surrounding environment, and striking the duck eggs with a hammer can easily cause secondary damage to the duck eggs. Computer vision detection can achieve non-destructive detection of duck eggs, but it is necessary to manually extract duck egg image features. A classification model for cracks on the surface of duck eggs is established using a machine learning algorithm, or a convolutional neural network is used to automatically extract duck egg image features to achieve automatic classification and detection of duck egg images. However, both require a large number of duck egg images as data support to achieve better detection results. Models established using machine learning algorithms or deep learning algorithms are at risk of too low detection accuracy when there is a lack of sufficient sample data, and the acquisition of duck egg sample data is a time-consuming and labor-intensive process; and the current method of establishing sample data for duck egg image acquisition often does not distinguish between duck egg colors, and the acquisition method is performed at 120°, 240° and 360° around the equator of the duck egg, which has blind spots for crack acquisition and a risk of being unable to effectively acquire some microcracks, which may prevent the crack detection system from obtaining image information of certain types of cracks, thereby reducing the accuracy of the overall crack detection system; therefore, the existing duck egg crack detection technology has blind spots in the acquired images, does not distinguish between duck egg colors for model training, and cannot ensure that the duck eggs are non-destructive during the detection process, while establishing a deep learning model for duck egg crack detection when there is less sample data. Summary of the invention

[0004] The present invention aims to solve at least one of the technical problems in the prior art to a certain extent, by classifying duck eggs by their shell colors, collecting duck egg surface images, and constructing a duck egg image sample set; improving the prototype network, constructing a neural network for detecting surface cracks in duck eggs, and performing model training to obtain a duck egg crack detection model; using the duck egg crack detection model to detect surface cracks in duck eggs; in order to solve the problems of existing duck egg crack detection technology, such as blind spots in collected images, inability to distinguish duck egg colors during model training, and inability to ensure that duck eggs are non-destructive during the detection process, and at the same time, establishing a deep learning model for duck egg crack detection when there is less sample data.

[0005] To achieve the above objectives, in a first aspect, the present application provides a method for detecting cracks on the surface of duck eggs based on image analysis, comprising the following steps: Obtain a certain number of duck eggs, classify them according to the color of their shells, and perform collision simulation to generate cracks; Collect duck egg surface images, classify them, and build a duck egg image sample set; The prototype network was improved to construct a neural network for detecting cracks on the surface of duck eggs, which was marked as the original crack detection model. The original crack detection model is trained based on the duck egg image sample set, and the duck egg crack detection model is obtained after completion; Multiple images of the duck eggs to be inspected are collected, and the duck egg crack detection model is used to detect cracks on the duck egg surface.

[0006] Furthermore, obtaining a certain number of duck eggs, classifying them according to the shell colors, and performing collision simulation to generate cracks includes the following sub-steps: Get Q0 duck eggs, and divide them into white-skinned duck eggs and green-skinned duck eggs according to the surface color of the duck egg shell. The number of white-skinned duck eggs is Q1, and the number of green-skinned duck eggs is Q2, ensuring that the number of white-skinned duck eggs Q1 = the number of green-skinned duck eggs Q2; Divide Q1 white-skin duck eggs into three equal parts, and mark them as white-skin group 1, white-skin group 2, and white-skin group 3; divide Q2 white-skin duck eggs into three equal parts, and mark them as green-skin group 1, green-skin group 2, and green-skin group 3; Put the white skin group 2 and the green skin group 2 into two box-shaped containers respectively, marked as simulation group 2; put the white skin group 3 and the green skin group 3 into two box-shaped containers respectively, marked as simulation group 3; shake simulation group 2 to make cracks appear in the box-shaped container, and the shaking duration is t1; shake simulation group 3 to make cracks appear in the box-shaped container, and the shaking duration is t2, t2>t1; The duck eggs from simulation groups 2 and 3 were collected again, and the duck eggs from white skin group and green skin group were added. Then, according to the surface color of the duck eggs, the presence or absence of surface cracks, and the degree of visibility of surface cracks, all the duck eggs were divided into: white skin intact group, white skin slight group, white skin obvious group, green skin intact group, green skin slight group, and green skin obvious group.

[0007] Furthermore, collecting duck egg surface images and performing image classification to construct a duck egg image sample set includes the following sub-steps: The duck eggs of the white skin intact group, white skin slight group, white skin obvious group, green skin intact group, green skin slight group and green skin obvious group were placed with the long axis of the duck egg parallel to the lens of the image acquisition device to ensure that the duck egg was located in the lens as a whole, and the first image was acquired. The rotation angle of the duck egg at this time was recorded as the initial angle of 0°. The duck egg and the image acquisition device were kept stationary, and the duck egg was rotated 90° clockwise with the long axis of the duck egg as the central axis to acquire the second image, and then the duck egg was rotated 90° clockwise with the long axis of the duck egg as the central axis to acquire the third image, and then the duck egg was rotated 90° clockwise with the long axis of the duck egg as the central axis to acquire the fourth image.

[0008] Furthermore, collecting duck egg surface images and performing image classification, and constructing a duck egg image sample set also includes the following sub-steps: The images collected from the duck eggs of the white skin lossless group are marked as the white skin lossless atlas, and the images collected from the green skin lossless group are marked as the green skin lossless atlas; The images collected from the duck eggs of the white skin light group with cracks in the images are marked as the white skin light atlas, and the images collected with or without cracks are summarized into the white skin lossless atlas; the images collected from the duck eggs of the green skin light group with cracks in the images are marked as the green skin light atlas, and the images collected with or without cracks are summarized into the green skin lossless atlas; The images collected from the duck eggs in the obvious white skin group with cracks in the images are marked as the obvious white skin atlas, and the images collected with or without cracks are summarized into the white skin lossless atlas; the images collected from the duck eggs in the obvious green skin group with cracks in the images are marked as the obvious green skin atlas, and the images collected with or without cracks are summarized into the green skin lossless atlas; The white skin lossless atlas, the white skin slight atlas, the white skin obvious atlas, the green skin lossless atlas, the green skin slight atlas and the green skin obvious atlas are marked as the duck egg image sample set.

[0009] Furthermore, the prototype network is improved to construct a neural network for detecting cracks on the surface of duck eggs, which is marked as the original crack detection model and includes the following sub-steps: The prototype network includes: an input layer, a first convolutional layer, a first pooling layer, a second convolutional layer, a second pooling layer, a third convolutional layer, a third pooling layer, a fourth convolutional layer, a fourth pooling layer, and an embedding space; The input layer and the first convolution layer of the prototype network are retained, the first pooling layer is deleted and replaced with the first inverse residual convolution layer, the second convolution layer is deleted and replaced with the second inverse residual convolution layer, the second pooling layer is deleted and replaced with the third inverse residual convolution layer, the third convolution layer is deleted and replaced with the first SE inverse residual convolution layer, the third pooling layer is deleted and replaced with the second SE inverse residual convolution layer, the fourth convolution layer and the fourth pooling layer are deleted and replaced with the third SE inverse residual convolution layer, and the embedding space is retained; the improved prototype network is marked as the original crack detection model; The original crack detection model includes: an input layer, a first convolution layer, a first inverse residual convolution layer, a second inverse residual convolution layer, a third inverse residual convolution layer, a first SE inverse residual convolution layer, a second SE inverse residual convolution layer, a third SE inverse residual convolution layer and an embedding space.

[0010] Furthermore, the original crack detection model is trained using the duck egg image sample set. After completion, the duck egg crack detection model is obtained, which includes the following sub-steps: Set the standard image size to L*W; adjust the size of all images in the duck egg image sample set to L*W and mark them as the standard duck egg sample set; The white skin lossless atlas, slight white skin atlas, obvious white skin atlas, green skin lossless atlas, slight green skin atlas and obvious green skin atlas in the standard duck egg sample set are divided into a training duck egg sample set and a test duck egg sample set in a ratio of 9:1 respectively, and the number of images in the training duck egg sample set is greater than the number of images in the test duck egg sample set.

[0011] Furthermore, the original crack detection model is trained using the duck egg image sample set. After completion, the duck egg crack detection model further includes the following sub-steps: The training learning rate of the original crack detection model is set to X1, and the number of training iterations is set to X2 times; two types of atlases are randomly selected from the white skin lossless atlas, the white skin slight atlas, the white skin obvious atlas, the green skin lossless atlas, the green skin slight atlas, and the green skin obvious atlas of the training duck egg sample set, and Y1 photos are selected from each type of atlas, and the original crack detection model is input to map into two prototypes of the embedding space of the original crack detection model. Based on these two types of atlases, Y2 photos are selected from each type of atlas, and the original crack detection model is input to complete the recognition processing of Y2 photos, and then the loss value is calculated based on the loss function, and the model parameters of the original crack detection model are optimized using the Adam optimizer; the original crack detection model is repeatedly trained, and the original crack detection model that has completed the training is marked as the initial crack detection model; Set the model qualification threshold to evaluate the initial crack detection model.

[0012] Furthermore, setting the model qualification threshold and evaluating the initial crack detection model includes the following sub-steps: The qualified threshold of the model is set to P0. The white skin lossless atlas, slight white skin atlas, obvious white skin atlas, green skin lossless atlas, slight green skin atlas and obvious green skin atlas of the test duck egg sample set are used to randomly select Y3 photos from each type of atlas, input the initial crack detection model, and calculate the recognition accuracy of the initial crack detection model in each type of atlas, marked as p1, p2, p3, p4, p5 and p6; determine whether any one of p1, p2, p3, p4, p5 and p6 is not less than P0. If so, the initial crack detection model is determined to be qualified and the initial crack detection model is marked as the duck egg crack detection model; if not, the training duck egg sample set is used to train the initial crack detection model again until the initial crack detection model is qualified to obtain the duck egg crack detection model.

[0013] Furthermore, collecting multiple images of the duck eggs to be inspected, and using the duck egg crack detection model to detect cracks on the duck egg surface includes the following sub-steps: The duck egg to be inspected is placed with the long axis of the duck egg parallel to the lens of the image acquisition device to ensure that the duck egg is located in the lens as a whole, the first image is collected, and the duck egg crack detection model is input for detection. If cracks are detected, it is output that the duck egg has slight or obvious cracks, and the image acquisition is terminated; If no crack is detected, the rotation angle of the duck egg at this time is recorded as the initial angle of 0°, the duck egg and the image acquisition device are kept still, and the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis, and the second image is collected and input into the duck egg crack detection model for detection. If a crack is detected, the output is that the duck egg has a slight or obvious crack, and the image acquisition is ended; If no cracks are detected, the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis, and the third image is collected and input into the duck egg crack detection model for detection. If cracks are detected, the output is that the duck egg has slight or obvious cracks, and the image acquisition ends; If no cracks are detected, the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis, and the fourth image is collected; and the duck egg crack detection model is input for detection. If cracks are detected, it is output that the duck egg has slight or obvious cracks and the image collection is terminated; if no cracks are detected, it is output that the duck egg has no cracks.

[0014] In a second aspect, the present application provides a duck egg surface crack detection system based on image analysis, including a crack simulation module, an image acquisition module, a model generation module, a model training module and a duck egg detection module; The crack simulation module is used to obtain a certain number of duck eggs, classify them according to the color of the duck egg shells, and perform collision simulation to generate cracks; The image acquisition module includes an acquisition unit and a classification unit. The acquisition unit is used to acquire duck egg surface images. The classification unit is used to classify the duck egg surface images and construct a duck egg image sample set. The model generation module is used to improve the prototype network and construct a neural network for detecting cracks on the surface of duck eggs, which is marked as the original crack detection model; The model training module performs model training on the original crack detection model based on the duck egg image sample set, and obtains the duck egg crack detection model after completion; The duck egg detection module collects multiple images of the duck eggs to be detected based on the acquisition unit, and uses the duck egg crack detection model to detect cracks on the duck egg surface.

[0015] In a third aspect, the present application provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-readable instructions, and when the computer-readable instructions are executed by the processor, the steps in the above method are performed.

[0016] In a fourth aspect, the present application provides a storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps in the above method are performed.

[0017] The beneficial effects of the present invention are as follows: the present invention obtains a certain number of duck eggs, classifies them according to the color of the duck egg shells, and performs collision simulation to generate cracks; collects duck egg surface images, performs image classification, and constructs a duck egg image sample set; improves the prototype network, constructs a neural network for detecting duck egg surface cracks, and marks it as an original crack detection model; performs model training on the original crack detection model based on the duck egg image sample set, and obtains a duck egg crack detection model after completion; collects multiple images of the duck eggs to be detected, and uses the duck egg crack detection model to detect duck egg surface cracks; while ensuring that the duck eggs are non-destructive during the detection process, a deep learning model for duck egg crack detection can be established when the sample data is small, and the duck egg colors can be distinguished during the model training process, and there is no blind spot area during the image acquisition process, thereby ensuring the accuracy of model detection; The present invention distinguishes the color of duck eggs when establishing a sample atlas for model training, because duck eggs of different colors have different surface textures and light reflection characteristics, and the crack morphology and color shown in the image will also have slight differences. Therefore, by distinguishing the color of duck eggs and then training the model, the model can identify cracks more accurately and ensure the accuracy of crack identification; by uniformly collecting four pictures based on the long axis rotation of the duck eggs, it can be ensured that there are no blind spots in the image collection process, which greatly reduces the situation of duck egg missed detection and improves the accuracy of duck egg crack identification; based on the prototype network, the duck egg crack recognition model is improved and established, which can ensure the recognition accuracy of the trained model when the image samples are small, improve the efficiency of model training, and reduce the acquisition cost of image samples. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 is a functional block diagram of the system of the present invention; Figure 2 is a flow chart of the steps of the method of the present invention; Figure 3 It is a schematic diagram of duck egg surface image acquisition of the present invention; Figure 4 This is a structural diagram of the original crack detection model of the present invention; Figure 5 It is a schematic structural diagram of the electronic device of the present invention. DETAILED DESCRIPTION

[0019] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0020] Example 1, please refer to Figure 1 As shown, the present application provides a duck egg surface crack detection system based on image analysis, including a crack simulation module, an image acquisition module, a model generation module, a model training module and a duck egg detection module; The crack simulation module is used to obtain a certain number of duck eggs, classify them according to the color of their shells, and perform collision simulation to generate cracks; The crack simulation module is configured with a crack simulation strategy, which includes: obtaining Q0 duck eggs, dividing them into white-skin duck eggs and green-skin duck eggs according to the surface color of the duck egg shell, the number of white-skin duck eggs is Q1, the number of green-skin duck eggs is Q2, and ensuring that the number of white-skin duck eggs Q1 = the number of green-skin duck eggs Q2, in order to balance the samples and improve the generalization ability of the subsequent model; in this embodiment, Q1 is 90 eggs and Q2 is 90 eggs; Q1 white-skin duck eggs are divided into three equal parts, which are marked as white-skin group one, white-skin group two and white-skin group three respectively; for example, in this embodiment, there are 90 white-skin duck eggs in total, and the white-skin group one, the white-skin group two and the white-skin group three are each 30 eggs; Q2 white-skin duck eggs are divided into three equal parts, which are marked as green-skin group one, green-skin group two and green-skin group three respectively; in this embodiment, there are 90 green-skin duck eggs in total, and the green-skin group one, the green-skin group two and the green-skin group three are each 30 eggs; Put the white skin group 2 and the green skin group 2 into two box-shaped containers respectively, marked as simulation group 2; put the white skin group 3 and the green skin group 3 into two box-shaped containers respectively, marked as simulation group 3; shake simulation group 2 to make cracks appear in the box-shaped container, in order to simulate the cracks caused by collision of duck eggs in daily environment; shake the duration of t1, in this embodiment, t1=3 seconds; shake simulation group 3 to make cracks appear in the box-shaped container, the shaking duration is t2, in this embodiment, t1=5 seconds; t2>t1, in order to make the duck eggs of simulation group 2 and simulation group 3 have different degrees of cracks; Duck eggs from simulation group 2 and simulation group 3 were collected again, and duck eggs from white skin group and green skin group were added, and then all duck eggs were divided into white skin intact group, white skin slight group, white skin obvious group, green skin intact group, green skin slight group and green skin obvious group according to the surface color of the duck eggs, the presence or absence of surface cracks and the degree of surface cracks: white skin intact group, white skin slight group, white skin obvious group, green skin intact group, green skin slight group and green skin obvious group; in this embodiment, slight cracks refer to cracks that can be clearly seen with the help of external light sources, and obvious cracks refer to cracks that can be clearly seen under natural light sources without the help of external light sources; for example, a green skin duck egg with obvious cracks on the surface is divided into the green skin obvious group; a white skin duck egg with no cracks on the surface is divided into the white skin intact group; In the specific implementation process, the colors of duck eggs are mainly divided into cyan and white. The color of duck eggs is related to the duck breed, duck age and dietary factors. Even ducks of the same breed may have different colors of duck eggs due to the duck age and dietary factors. Duck eggs of different colors have different light reflection characteristics. For example, the surface of white duck eggs may reflect light more strongly, making the light and shadow changes at the cracks relatively more obvious. The cyan duck eggs are darker in color, so the light and shadow performance of their cracks in the image may be blurred. Therefore, the colors are distinguished in order to improve the robustness and generalization of the model in subsequent model training.

[0021] The image acquisition module includes an acquisition unit and a classification unit. The acquisition unit is used to acquire duck egg surface images. The classification unit is used to classify duck egg surface images and construct a duck egg image sample set. The collection unit is configured with a collection strategy, which includes: collecting duck eggs from the white skin intact group, the white skin slight group, the white skin obvious group, the green skin intact group, the green skin slight group, and the green skin obvious group. Figure 3As shown, the long axis of the duck egg is placed parallel to the lens of the image acquisition device to ensure that the duck egg is located in the lens as a whole, and the first image is acquired, and the rotation angle of the duck egg at this time is recorded as the initial angle of 0°, the duck egg and the image acquisition device are kept stationary, and the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis. Both clockwise and counterclockwise rotation are possible, as long as the same duck egg does not change the rotation direction during the acquisition process. In this embodiment, it is rotated clockwise, and the rotation angle of the duck egg is 90° at this time. The second image is acquired, and the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis. At this time, the rotation angle of the duck egg is 180°. The third image is acquired, and the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis. At this time, the rotation angle of the duck egg is 270°, and the fourth image is acquired; The classification unit is configured with a classification strategy, which includes: marking the images collected from the duck eggs of the white skin lossless group as the white skin lossless atlas, and marking the images collected from the green skin lossless group as the green skin lossless atlas; The images collected from the duck eggs of the white skin light group with cracks in the images are marked as the white skin light atlas, and the images collected with or without cracks are summarized into the white skin lossless atlas; the images collected from the duck eggs of the green skin light group with cracks in the images are marked as the green skin light atlas, and the images collected with or without cracks are summarized into the green skin lossless atlas; for example, if a duck egg of the white skin light group has no cracks in the photos taken at 0° and 360°, then these two photos are summarized into the white skin lossless atlas, and there are slight cracks in the photos taken at 90° and 180°, then these two photos are summarized into the white skin slight atlas; The images collected from the duck eggs in the obvious white skin group with cracks are marked as the obvious white skin atlas, and the images collected with or without cracks are summarized into the white skin lossless atlas; the images collected from the duck eggs in the obvious green skin group with cracks are marked as the obvious green skin atlas, and the images collected with or without cracks are summarized into the green skin lossless atlas; for example, if a duck egg in the obvious green skin group has no cracks in the photos taken at 0° and 90°, then these two photos are summarized into the green skin lossless atlas, and there are obvious cracks in the photos taken at 180° and 270°, then these two photos are summarized into the obvious green skin atlas; Mark the white skin lossless atlas, the white skin slight atlas, the white skin obvious atlas, the green skin lossless atlas, the green skin slight atlas and the green skin obvious atlas as the duck egg image sample set; During the specific implementation process, because the image acquisition method at 120°, 240° and 360° around the egg's equator has blind spots, there is a risk of failing to capture slight cracks in the duck eggs, which may prevent the subsequent model from obtaining image information of such cracks, reducing the accuracy and precision of the model. Collecting four pictures at 0°, 90°, 180° and 270° around the egg's equator can greatly reduce the blind spots and effectively reduce the risk of failing to capture slight cracks in the duck eggs. The reason for not collecting more photos is to ensure the efficiency of image acquisition and subsequent model recognition.

[0022] The model generation module is used to improve the prototype network and construct a neural network for detecting cracks on the surface of duck eggs, which is marked as the original crack detection model; The model generation module is configured with a model generation strategy, which includes: the prototype network includes: input layer, first convolution layer, first pooling layer, second convolution layer, second pooling layer, third convolution layer, third pooling layer, fourth convolution layer, fourth pooling layer and embedding space; the convolutional neural network part of the prototype network has only 4 layers, and its ability to extract features of duck egg crack images is slightly insufficient; The input layer and the first convolution layer of the prototype network are retained, the first pooling layer is deleted and replaced with the first inverse residual convolution layer, the second convolution layer is deleted and replaced with the second inverse residual convolution layer, the second pooling layer is deleted and replaced with the third inverse residual convolution layer, the third convolution layer is deleted and replaced with the first SE inverse residual convolution layer, the third pooling layer is deleted and replaced with the second SE inverse residual convolution layer, the fourth convolution layer and the fourth pooling layer are deleted and replaced with the third SE inverse residual convolution layer, and the embedding space is retained; the improved prototype network is marked as the original crack detection model; because the deeper the number of layers or the wider the width of the convolutional neural network, the feature extraction ability will be significantly improved, so the prototype network is improved to build a 7-layer convolutional neural network, which contains inverse residual convolution and attention mechanism inverse residual convolution. Compared with the convolution part of the prototype network, the depth of the network is increased and the robustness of the network is enhanced; See also Figure 4 As shown, the original crack detection model includes: an input layer, a first convolution layer, a first inverse residual convolution layer, a second inverse residual convolution layer, a third inverse residual convolution layer, a first SE inverse residual convolution layer, a second SE inverse residual convolution layer, a third SE inverse residual convolution layer and an embedding space; In the specific implementation process, the prototype network is a deep learning model for few-shot learning; few-shot learning mainly solves the problem of enabling the model to quickly learn and classify new samples when there are only a small number of training samples; the prototype network classifies samples by calculating the distance between them and the prototypes of each category; in simple terms, it will find a prototype for each category during the learning process, and then judge which category the new samples belong to based on the degree of proximity between the new samples and these prototypes.

[0023] The model training module trains the original crack detection model based on the duck egg image sample set, and obtains the duck egg crack detection model after completion; The model training module is configured with a model training strategy, which includes: setting the standard image size to L*W; in this embodiment, the standard image size is 256*256; adjusting the size of all images in the duck egg image sample set to L*W, and marking them as the standard duck egg sample set; The white skin lossless atlas, white skin slight atlas, white skin obvious atlas, green skin lossless atlas, green skin slight atlas and green skin obvious atlas in the standard duck egg sample set are divided into a ratio of 9:1 respectively to obtain a training duck egg sample set and a test duck egg sample set. The number of images in the training duck egg sample set is greater than the number of images in the test duck egg sample set. The division is only to divide the number of images without changing the image classification groups. The training duck egg sample set and the test duck egg sample set both contain white skin lossless atlas, white skin slight atlas, white skin obvious atlas, green skin lossless atlas, green skin slight atlas and green skin obvious atlas, but the number of images of the classification groups included is different. For example, the number of white skin lossless atlases in the training duck egg sample set is compared with the number of white skin lossless atlases in the test duck egg sample set, which is 9:1. The original crack detection model training learning rate is set to X1, and the number of training iterations is set to X2. In this embodiment, the learning rate X1 is 0.001, and the number of training iterations X2 is 80. Two types of atlases are randomly selected from the white skin lossless atlas, the white skin slight atlas, the white skin obvious atlas, the green skin lossless atlas, the green skin slight atlas, and the green skin obvious atlas of the training duck egg sample set, and Y1 photos are selected from each type of atlas, that is, a total of 2*Y1 photos are selected. In this embodiment, Y1 is 30 photos. The input original crack detection model is mapped into two prototypes of the embedding space of the original crack detection model, representing the original of the two types of atlases selected. For example, the two types of atlases selected are the white skin lossless atlas and the green skin slight atlas, then the two prototypes represent white skin without cracks and green skin with slight cracks, respectively. Based on these two types of atlases, Y2 photos are selected from each type of atlas, that is, a total of 2*Y2 photos are selected. In this embodiment, Y2 is 20. Input the original crack detection model to complete the recognition processing of Y2 photos, then calculate the loss value based on the loss function, and use the Adam optimizer to optimize the model parameters of the original crack detection model; repeatedly train the original crack detection model, and mark the trained original crack detection model as the initial crack detection model; Set the model qualification threshold as P0, where P0 is 90% in this embodiment. Using the white-shell non-damaged image set, white-shell slightly damaged image set, white-shell significantly damaged image set, green-shell non-damaged image set, green-shell slightly damaged image set, and green-shell significantly damaged image set of the test duck egg sample set, randomly select Y3 photos from each type of image set, input them into the initial crack detection model, and calculate the recognition accuracy rate of the initial crack detection model under each type of image set. The recognition accuracy rate = 100% * the number of photos correctly recognized / the total number of photos input into the model; mark them as p1, p2, p3, p4, p5, and p6, corresponding to the recognition accuracy rates of the initial crack detection model in the white-shell non-damaged image set, white-shell slightly damaged image set, white-shell significantly damaged image set, green-shell non-damaged image set, green-shell slightly damaged image set, and green-shell significantly damaged image set respectively; judge whether p1, p2, p3, p4, p5, and p6 satisfy that any one of them is not less than P0. If satisfied, judge that the initial crack detection model is qualified, and mark the initial crack detection model as the duck egg crack detection model; if not satisfied, use the training duck egg sample set to train the initial crack detection model again until the initial crack detection model is qualified to obtain the duck egg crack detection model. For example, the qualification threshold is P0 = 90%. After the first training, the output is p1 = 96.25%, p2 = 89.21%, p3 = 90.24%, p4 = 93.56%, p5 = 95.68%, and p6 = 97.88%. Since p2 = 89.21% < P0, judge that the model is unqualified and retrain. After the second training, the output is p1 = 97.25%, p2 = 90.32%, p3 = 94.03%, p4 = 95.06%, p5 = 96.66%, and p6 = 98.89%. Since all of them are greater than P0, judge that the model is qualified and mark it as the duck egg crack detection model; In the specific implementation process, Adam is an optimization algorithm widely used in the training of neural networks in deep learning; it is an optimization method based on gradient descent, aiming to minimize the loss function by adjusting the parameters of the model; a significant advantage of the Adam optimizer is that it can adaptively adjust the learning rate for each parameter; by estimating the first moment and second moment of the gradient, it can dynamically allocate the learning rate according to the gradient change situation of the parameters; for parameters with frequently large gradient changes, the learning rate will be relatively small to avoid excessive parameter updates; while for parameters with relatively stable gradients, the learning rate can be kept relatively large to accelerate the convergence speed.

[0024] The duck egg detection module acquires multiple images of the duck eggs to be detected based on the acquisition unit, and uses the duck egg crack detection model to detect the surface of the duck eggs; The duck egg detection module is configured with a duck egg detection strategy, which includes: placing the duck egg to be detected with its long axis parallel to the lens of the image acquisition device to ensure that the duck egg is located in the lens as a whole, acquiring the first image, and inputting the duck egg crack detection model for detection. If cracks are detected, outputting that the duck egg has slight or obvious cracks, and ending image acquisition; If no crack is detected, the rotation angle of the duck egg at this time is recorded as the initial angle of 0°, the duck egg and the image acquisition device are kept still, and the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis, and the second image is collected and input into the duck egg crack detection model for detection. If a crack is detected, the output is that the duck egg has a slight or obvious crack, and the image acquisition is ended; If no cracks are detected, the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis, and the third image is collected and input into the duck egg crack detection model for detection. If cracks are detected, the output is that the duck egg has slight or obvious cracks, and the image acquisition ends; If no cracks are detected, the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis to collect the fourth image; and the duck egg crack detection model is input for detection. If cracks are detected, the output is that the duck egg has slight or obvious cracks and the image acquisition is terminated; if no cracks are detected, the output is that the duck egg has no cracks; the reason why the recognition is performed immediately after each image is collected is that once a crack is found, it means that the duck egg is a cracked egg and there is no need to collect more images. This can improve the recognition efficiency and reduce the detection cost; In the specific implementation process, because the model training process divides the sample set into white skin lossless atlas, white skin slight atlas, white skin obvious atlas, green skin lossless atlas, green skin slight atlas and green skin obvious atlas, the trained model can identify whether the crack is a slight crack or an obvious crack, and can be applied according to the actual scenario.

[0025] Example 2, please refer to Figure 2 As shown, the present application provides a method for detecting cracks on the surface of duck eggs based on image analysis, comprising the following steps: Step S1, obtaining a certain number of duck eggs, classifying them according to the color of the duck egg shells, and performing collision simulation to generate cracks; Step S1 includes the following sub-steps: Step S101, obtaining Q0 duck eggs, and dividing them into white-skin duck eggs and green-skin duck eggs according to the surface color of the duck egg shells, the number of white-skin duck eggs is Q1, and the number of green-skin duck eggs is Q2, ensuring that the number of white-skin duck eggs Q1 = the number of green-skin duck eggs Q2; Step S102, divide Q1 white-skin duck eggs into three equal parts, and mark them as white-skin group 1, white-skin group 2, and white-skin group 3 respectively; divide Q2 white-skin duck eggs into three equal parts, and mark them as green-skin group 1, green-skin group 2, and green-skin group 3 respectively; Step S103, putting the white skin group 2 and the green skin group 2 into two box-shaped containers respectively, marked as simulation group 2; putting the white skin group 3 and the green skin group 3 into two box-shaped containers respectively, marked as simulation group 3; shaking the simulation group 2 to make cracks appear in the box-shaped container, and the shaking duration is t1; Step S104, three groups of shaking simulations are performed to cause cracks in the duck eggs in the box-shaped container, and the shaking duration is t2, t2>t1; Step S105, re-collect the duck eggs from simulation group 2 and simulation group 3, and add the duck eggs from white skin group and green skin group, and then divide all the duck eggs into the following groups according to the surface color of the duck eggs, the presence or absence of surface cracks, and the degree of obvious surface cracks: white skin intact group, white skin slight group, white skin obvious group, green skin intact group, green skin slight group, and green skin obvious group.

[0026] Step S2, collecting duck egg surface images, and performing image classification to construct a duck egg image sample set; Step S2 includes the following sub-steps: Step S201, placing the duck eggs of the white skin intact group, the white skin slight group, the white skin obvious group, the green skin intact group, the green skin slight group, and the green skin obvious group with the long axis of the duck eggs parallel to the lens of the image acquisition device to ensure that the duck eggs are located in the lens as a whole, capturing the first image, and recording the rotation angle of the duck eggs at this time as the 0° initial angle; Step S202, keeping the duck egg and the image acquisition device stationary, rotating the duck egg 90° clockwise with the long axis of the duck egg as the central axis, and acquiring a second image; Step S203, rotating the duck egg 90° clockwise with the long axis of the duck egg as the central axis, and capturing a third image; Step S204, rotating the duck egg 90° clockwise with the long axis of the duck egg as the central axis, and capturing a fourth image; Step S205, marking the images collected from the duck eggs of the white skin lossless group as the white skin lossless atlas, and marking the images collected from the green skin lossless group as the green skin lossless atlas; Step S206, the images of duck eggs in the white skin slight group with cracks are marked as white skin slight atlas, and the images of duck eggs with cracks or not are classified into white skin lossless atlas; Step S206, the images of duck eggs in the green skin slight group with cracks are marked as green skin slight atlas, and the images of duck eggs with cracks or not are classified into green skin lossless atlas; Step S207, the images of duck eggs in the obvious white skin group with cracks are marked as obvious white skin atlas, and the images of duck eggs with cracks or not are classified into lossless white skin atlas; Step S208, the images of duck eggs in the obvious green skin group with cracks are marked as obvious green skin atlas, and the images of duck eggs with no cracks are classified into lossless green skin atlas; Step S209, marking the white skin lossless atlas, the white skin slight atlas, the white skin obvious atlas, the green skin lossless atlas, the green skin slight atlas and the green skin obvious atlas as the duck egg image sample set.

[0027] Step S3, improving the prototype network, constructing a neural network for detecting cracks on the surface of duck eggs, and marking it as the original crack detection model; Step S3 includes the following sub-steps: Step S301, the prototype network includes: an input layer, a first convolutional layer, a first pooling layer, a second convolutional layer, a second pooling layer, a third convolutional layer, a third pooling layer, a fourth convolutional layer, a fourth pooling layer and an embedding space; Step S302, retain the input layer and the first convolution layer of the prototype network, delete the first pooling layer and change it to the first inverse residual convolution layer, delete the second convolution layer and change it to the second inverse residual convolution layer, delete the second pooling layer and change it to the third inverse residual convolution layer, delete the third convolution layer and change it to the first SE inverse residual convolution layer, delete the third pooling layer and change it to the second SE inverse residual convolution layer, delete the fourth convolution layer and change the fourth pooling layer to the third SE inverse residual convolution layer, and retain the embedding space; mark the improved prototype network as the original crack detection model; Step S303, the original crack detection model includes: an input layer, a first convolution layer, a first inverse residual convolution layer, a second inverse residual convolution layer, a third inverse residual convolution layer, a first SE inverse residual convolution layer, a second SE inverse residual convolution layer, a third SE inverse residual convolution layer and an embedding space.

[0028] Step S4, training the original crack detection model based on the duck egg image sample set, and obtaining the duck egg crack detection model after completion; Step S4 includes the following sub-steps: Step S401, setting the standard image size to L*W; adjusting the sizes of all images in the duck egg image sample set to L*W, marking them as the standard duck egg sample set; Step S402, dividing the white skin lossless atlas, the white skin slight atlas, the white skin obvious atlas, the green skin lossless atlas, the green skin slight atlas and the green skin obvious atlas in the standard duck egg sample set at a ratio of 9:1, respectively, to obtain a training duck egg sample set and a test duck egg sample set, wherein the number of images in the training duck egg sample set is greater than the number of images in the test duck egg sample set; Step S402, the original crack detection model training learning rate is set to X1, and the number of training iterations is set to X2 times; Step S403, randomly selecting two types of atlases from the white skin lossless atlas, the white skin slight atlas, the white skin obvious atlas, the green skin lossless atlas, the green skin slight atlas and the green skin obvious atlas of the training duck egg sample set, selecting Y1 photos from each type of atlas, inputting the original crack detection model to map into two prototypes of the embedding space of the original crack detection model, and then based on the two types of atlases, each type of atlas selects Y2 photos, inputs the original crack detection model to complete the recognition processing of the Y2 photos, and then calculates the loss value based on the loss function, and uses the Adam optimizer to optimize the model parameters of the original crack detection model; repeatedly training the original crack detection model, and marking the trained original crack detection model as the initial crack detection model; Step S404, setting the model qualification threshold to P0, using the white skin lossless atlas, white skin slight atlas, white skin obvious atlas, green skin lossless atlas, green skin slight atlas and green skin obvious atlas of the test duck egg sample set, randomly selecting Y3 photos from each type of atlas, inputting the initial crack detection model, and calculating the recognition accuracy of the initial crack detection model in each type of atlas, marked as p1, p2, p3, p4, p5 and p6; Step S405, determining whether any one of p1, p2, p3, p4, p5 and p6 is not less than P0, if so, determining that the initial crack detection model is qualified, and marking the initial crack detection model as a duck egg crack detection model; Step S406: If it is not satisfied, the initial crack detection model is trained again using the training duck egg sample set until the initial crack detection model is qualified, thereby obtaining a duck egg crack detection model.

[0029] Step S5, collecting multiple images of the duck eggs to be inspected, and using the duck egg crack detection model to detect cracks on the surface of the duck eggs; Step S5 includes the following sub-steps: Step S501, the duck egg to be inspected is placed with the long axis of the duck egg parallel to the lens of the image acquisition device to ensure that the duck egg is located in the lens as a whole, the first image is acquired, and the duck egg crack detection model is input for detection. If a crack is detected, it is output that the duck egg has a slight or obvious crack, and the image acquisition is terminated; Step S502: if no crack is detected, the rotation angle of the duck egg at this time is recorded as the initial angle of 0°, the duck egg and the image acquisition device are kept stationary, the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis, a second image is acquired, and the image is input into the duck egg crack detection model for detection. If a crack is detected, it is output that the duck egg has a slight or obvious crack, and the image acquisition is terminated; Step S503: if no crack is detected, the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis, a third image is collected, and the duck egg crack detection model is input for detection. If a crack is detected, it is output that the duck egg has a slight or obvious crack, and the image acquisition is terminated. Step S504, if no cracks are detected, rotate the duck egg 90° clockwise with the long axis of the duck egg as the central axis, and collect the fourth image; and input the duck egg crack detection model for detection. If cracks are detected, it is output that the duck egg has slight or obvious cracks, and the image acquisition is terminated; if no cracks are detected, it is output that the duck egg has no cracks.

[0030] Example 3, please refer to Figure 5 As shown, Figure 5 The structural schematic diagram of an electronic device is illustrated, and the electronic device may include: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus. The memory stores computer-readable instructions, and the processor can call the instructions in the memory. When the computer-readable instructions are executed by the processor, the steps in the duck egg surface crack detection method based on image analysis are executed to achieve the following functions: a certain number of duck eggs are obtained, classified according to the color of the duck egg shell, and collision simulation is performed to generate cracks; duck egg surface images are collected, and image classification is performed to construct a duck egg image sample set; the prototype network is improved to construct a neural network for detecting duck egg surface cracks, which is marked as an original crack detection model; the original crack detection model is trained based on the duck egg image sample set, and a duck egg crack detection model is obtained after completion; multiple images of the duck eggs to be detected are collected, and the duck egg surface cracks are detected using the duck egg crack detection model.

[0031] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0032] Embodiment 4, the present application also provides a computer-readable storage medium, the present application provides a storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the duck egg surface crack detection method based on image analysis are executed to achieve the following functions: obtain a certain number of duck eggs, classify them according to the color of the duck egg shells, and perform collision simulation to generate cracks; collect duck egg surface images, perform image classification, and construct a duck egg image sample set; improve the prototype network, construct a neural network for detecting duck egg surface cracks, and mark it as an original crack detection model; perform model training on the original crack detection model based on the duck egg image sample set, and obtain a duck egg crack detection model after completion; collect multiple images of the duck eggs to be detected, and use the duck egg crack detection model to detect duck egg surface cracks.

[0033] Through the description of the above implementation methods, the embodiments of the present invention can be provided as methods, systems or computer program products. Based on such an understanding, the above technical solutions can be essentially or partly contributed to the prior art in the form of software products, which can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and include several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0034] In the embodiments provided in the present application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of systems, modules and units can be electrical, mechanical or other forms.

[0035] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A method for detecting cracks on duck egg surfaces based on image analysis, characterized in that: The steps include: Obtain a certain number of duck eggs, classify them according to the color of their shells, and perform collision simulation to generate cracks; Collect duck egg surface images, classify them, and build a duck egg image sample set; The prototype network was improved to construct a neural network for detecting cracks on the surface of duck eggs, which was marked as the original crack detection model. The original crack detection model is trained based on the duck egg image sample set, and the duck egg crack detection model is obtained after completion; Multiple images of the duck eggs to be inspected are collected, and the duck egg crack detection model is used to detect cracks on the duck egg surface.

2. The method for detecting cracks on duck egg surfaces based on image analysis according to claim 1, characterized in that: Obtaining a certain number of duck eggs, classifying them according to the shell color, and performing collision simulation to generate cracks includes the following sub-steps: Get Q0 duck eggs, and divide them into white-skinned duck eggs and green-skinned duck eggs according to the surface color of the duck egg shell. The number of white-skinned duck eggs is Q1, and the number of green-skinned duck eggs is Q2, ensuring that the number of white-skinned duck eggs Q1 = the number of green-skinned duck eggs Q2; Divide Q1 white-skin duck eggs into three equal parts, and mark them as white-skin group 1, white-skin group 2, and white-skin group 3; divide Q2 white-skin duck eggs into three equal parts, and mark them as green-skin group 1, green-skin group 2, and green-skin group 3; Put the white skin group 2 and the green skin group 2 into two box-shaped containers respectively, marked as simulation group 2; put the white skin group 3 and the green skin group 3 into two box-shaped containers respectively, marked as simulation group 3; shake simulation group 2 to make cracks appear in the box-shaped container, and the shaking duration is t1; shake simulation group 3 to make cracks appear in the box-shaped container, and the shaking duration is t2, t2>t1; The duck eggs from simulation groups 2 and 3 were collected again, and the duck eggs from white skin group and green skin group were added. Then, according to the surface color of the duck eggs, the presence or absence of surface cracks, and the degree of visibility of surface cracks, all the duck eggs were divided into: white skin intact group, white skin slight group, white skin obvious group, green skin intact group, green skin slight group, and green skin obvious group.

3. The method for detecting cracks on duck egg surface based on image analysis according to claim 2, characterized in that: Collecting duck egg surface images and performing image classification to construct a duck egg image sample set includes the following sub-steps: The duck eggs of the white skin intact group, white skin slight group, white skin obvious group, green skin intact group, green skin slight group and green skin obvious group were placed with the long axis of the duck egg parallel to the lens of the image acquisition device to ensure that the duck egg was located in the lens as a whole, and the first image was acquired. The rotation angle of the duck egg at this time was recorded as the initial angle of 0°. The duck egg and the image acquisition device were kept stationary, and the duck egg was rotated 90° clockwise with the long axis of the duck egg as the central axis to acquire the second image, and then the duck egg was rotated 90° clockwise with the long axis of the duck egg as the central axis to acquire the third image, and then the duck egg was rotated 90° clockwise with the long axis of the duck egg as the central axis to acquire the fourth image.

4. The method for detecting cracks on duck egg surface based on image analysis according to claim 3, characterized in that: Collecting duck egg surface images and performing image classification, and constructing a duck egg image sample set also includes the following sub-steps: The images collected from the duck eggs of the white skin lossless group are marked as the white skin lossless atlas, and the images collected from the green skin lossless group are marked as the green skin lossless atlas; The images collected from the duck eggs of the white skin light group with cracks in the images are marked as the white skin light atlas, and the images collected with or without cracks are summarized into the white skin lossless atlas; the images collected from the duck eggs of the green skin light group with cracks in the images are marked as the green skin light atlas, and the images collected with or without cracks are summarized into the green skin lossless atlas; The images collected from the duck eggs in the obvious white skin group with cracks in the images are marked as the obvious white skin atlas, and the images collected with or without cracks are summarized into the white skin lossless atlas; the images collected from the duck eggs in the obvious green skin group with cracks in the images are marked as the obvious green skin atlas, and the images collected with or without cracks are summarized into the green skin lossless atlas; The white skin lossless atlas, the white skin slight atlas, the white skin obvious atlas, the green skin lossless atlas, the green skin slight atlas and the green skin obvious atlas are marked as the duck egg image sample set.

5. The method for detecting cracks on duck egg surface based on image analysis according to claim 4, characterized in that: The prototype network is improved to construct a neural network for detecting cracks on the surface of duck eggs, which is marked as the original crack detection model. It includes the following sub-steps: The prototype network includes: an input layer, a first convolutional layer, a first pooling layer, a second convolutional layer, a second pooling layer, a third convolutional layer, a third pooling layer, a fourth convolutional layer, a fourth pooling layer, and an embedding space; The input layer and the first convolution layer of the prototype network are retained, the first pooling layer is deleted and replaced with the first inverse residual convolution layer, the second convolution layer is deleted and replaced with the second inverse residual convolution layer, the second pooling layer is deleted and replaced with the third inverse residual convolution layer, the third convolution layer is deleted and replaced with the first SE inverse residual convolution layer, the third pooling layer is deleted and replaced with the second SE inverse residual convolution layer, the fourth convolution layer and the fourth pooling layer are deleted and replaced with the third SE inverse residual convolution layer, and the embedding space is retained; the improved prototype network is marked as the original crack detection model; The original crack detection model includes: an input layer, a first convolution layer, a first inverse residual convolution layer, a second inverse residual convolution layer, a third inverse residual convolution layer, a first SE inverse residual convolution layer, a second SE inverse residual convolution layer, a third SE inverse residual convolution layer and an embedding space.

6. The method for detecting cracks on duck egg surface based on image analysis according to claim 5, characterized in that: The original crack detection model is trained using the duck egg image sample set. After completion, the duck egg crack detection model includes the following sub-steps: Set the standard image size to L*W; adjust the size of all images in the duck egg image sample set to L*W and mark them as the standard duck egg sample set; The white skin lossless atlas, slight white skin atlas, obvious white skin atlas, green skin lossless atlas, slight green skin atlas and obvious green skin atlas in the standard duck egg sample set are divided into a training duck egg sample set and a test duck egg sample set in a ratio of 9:1 respectively, and the number of images in the training duck egg sample set is greater than the number of images in the test duck egg sample set.

7. The method for detecting cracks on duck egg surface based on image analysis according to claim 6, characterized in that: The original crack detection model is trained using the duck egg image sample set. After completion, the duck egg crack detection model also includes the following sub-steps: The training learning rate of the original crack detection model is set to X1, and the number of training iterations is set to X2 times; two types of atlases are randomly selected from the white skin lossless atlas, the white skin slight atlas, the white skin obvious atlas, the green skin lossless atlas, the green skin slight atlas, and the green skin obvious atlas of the training duck egg sample set, and Y1 photos are selected from each type of atlas, and the original crack detection model is input to map into two prototypes of the embedding space of the original crack detection model. Based on these two types of atlases, Y2 photos are selected from each type of atlas, and the original crack detection model is input to complete the recognition processing of Y2 photos, and then the loss value is calculated based on the loss function, and the model parameters of the original crack detection model are optimized using the Adam optimizer; the original crack detection model is repeatedly trained, and the original crack detection model that has completed the training is marked as the initial crack detection model; Set the model qualification threshold to evaluate the initial crack detection model.

8. The method for detecting cracks on duck egg surface based on image analysis according to claim 7, characterized in that: Setting the model qualification threshold and evaluating the initial crack detection model includes the following sub-steps: The qualified threshold of the model is set to P0. The white skin lossless atlas, slight white skin atlas, obvious white skin atlas, green skin lossless atlas, slight green skin atlas and obvious green skin atlas of the test duck egg sample set are used to randomly select Y3 photos from each type of atlas, input the initial crack detection model, and calculate the recognition accuracy of the initial crack detection model in each type of atlas, marked as p1, p2, p3, p4, p5 and p6; determine whether any one of p1, p2, p3, p4, p5 and p6 is not less than P0. If so, the initial crack detection model is determined to be qualified and the initial crack detection model is marked as the duck egg crack detection model; if not, the training duck egg sample set is used to train the initial crack detection model again until the initial crack detection model is qualified to obtain the duck egg crack detection model.

9. The method for detecting cracks on duck egg surface based on image analysis according to claim 8, characterized in that: Collect multiple images of the duck eggs to be inspected, and use the duck egg crack detection model to detect cracks on the duck egg surface, including the following sub-steps: The duck egg to be inspected is placed with the long axis of the duck egg parallel to the lens of the image acquisition device to ensure that the duck egg is located in the lens as a whole, the first image is collected, and the duck egg crack detection model is input for detection. If cracks are detected, it is output that the duck egg has slight or obvious cracks, and the image acquisition is terminated; If no crack is detected, the rotation angle of the duck egg at this time is recorded as the initial angle of 0°, the duck egg and the image acquisition device are kept still, and the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis, and the second image is collected and input into the duck egg crack detection model for detection. If a crack is detected, the output is that the duck egg has a slight or obvious crack, and the image acquisition is ended; If no cracks are detected, the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis, and the third image is collected and input into the duck egg crack detection model for detection. If cracks are detected, the output is that the duck egg has slight or obvious cracks, and the image acquisition ends; If no cracks are detected, the duck egg is rotated 90° clockwise with the long axis of the duck egg as the central axis, and the fourth image is collected; and the duck egg crack detection model is input for detection. If cracks are detected, it is output that the duck egg has slight or obvious cracks and the image collection is terminated; if no cracks are detected, it is output that the duck egg has no cracks.

10. A duck egg surface crack detection system based on image analysis, used to implement the duck egg surface crack detection method based on image analysis according to any one of claims 1 to 9, characterized in that: It includes crack simulation module, image acquisition module, model generation module, model training module and duck egg detection module; The crack simulation module is used to obtain a certain number of duck eggs, classify them according to the color of the duck egg shells, and perform collision simulation to generate cracks; The image acquisition module includes an acquisition unit and a classification unit. The acquisition unit is used to acquire duck egg surface images. The classification unit is used to classify the duck egg surface images and construct a duck egg image sample set. The model generation module is used to improve the prototype network and construct a neural network for detecting cracks on the surface of duck eggs, which is marked as the original crack detection model; The model training module performs model training on the original crack detection model based on the duck egg image sample set, and obtains the duck egg crack detection model after completion; The duck egg detection module collects multiple images of the duck eggs to be detected based on the acquisition unit, and uses the duck egg crack detection model to detect cracks on the duck egg surface.

Citation Information

Patent Citations

  • A nondestructive testing and automatic grading method for poultry egg surface cracks

    CN109685786A

  • Duck egg crack detection device and method based on convolutional neural network and sound spectrum

    CN114544772A

  • Egg crack detection test system

    CN217902456U

  • Egg classification device, egg classification method, and computer program

    JP2020148619A

Cited By

  • Method for automatically extracting surface crack characteristics of breeding duck eggs based on image recognition

    CN120070415A

  • Automatic Extraction Method for Surface Crack Features of Breeding Duck Eggs Based on Image Recognition

    CN120070415B