A hyperspectral detection method and system for low-laying hens

By building a hyperspectral detection system for low-leaving hens, using the object detection segmentation model and superpixel block recognition model, the problems of low efficiency and insufficient accuracy of traditional detection methods are solved, and accurate identification of low-leaving hens is achieved, and the efficiency and economic benefits of breeding management are improved.

CN119832602BActive Publication Date: 2025-06-10ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510316364.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-03-18
Publication Date
2025-06-10
Estimated Expiration
2045-03-18

AI Technical Summary

Technical Problem

The traditional low-leaning hen detection methods are inefficient and insufficient accuracy, and the hyperspectral detection technology has problems such as slow imaging speed, blurred image and noise impact, which is difficult to meet the needs of modern aquaculture industry for efficient identification.

Method used

The hyperspectral detection method and system of low-leaving hens is adopted, and the data acquisition platform is built, and the target detection segmentation model and superpixel block recognition model are used to achieve accurate identification of low-leaning hens. The system includes a data acquisition and processing unit, an image detection unit and a result display unit, which improves management efficiency and accuracy through automated and intelligent means.

Benefits of technology

Accurate identification of low-leaved laying hens has been achieved, the efficiency and accuracy of breeding management has been improved, feed and space waste has been reduced, and the production performance and economic benefits of laying hens have been improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119832602B_ABST
    Figure CN119832602B_ABST
Patent Text Reader

Abstract

The present invention discloses a hyperspectral detection method and system for low-laying hens. The data acquisition and processing unit of the system acquires hyperspectral images of the laying hens in each chicken cage of the chicken farm and performs image processing; the image detection unit is installed with a target detection and segmentation model, a superpixel segmentation algorithm, and a superpixel block recognition model, and detects the processed image according to the superpixel block threshold; the result display unit displays the obtained category detection results of the laying hens. The present invention can identify and classify low-laying hens by setting a proportion threshold according to the proportion of the categories of the superpixel blocks in the comb parts of the laying hens that are recognized as low-laying and high-laying, and can achieve precise identification of individual low-laying hens through an automated low-laying hen data acquisition platform and a deep learning model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to a detection method for laying hens, belonging to the field of poultry breeding industry, and particularly to a hyperspectral detection method and system for low-yield laying hens. Background Art

[0002] With the rapid development of the poultry breeding industry, the scale of laying hen breeding has been continuously expanding. The traditional manual breeding method has been difficult to meet the requirements of modern breeding industry for high efficiency and refined management. In the process of laying hen breeding, accurately identifying low-yield laying hens and reducing feed consumption to optimize the overall production efficiency is the key. However, there are many deficiencies in the traditional detection methods for low-yield laying hens: First, low efficiency of manual management: Manually observing and selecting low-yield laying hens has low efficiency and insufficient accuracy, and cannot meet the requirements of high-efficiency production. Second, stress problem of chickens: When manually selecting, it is usually necessary to touch to estimate the pubic bone distance or stroke the abdomen to observe whether there are eggs, which causes great stress to the chickens. Third, long time for screening through egg production rate: Some breeding enterprises select low-yield laying hens by monitoring the egg production rate of cages, but this method requires continuous monitoring for several days, and can only be specific to the cage where the low-yield laying hens are located, not to the specific low-yield individuals.

[0003] In the prior art, hyperspectral technology has also been used to detect low-yield laying hens, achieving relatively high accuracy. However, the hyperspectral imaging speed is slow. In actual use, the hyperspectral images of the observation targets are often blurred due to the rapid movement of chickens, and the quality does not meet the recognition requirements. Moreover, when unsupervised extraction of the hyperspectral of the chicken crown is carried out, due to the complexity of the actual scene and the influence of noise, etc., in the process of endmember extraction, there are often phenomena such as omission of the main endmembers, inaccurate extraction of endmembers, and being easily affected by noise, and the actual use effect is not good, and the reliability and stability of the model are difficult to guarantee. Summary of the Invention

[0004] In order to solve the problems existing in the background art, the present invention provides a hyperspectral detection method and system for low-yield laying hens. The method and system can achieve accurate identification of low-yield laying hens. Through automation and intelligent technologies, the present invention can improve the efficiency and accuracy of chicken house management, reduce the waste of feed and breeding space caused by low-yield laying hens, and thus improve the production performance and breeding economic benefits of laying hens.

[0005] The technical solution adopted by the present invention is as follows:

[0006] First, a hyperspectral detection method for low-yield laying hens, comprising:

[0007] S1: Build a data acquisition platform for low - laying hens. Through this platform, acquire the hyperspectral images of the hens in each chicken cage of the chicken farm. Generate static JPG (Joint Photographic Experts Group) images based on the hyperspectral images. After pre - processing each JPG static image, construct the first training set.

[0008] S2: Install the target detection and segmentation model in the data acquisition platform for low - laying hens. Input the first training set into the target detection and segmentation model for training to obtain the trained target detection and segmentation model and the mask of each labeled image in the first training set.

[0009] S3: Build a super - pixel block recognition model ImprovedResNet3D containing an improved residual module group in the data acquisition platform for low - laying hens. Process the first training set according to the mask to construct the second training set. After performing the super - pixel segmentation algorithm on the second training set, input it into the super - pixel block recognition model for training to obtain the trained super - pixel block recognition model.

[0010] S4: Through the data acquisition platform for low - laying hens, acquire the hyperspectral images of each hen to be detected and perform the same processing as in step S1 to obtain the static JPG images to be detected. Then, successively process them through the trained target detection and segmentation model, the super - pixel segmentation algorithm, and the trained super - pixel block recognition model. Finally, perform super - pixel block threshold detection to obtain the category detection results of each hen in the hyperspectral image to be detected and display them, realizing the detection of low - laying hens, so as to improve the efficiency and accuracy of chicken coop management through automated and intelligent means.

[0011] In the above - mentioned step S1, the data acquisition platform for low - laying hens includes a mobile chassis, an adjustable bracket, a halogen lamp, a computer, and a hyperspectral camera. The adjustable bracket is vertically installed on the mobile chassis. The halogen lamp, the computer, and the hyperspectral camera are all installed on the adjustable bracket. When shooting, both the halogen lamp and the hyperspectral camera are oriented towards the hens in the chicken cage. The computer and the hyperspectral camera are electrically connected. After the hyperspectral camera shoots the hyperspectral images of the hens, it transmits them to the computer for processing. Both the target detection and segmentation model and the super - pixel block recognition model are installed in the computer. The data acquisition platform for low - laying hens can adapt to the cage positions of chicken cages at different heights, achieving comprehensive data acquisition and ensuring flexibility and adaptability.

[0012] In the above - mentioned step S1, for each hyperspectral image, perform white - board correction on the hyperspectral image to obtain a standard image, and then select three bands of 454nm, 458nm, and 462nm in the standard image to generate a static JPG image.

[0013] In the said step S1, for each static JPG image, during preprocessing, first, the positions of the edges of the combs of each laying hen in the static JPG image are marked to obtain a marked image. Each marked image is processed by Canny edge detection to remove the marked images with motion blur, and the remaining marked images are constructed into a first training set.

[0014] In the said step S3, the superpixel block recognition model is composed of an initial convolutional module, an improved residual module group, a multi-head attention 3D module, and a global average pooling module connected in sequence.

[0015] In the said step S3, the improved residual module group includes several three-dimensional improved residual blocks (ImprovedResidualBlock3D) connected in sequence. The three-dimensional improved residual block includes a backbone network and an attention module CBAM3D (Convolutional Block Attention Module) connected in sequence. The backbone network includes a second three-dimensional convolutional layer, a first batch normalization layer, a first activation function ReLU, a first dropout operation, a third three-dimensional convolutional layer, a second batch normalization layer, and a second dropout operation.

[0016] The mask of the image is mapped to the hyperspectral image, and the comb part in the hyperspectral image is segmented to obtain the hyperspectral image of the comb position. Then, the category of the laying hen is marked on each hyperspectral image of the comb position as a label to obtain a labeled image, and each labeled image is constructed into a second training set; the categories of laying hens include low-yield and normal. Laying hens with a daily egg production lower than a preset threshold are classified as low-yield laying hens, and laying hens with a daily egg production not lower than the preset threshold are classified as normal laying hens.

[0017] In the said step S4, the static JPG image to be detected is first input into the trained object detection and segmentation model for processing. After processing, a mask of the comb part in the static JPG image to be detected is obtained. Then, through Canny edge detection, if the comb part in the current static JPG image is motion blurred, it is removed, and the next static JPG image to be detected is processed continuously. The currently obtained mask is mapped into the hyperspectral image to be detected, and finally, the comb parts of each laying hen in the hyperspectral image to be detected are segmented. Then, the comb parts are segmented into hyperspectral superpixels by the simple linear iterative clustering (SLIC) algorithm and input into the trained superpixel block recognition model for processing, and finally, the category detection results of each laying hen in the hyperspectral image to be detected are displayed.

[0018] In step S4, the static JPG image to be detected is first processed by the trained object detection and segmentation model to segment the chicken comb part. Then, the SLIC superpixel segmentation algorithm is used to segment each pixel block of the chicken comb part. After that, it is processed by the trained superpixel block recognition model to identify the category of each pixel block within the chicken comb part, so as to obtain the number of pixel blocks identified as low-yield categories and normal categories. Then, superpixel block threshold detection is performed to obtain the proportion of the number of pixel blocks identified as low-yield categories in the total number of pixel blocks. When the proportion is higher than the preset proportion threshold, the laying hen to which the current chicken comb belongs is a normal laying hen; otherwise, it is a low-yield laying hen.

[0019] II. A hyperspectral detection system for low-yield laying hens, comprising:

[0020] A data acquisition and processing unit that acquires hyperspectral images of laying hens in each chicken coop of a chicken farm and performs image processing.

[0021] An image detection unit equipped with an object detection and segmentation model, a superpixel segmentation algorithm, and a superpixel block recognition model, which detects the images processed by the data acquisition and processing unit according to the superpixel block threshold.

[0022] A result display unit that displays the category detection results of the laying hens obtained by the image detection unit.

[0023] The beneficial effects of the present invention are as follows:

[0024] 1. The present invention can improve the accuracy and efficiency of breeding management: Through an automated data acquisition platform and deep learning models, accurate identification of low-yield laying hens in the laying hen house is achieved. Compared with traditional manual inspections, the system significantly improves the accuracy and efficiency of breeding management, reduces human errors and labor intensity. Automated monitoring and data analysis reduce the dependence on a large number of human resources, while ensuring the timeliness and accuracy of screening for eliminating low-yield laying hens.

[0025] 2. The present invention can optimize chicken feeding: Through intelligent identification of low-yield laying hens, chickens with low long-term egg production efficiency can be discovered early and eliminated in a timely manner to avoid waste of resources. This helps the chicken farm maintain an efficient laying hen population, thereby improving the overall production efficiency. At the same time, resources can be utilized more effectively, reducing feed waste, space occupation, and environmental pressure caused by low-yield laying hens, and promoting the chicken farm to move towards a more environmentally friendly and sustainable breeding mode.

[0026] 3. The present invention can provide intelligent decision-making support: The system of the present invention is not limited to real-time monitoring and data reporting, but also provides intelligent decision-making support, which can provide real-time monitoring and analysis support for various production data of the breeding farm, and help the breeding personnel dynamically adjust the management strategy. This intelligent decision-making support mechanism makes the breeding management more scientific and flexible, and further improves the breeding efficiency and economic benefits. BRIEF DESCRIPTION OF THE DRAWINGS

[0027] Figure 1 It is a schematic diagram of the low-yield laying hen data acquisition platform of the present invention;

[0028] Figure 2 It is a training result diagram of the target detection and segmentation model Yolov8n-seg of the present invention. Among them, Figure 2 (a) is a curve diagram of the bounding box loss, segmentation loss, classification loss, and depth loss during the training of the training set and the test set, Figure 2 (b) is a curve diagram of the precision, recall, and average precision at different thresholds of the bounding box and the mask;

[0029] Figure 3 It is a training result diagram at the superpixel block level and individual level of the present invention. Among them, Figure 3 (a) is a schematic diagram of the training and test losses at the pixel block level, Figure 3 (b) is a schematic diagram of the training and test accuracies at the pixel block level, Figure 3 (c) is a schematic diagram of the individual recognition accuracies of low-yield laying hens and normal laying hens in the test set;

[0030] Figure 4 It is a distribution diagram of the superpixel distribution and pixel block categories in the chicken comb area of the present invention. Among them, Figure 4 (a) is a chicken comb segmentation diagram, Figure 4 (b) is a superpixel block distribution diagram, Figure 4 (c) is a category distribution diagram of the pixel blocks identified as low-yield (red) and normal chicken pixel blocks (green);

[0031] Figure 5 It is a flow chart of the individual recognition of low-yield laying hens of the present invention;

[0032] In the figure: 1. Mobile chassis, 2. Adjustable bracket, 3. Halogen lamp, 4. Computer, 5. Hyperspectral camera. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0033] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0034] As Figure 5 shown, the hyperspectral detection method for low-yield laying hens of the present invention is specifically as follows:

[0035] First, build a data acquisition platform for low-laying hens, such as Figure 1 As shown, the data acquisition platform for low-laying hens includes a mobile chassis 1, an adjustable bracket 2, a halogen lamp 3, a computer 4, and a hyperspectral camera 5 with a wavelength range of 400 - 1000 nm. The adjustable bracket 2 is vertically installed on the mobile chassis 1. The halogen lamp 3, the computer 4, and the hyperspectral camera 5 are all installed on the adjustable bracket 2. When shooting, both the halogen lamp 3 and the hyperspectral camera 5 are oriented towards the laying hens in the chicken coop. The computer 4 is electrically connected to the hyperspectral camera 5. After the hyperspectral camera 5 captures the hyperspectral images of the laying hens, the images are transmitted to the computer 4 for processing. The object detection and segmentation model and the superpixel block recognition model are both installed in the computer 4. The data acquisition platform for low-laying hens can adapt to the cage positions of laying hen coops at different heights, realizing comprehensive data acquisition and ensuring flexibility and adaptability.

[0036] Then, use the data acquisition platform for low-laying hens to capture the hyperspectral images of the laying hens in each chicken coop of the chicken farm. For each hyperspectral image, after performing whiteboard correction on the hyperspectral image, a standard image is obtained. Then, in the standard image, three bands of 454 nm, 458 nm, and 462 nm are selected through libraries such as OpenCV, Numpy, and osgeo in the PyTorch deep learning framework to generate a static JPG image. The edges of the combs of each laying hen in the static JPG image are position-annotated using the segment annotation method with the image annotation tool labelme to obtain an annotated image. The quality of each annotated image is evaluated using the Canny edge detection algorithm, and the blurred motion annotated images are removed. The remaining annotated images are constructed into a first training set; the annotated images in the training set contain rich features for comb segmentation, providing high-quality training and validation data for the automatic segmentation of the comb part. Specifically, when implementing, 120 low-laying hens and 120 normal chickens are selected and raised normally in the cages, with 4 to 6 chickens in each cage. Randomly select the images of 40 normal chickens and 40 low-laying hens as the first training set, and the images of the remaining 80 normal chickens and 80 low-laying hens as the test set.

[0037] The present invention uses the Canny edge detection algorithm to evaluate the clarity of the image, automatically identify and remove low-quality comb images with motion blur. For each annotated image, first, use the Canny edge detection algorithm to generate an edge feature map to detect all significant edge contours in the image. Then, perform edge density calculation. Set an image region mask to define the detection range, and then calculate the edge density within the mask range in the edge feature map. Edge density = Number of non-zero pixels in the Canny edge map / Number of non-zero pixels in the mask region.

[0038] The edge density represents the edge sharpness of the image within the mask area. Based on experimental analysis, a sharpness threshold is set. If the edge density value is lower than the sharpness threshold, it is determined that the image has motion blur and does not meet the requirements for subsequent processing, so the image is automatically excluded to ensure the quality of the images entering subsequent processing.

[0039] Then, the object detection and segmentation model is installed in the low-laying hen data acquisition platform, and the first training set is input into the object detection and segmentation model for training to obtain the trained object detection and segmentation model and the mask of each labeled image in the first training set; the object detection and segmentation model specifically uses the Yolov8n-seg (You Only Look Once) model. When training the object detection and segmentation model, the PyTorch deep learning framework is selected, the preset number of training epochs is set, and the model weights are updated through forward propagation and backward propagation to optimize the model performance; then the training results of the model are evaluated, including loss evaluation, precision and recall rate analysis, and the drawing of the mean Average Precision (mAP) curve to ensure that the model reaches the expected precision level. As Figure 2 shown in (a) of, for the object detection and segmentation model Yolov8n-seg, the bounding box loss, segmentation loss, classification loss, and depth loss results of the training set and test set all show a downward trend and finally converge to a relatively low level, indicating that the model is continuously learning and optimizing and can better fit the data. As Figure 2 shown in (b) of, for the object detection and segmentation model Yolov8n-seg, the precision, recall rate, mean precision (threshold 0.5), and mean precision (threshold 0.5 - 0.95) of the bounding box and mask all reach a relatively high level, indicating that the model has high accuracy and reliability in object detection and segmentation tasks.

[0040] The object detection and segmentation model Yolov8n-seg of the present invention can perform preliminary prediction on static JPG images to determine the target area in hyperspectral images. By running batch inference on visible light images, the bounding box and segmentation mask area information of the target area can be generated; according to the prediction results of the object detection and segmentation model Yolov8n-seg, a mask is generated using the segmentation mask, and the mask area will cover the target area of the hyperspectral image and is segmented according to the threshold of the pixels, setting the pixel positions below the threshold to zero and retaining the target area above the threshold; the mask is used to screen the hyperspectral image pixel by pixel to retain the spectral information of the target area. According to the predicted bounding box information, the target area of the hyperspectral image is automatically cropped. By setting specific boundary points, including the center, width, and height of the bounding box, the corresponding range in the hyperspectral image to the predicted area is intercepted to retain the multi-band information of each target area. The specific boundary points refer to the specific position parameters determined according to the target area information predicted by the model. Specifically, these boundary points are defined by the center point coordinates, width, and height of the target area and are determined according to the bounding box generated by the object detection and segmentation model Yolov8n-seg. These parameters are used as the criteria for cropping the hyperspectral image during segmentation, so that the area corresponding to the model detection result can be accurately intercepted. According to the predicted bounding box, the abscissa x and ordinate y of its center point are obtained. The center point is a specific starting position of the segmentation area and is used to accurately locate the target area to be cropped. The width w and height h of the bounding box determine the size of the target area, and these dimensions are used to calculate the boundaries of the cropping area, that is, the left and right, upper and lower boundary points, to form a specific cropping range. Combining the center point coordinates, width, and height, the left and right boundaries are determined as x1 = x - w / 2 and x2 = x + w / 2, and the upper and lower boundaries are determined as y1 = y - h / 2 and y2 = y + h / 2, and then the target area is cropped. This method ensures that the cropped hyperspectral image area completely matches the target area predicted by the model and can retain the multi-band information of each pixel, thus supporting fine spectral analysis.

[0041] In the low-laying chicken data collection platform, a superpixel block recognition model ImprovedResNet3D was constructed, which included an initial convolution module, an improved residual module group, a multi-head attention 3D module, and a global average pooling module; the backbone network first used the three-dimensional convolution layer nn.Conv3d to perform the first convolution operation to further refine the feature extraction. Then, batch normalization was performed through nn.BatchNorm3d, nn.ReLU activation, and nn.Dropout3d performed random inactivation according to the set dropout_rate (0.5) to prevent overfitting. Then, nn.Conv3d was used again for the second convolution to further explore the feature information, and then batch normalization and random inactivation were performed again. The attention module CBAM3D consists of two submodules: the channel attention block ChannelAttention3D and the spatial attention block SpatialAttention3D. The channel attention block ChannelAttention3D first obtains the global average and maximum features of the channel dimension through adaptive average pooling AdaptiveAvgPool3d() and adaptive maximum pooling AdaptiveMaxPool3d(), and then processes it through a shared multilayer perceptron MLP (Multilayer Perceptron). The channel attention weight is obtained through the activation function Sigmoid to enhance the expression of important channel features. The spatial attention block SpatialAttention3D first calculates the average and maximum values ​​of the feature map in the channel dimension and generates spatial attention weights to highlight important spatial position features. Finally, the attention module CBAM3D double-weights the channel and spatial attention weights with the input features, so that the network can focus on the key feature areas and improve the discriminability of the features. The various modules of the superpixel block recognition model are combined in a specific order and connection method to work together to perform comprehensive and in-depth feature extraction and accurate classification of hyperspectral data.

[0042] The improved residual module group in the superpixel block recognition model includes several three-dimensional improved residual blocks connected in sequence, the three-dimensional improved residual blocks include a backbone network and an attention module CBAM3D connected in sequence, and the backbone network includes a second three-dimensional convolutional layer, a first batch of normalization layers, a first activation function ReLU, a first random deactivation operation, a third three-dimensional convolutional layer, a second batch of normalization layers and a second random deactivation operation connected in sequence.

[0043] The MultiHeadAttention3D in the superpixel block recognition model consists of a multi-dimensional feature interaction network and a hierarchical fusion mechanism. Its core structure includes a three-dimensional convolutional projection layer, a parallel multi-head attention calculation unit, a dual residual normalization module, and a feed-forward enhancement network. The module first performs channel dimension mapping on the input feature and context feature through three independent three-dimensional convolutional layers respectively to generate a query vector Query, a key vector Key, and a value vector Value. Among them, the query vector is obtained by projecting the current hierarchical feature through a three-dimensional convolutional layer, and the key and value vectors are extracted from the lower-level context feature through a three-dimensional convolutional layer of the same dimension to ensure strict alignment of the spatial dimensions (depth, height, width). The projected features are split and reorganized into num_heads parallel calculation heads through channel splitting. The feature dimension of each head is in_channels / num_heads, where in_channels is the channel dimension number of the input feature tensor. Subsequently, the cross-hierarchical attention weights are calculated through matrix multiplication. Among them, the query vector and the key vector are multiplied after transposition and normalized by the scaling factor head_dim, and then activated by Softmax to generate an attention distribution map. Finally, the weighted sum with the value vector is used to achieve feature fusion. The fused multi-head features are restored to the original channel number through a concatenation operation and channel integration is performed through an output projection convolutional layer. During the process, Dropout3d (dropout probability p = 0.1) is used for random inactivation to enhance the generalization ability. The module adopts a dual residual connection design: the first residual adds the multi-head attention output and the original input feature, and the three-dimensional batch normalization is used to stabilize the gradient distribution; the second residual is executed after the feed-forward network processing. The network consists of two levels of three-dimensional convolutions. The first-level convolution expands the channels to four times and applies ReLU non-linear activation. The second-level convolution restores the original channel dimension. A random inactivation layer is inserted in the middle to prevent overfitting. Finally, the feature calibration is completed through batch normalization. All three-dimensional convolution operations use a 1×1×1 kernel size to keep the spatial dimensions unchanged. During the attention calculation stage, the tensor shape transformation is achieved through the view and transpose operations of dimension exchange. By integrating the results of multiple attention heads, the diversity of data is captured from different angles, enhancing the model's understanding and generalization ability for complex tasks.

[0044] After the construction of the superpixel block recognition model, for each labeled image in the first training set, the mask of the labeled image is mapped to the hyperspectral image, and the comb part in the hyperspectral image is segmented to obtain the hyperspectral image of the comb position. Then, the category of the laying hen is marked on each hyperspectral image of the comb position as a label to obtain the label image, and each label image is constructed into the second training set; the categories of laying hens include low-yield and normal. Laying hens with a daily egg production lower than the preset threshold are classified as low-yield laying hens, and laying hens with a daily egg production not lower than the preset threshold are classified as normal laying hens. Then, the second training set is processed by the superpixel segmentation algorithm and input into the superpixel block recognition model for training to obtain the trained superpixel block recognition model.

[0045] During actual detection, first, the hyperspectral images of each laying hen to be detected are obtained through the low-yield laying hen data acquisition platform and preprocessed to obtain the static JPG images to be detected. Then, they are processed sequentially through the trained object detection and segmentation model, the superpixel segmentation algorithm, and the trained superpixel block recognition model. The static JPG images to be detected are first input into the trained object detection and segmentation model for processing. After processing, the comb part and its mask area in the static JPG images to be detected are obtained. Then, through Canny edge detection, if the comb part in the current static JPG image is motion blurred, it is excluded, and the next static JPG image to be detected is continued to be processed. The currently obtained mask area is mapped to the hyperspectral image to be detected, and finally, the comb parts of each laying hen in the hyperspectral image to be detected are segmented. Then, the comb part is subjected to hyperspectral superpixel segmentation by the Simple Linear Iterative Clustering (SLIC) algorithm and input into the trained superpixel block recognition model for processing, and finally, the category detection results of each laying hen in the hyperspectral image to be detected are displayed.

[0046] The simple linear iterative clustering (SLIC) algorithm is used to perform superpixel segmentation on the image. It is a segmentation method based on similarity clustering. It aggregates adjacent pixels according to spectral features and spatial distances to generate superpixel blocks with regular shapes and spatial continuity. By setting segmentation parameters such as the number of segments (n_segments) and compactness, the module generates a specific number of superpixel blocks, and each superpixel block represents a region in the image. Screening of invalid pixel blocks: After superpixel segmentation, the module screens the spectral data of each pixel block to ensure that the extracted pixel blocks do not contain invalid pixel values (such as pixels with a reflectivity of zero). Pixel blocks containing invalid values will be excluded to ensure the reliability of the data used for subsequent classification. Spectral feature extraction: For each valid pixel block, the average value of its spectral reflectance is calculated to generate the spectral features of the pixel block. These features are stored in the form of the mean value in the spectral dimension and can characterize the reflection characteristics of the pixel block in each band, facilitating subsequent classification processing. Feature data storage: The module stores the average spectral features of all valid pixel blocks as a feature vector array for input to the network. Superpixel segmentation reduces the number of processing units, improves data processing efficiency, and at the same time ensures the subsequent classification accuracy by extracting effective spectral features.

[0047] Finally, the classification detection results of each laying hen in the hyperspectral image to be detected are output and displayed after processing. The static JPG image to be detected is first processed by the trained object detection and segmentation model to segment the comb part, as Figure 4 shown in (a) of [Figure number]. Then, the superpixel segmentation algorithm SLIC is used to segment each pixel block in the comb part, and then it is processed by the trained superpixel block recognition model to identify the category of each pixel block in the comb part, as Figure 4 shown in (b) of [Figure number]. Thus, the number of pixel blocks identified as the low-yield category (marked in red) and the normal category (marked in green) is obtained, and then superpixel block threshold detection is performed, as Figure 4 shown in (c) of [Figure number]. The proportion of the number of pixel blocks identified as the low-yield category in the total number of pixel blocks is obtained. When the proportion is higher than the preset proportion threshold, the laying hen to which the current comb belongs is a normal laying hen; otherwise, it is a low-yield laying hen, realizing the detection of low-yield laying hens to improve the efficiency and accuracy of chicken coop management through automated and intelligent means.

[0048] After the superpixel block recognition model ImprovedResNet3D of the present invention is trained, it is also necessary to evaluate the model training results, including loss evaluation, precision and recall analysis, to ensure that the model reaches the expected precision level, as shown in Table 1.

[0049] Table 1

[0050]

[0051] The classification results of the superpixel blocks are comprehensively calculated into prediction labels at the file level. By counting the classification results of the pixel blocks in each file, file-level labels are generated, and a classification report is output. The specific steps are as follows:

[0052] Statistics of pixel block prediction results: After completing the classification of pixel blocks in each file, the module counts the number of pixel blocks belonging to different classes according to the output of the classification model. For example, count the number of pixel blocks in class 0 (low-laying hen class) and class 1 (normal chicken class).

[0053] Calculation of class ratio: According to the counted number of pixel blocks, calculate the ratio of pixel blocks of the target class (class 1) in the file. For example, for each file, calculate the ratio of class 1 pixel blocks to the total number of pixel blocks, which is used for file-level label inference.

[0054] Classification of low-laying hens based on a threshold: Based on the target class ratio, set a threshold to judge the final class label of the file. If the target class ratio exceeds the set threshold, the file is judged as class 1, otherwise as class 0. This method ensures that the individual-level label can accurately reflect the main class information within the target object, making the classification results of hyperspectral images more practical. Especially in scene-level classification tasks, it improves the reliability and applicability of prediction, providing a convenient and accurate classification scheme for large-scale hyperspectral image analysis. The individual recognition results of low-laying hens and normal chickens are shown in Table 2.

[0055] Table 2

[0056]

[0057] As Figure 3 shown in (a) of Figure 3 shown in (b) of Figure 3 shown in (c) of, the training and test losses at the pixel block level, the training and test accuracies at the pixel block level, and the individual recognition accuracies of low-laying hens and normal chickens in the test set are presented. It can be found that the training and test losses at the pixel block level are initially high and both decrease significantly as training progresses, and they are relatively close in the later stage, indicating that the model effectively learns during training without overfitting. The training and test accuracies at the pixel block level both show an upward trend and tend to be stable in the later stage. The test accuracy is slightly lower than the training accuracy, indicating that the model has accurate recognition and good generalization ability. The individual recognition accuracies of low-laying hens and normal chickens in the test set increase rapidly as the pixel block-level recognition accuracy improves, indicating that the proposed low-laying hen recognition method has stable and reliable prediction ability for individual samples.

[0058] When the method of the present invention is applied in a scenario, first, the trained model is deployed to the inspection system in the laying hen house to achieve automatic identification of low-producing laying hens, quickly analyze and identify low-producing laying hens, and then generate a data analysis report. At the same time, a user interface interaction is provided. The system generates a data analysis report on low-producing laying hens, including key indicators such as the number of low-producing laying hens and their distribution, and provides a friendly interaction function through the user interface. The breeding management personnel can query and view the number, distribution, and their change trends of low-producing laying hens through the interface, and timely understand the production performance of the laying hen population. It is necessary to ensure that the low-producing laying hen identification system has good performance stability and environmental adaptability and can operate reliably in different breeding environments. The system has compatibility and scalability, can adapt to a variety of data collection devices, and supports a variety of data interfaces to meet the needs of different-scale farms. The system also reserves an extended function interface to facilitate the subsequent introduction of new data sources and identification methods into the identification model to further improve the identification accuracy. The present invention realizes an efficient and accurate method for identifying low-producing laying hens, which helps to improve the breeding management efficiency, reduce costs, and promote the sustainable development of the breeding industry.

[0059] The present invention also designs a hyperspectral detection system for low-producing laying hens, including a data acquisition and processing unit, an image detection unit, and a result display unit. The data acquisition and processing unit acquires the hyperspectral images of the laying hens in each chicken cage of the chicken farm and performs image processing. The image detection unit is equipped with a target detection and segmentation model, a superpixel segmentation algorithm, and a superpixel block recognition model, and detects the images processed by the data acquisition and processing unit according to the superpixel block threshold. The result display unit displays the category detection results of the laying hens obtained by the image detection unit.

[0060] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a system, or a computer program product. Therefore, the present application can be in the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the present application can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, optical storage, etc.) containing computer-usable program code. The solutions in the embodiments of the present application can be implemented in various computer languages. The present application is described according to the flowcharts of the methods, systems, and computer program products of the embodiments of the present application.

[0061] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they know the basic creative concepts. Therefore, the present invention is intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0062] Obviously, those skilled in the art can make various changes and modifications to this application without departing from the spirit and scope of this application. Thus, if these modifications and variations of this application fall within the scope of the equivalent technology of the present invention, this application also intends to include these changes and modifications therein.

Claims

1. A high-spectral detection method for low-laying hens, characterized in that: include: S1: Build a data collection platform for low-laying chickens, collect hyperspectral images of laying hens in each cage in the chicken farm through the data collection platform for low-laying chickens, generate static images based on the hyperspectral images, and construct the first training set after preprocessing each static image; S2: installing the target detection segmentation model in the low-laying chicken data collection platform, inputting the first training set into the target detection segmentation model for training, and obtaining the trained target detection segmentation model and mask; S3: constructing a superpixel block recognition model including an improved residual module group in the low-laying chicken data collection platform, constructing a second training set after processing the first training set according to the mask, processing the second training set with a superpixel segmentation algorithm, and inputting the second training set into the superpixel block recognition model for training to obtain a trained superpixel block recognition model; S4: Obtain the hyperspectral image of each laying hen to be detected through the low-laying hen data acquisition platform and perform the same processing as in step S1 to obtain a static image to be detected, and then process it in turn through the trained target detection segmentation model, superpixel segmentation algorithm and trained superpixel block recognition model, and finally perform superpixel block threshold detection to obtain the category detection result of each laying hen and display it on the display, so as to realize the detection of low-laying hens; In the step S3, the superpixel block recognition model is composed of an initial convolution module, an improved residual module group, a multi-head attention 3D module and a global average pooling module connected in sequence; In the step S3, the improved residual module group includes a plurality of sequentially connected three-dimensional improved residual blocks, the three-dimensional improved residual blocks include a sequentially connected backbone network and an attention module CBAM3D, the backbone network includes a sequentially connected second three-dimensional convolutional layer, a first batch of normalization layers, a first activation function ReLU, a first random deactivation operation, a third three-dimensional convolutional layer, a second batch of normalization layers, and a second random deactivation operation; In the step S4, the static image to be detected is first processed by the trained target detection segmentation model to segment the comb part, and then the various pixel blocks of the comb part are segmented by the superpixel segmentation algorithm SLIC, and then processed by the trained superpixel block recognition model to identify the category of each pixel block in the comb part, thereby obtaining the number of pixel blocks identified as low-yield categories and normal categories, and then performing superpixel block threshold detection to obtain the ratio of the number of pixel blocks identified as low-yield categories to the total number of pixel blocks. When the number ratio is higher than the preset ratio threshold, the laying hen to which the current comb belongs is a normal laying hen, otherwise it is a low-yielding laying hen.

2. The method for detecting low laying hens by high-spectrum spectrum according to claim 1, characterized in that: In the step S1, the low-production laying hen data collection platform comprises a mobile chassis (1), an adjustable bracket (2), a halogen lamp (3), a computer (4) and a hyperspectral camera (5), wherein the adjustable bracket (2) is vertically mounted on the mobile chassis (1), the halogen lamp (3), the computer (4) and the hyperspectral camera (5) are all mounted on the adjustable bracket (2), the halogen lamp (3) and the hyperspectral camera (5) are both directed toward the laying hens in the chicken cage during shooting, the computer (4) and the hyperspectral camera (5) are electrically connected, the hyperspectral image of the laying hens is shot by the hyperspectral camera (5) and then transmitted to the computer (4) for processing, and the target detection segmentation model and the superpixel block recognition model are both installed in the computer (4).

3. The method for detecting low laying hens by high spectrum according to claim 1, characterized in that: In the step S1, for each hyperspectral image, the hyperspectral image is subjected to whiteboard correction to obtain a standard image, and then three bands of 454nm, 458nm and 462nm are selected from the standard image to generate a static image.

4. The method for detecting low laying hens by high spectrum according to claim 1, characterized in that: In the step S1, for each static image, during preprocessing, the edges of the combs of each laying hen in the static image are first marked to obtain a marked image, and each marked image is subjected to Canny edge detection to remove motion blurred marked images, and the retained marked images are constructed as the first training set.

5. The method for detecting low laying hens by high-spectrum spectrum according to claim 4, characterized in that: In the step S3, for each annotated image in the first training set, the mask of the annotated image is mapped to the hyperspectral image, the comb part in the hyperspectral image is segmented out, and the hyperspectral image of the comb position is obtained, and then the category of the laying hen is marked on each hyperspectral image of the comb position as a label to obtain a label image, and each label image is constructed as a second training set; the categories of laying hens include low-yield and normal, and laying hens whose daily egg production is lower than a preset threshold are classified as low-yield laying hens, and laying hens whose daily egg production is not lower than the preset threshold are classified as normal laying hens.

6. The method for detecting low laying hens by high spectrum according to claim 1, characterized in that: In the step S4, the static image to be detected is first input into the trained target detection segmentation model for processing, and the mask of the comb part in the static image to be detected is obtained after processing, and then through Canny edge detection, if the comb part in the current static image is motion blurred, it is eliminated, and the next static image to be detected is processed, and the currently obtained mask is mapped to the hyperspectral image to be detected, and finally the comb parts of each laying hen in the hyperspectral image to be detected are segmented, and then the comb parts are hyperspectral superpixel segmented by the simple linear iterative clustering SLIC algorithm and input into the trained superpixel block recognition model for processing, and finally the category detection results of each laying hen in the hyperspectral image to be detected are displayed.

7. A high-spectral detection system for low-laying hens suitable for the method according to any one of claims 1 to 6, characterized in that: include: A data acquisition and processing unit collects hyperspectral images of laying hens in each chicken cage in the chicken farm and performs image processing; The image detection unit is equipped with a target detection segmentation model, a superpixel segmentation algorithm and a superpixel block recognition model, and detects the image processed by the data acquisition and processing unit according to the superpixel block threshold; The result display unit displays the category detection result of the laying hen obtained by the image detection unit.

Citation Information

Patent Citations

  • Abnormal laying hen identification method and device, computer equipment and storage medium

    CN116645597A

  • Leftover scrap steel classification and identification method, system, medium and equipment

    CN118898738A