Hyperspectral detection method and system for low-yield laying hens
By building a low-leaving hen hyperspectral detection system, using the object detection segmentation model and superpixel block recognition model to process hyperspectral images, the accurate identification of low-leaning hens is achieved, solving the problems of low-leaning hens are insufficient efficiency and accuracy of traditional detection methods, and improving the efficiency and economic benefits of breeding management.
Patent Information
- Application Number
- CN202510316364.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-18
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2045-03-18
AI Technical Summary
The traditional low-leaning hen detection method is inefficient and insufficient accuracy, and the imaging speed of hyperspectral technology is slow, which makes the image blurring easily due to the movement of the chicken, and the reliability and stability of the model are difficult to guarantee.
The hyperspectral detection method and system of low-leaving hens is adopted to build a data acquisition platform to collect hyperspectral images of laying hens, and process it through the object detection segmentation model, superpixel segmentation algorithm and superpixel block recognition model to achieve accurate identification of low-leaning hens.
It improves the accuracy and efficiency of breeding management, reduces waste of feed and breeding space, improves the production performance and breeding economic benefits of laying hens, and provides intelligent decision-making support.
Smart Images

Figure CN119832602A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a laying hen detection method and the field of poultry farming, and in particular to a low-production laying hen hyperspectral detection method and system. Background Art
[0002] With the rapid development of the poultry farming industry, the scale of laying hen breeding has continued to expand, and the traditional artificial breeding method can no longer meet the needs of modern breeding industry for high efficiency and refined management. In the process of laying hen breeding, the key is to accurately identify low-producing laying hens and reduce feed consumption to optimize the overall production efficiency. However, there are many shortcomings in the traditional detection method of low-producing laying hens: First, the efficiency of manual management is low: manual observation and selection of low-producing laying hens are inefficient and lack accuracy, and cannot meet the needs of efficient production. Second, the problem of chicken stress: due to manual selection, it is usually necessary to touch to estimate the pubic distance or touch the abdomen to observe whether there are eggs, which is very stressful for the chickens. Third, the screening time by egg production rate is long: some breeding companies select low-producing laying hens by monitoring the egg production rate of the cage, but this method requires continuous monitoring for many consecutive days, and can only be specific to the cage where the low-producing laying hens are located, not to the low-producing individuals.
[0003] In the existing technology, hyperspectral technology is also used to detect low-laying hens, and high accuracy has been achieved. However, the speed of hyperspectral imaging is slow. In actual use, the hyperspectral image of the observed target is often blurred due to the rapid movement of the chickens, and the quality does not meet the recognition requirements. In addition, the hyperspectral image of the comb part is extracted in an unsupervised manner. Due to the complexity of the actual scene and the influence of noise, in the process of endmember extraction, major endmembers are often omitted, the extracted endmembers are inaccurate, and they are easily affected by noise. 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 technology, the present invention provides a method and system for high-spectrum detection of low-laying hens. The method and system can realize accurate identification of low-laying hens. Through automation and intelligent technology, the present invention can improve the efficiency and accuracy of chicken house management, reduce the waste of feed and breeding space caused by low-laying hens, thereby improving the production performance of laying hens and the economic benefits of breeding.
[0005] The technical solution adopted by the present invention is: 1. A hyperspectral detection method for low-laying laying hens, comprising: 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 low-laying chicken data collection platform, generate static JPG (Joint Photographic Experts Group) images based on the hyperspectral images, and pre-process each JPG static image to construct the first training set.
[0006] S2: Install the target detection segmentation model in the low-laying chicken data collection platform, input the first training set into the target detection segmentation model for training, and obtain the trained target detection segmentation model and the mask of each labeled image in the first training set.
[0007] S3: Construct a superpixel block recognition model ImprovedResNet3D containing an improved residual module group in the low-laying chicken data collection platform, construct the first training set into a second training set after processing according to the mask, process the second training set with a superpixel segmentation algorithm, and input it into the superpixel block recognition model for training to obtain a trained superpixel block recognition model.
[0008] S4: The hyperspectral image of each laying hen to be detected is obtained through the low-laying hen data acquisition platform and the static JPG image to be detected is obtained after the same processing as in step S1, and then processed in sequence through the trained target detection segmentation model, superpixel segmentation algorithm and trained superpixel block recognition model, and finally the category detection result of each laying hen in the hyperspectral image to be detected is obtained and displayed after superpixel block threshold detection, so as to realize the detection of low-laying hens and improve the efficiency and accuracy of chicken house management through automation and intelligent means.
[0009] In the step S1, the low-production laying hen data acquisition platform includes a mobile chassis, an adjustable bracket, a halogen lamp, a computer and a hyperspectral camera, the adjustable bracket is vertically mounted on the mobile chassis, the halogen lamp, the computer and the hyperspectral camera are all mounted on the adjustable bracket, the halogen lamp and the hyperspectral camera are both facing the laying hens in the chicken cage when shooting, the computer and the hyperspectral camera are electrically connected, the hyperspectral image of the laying hens taken by the hyperspectral camera is transmitted to the computer for processing, and the target detection segmentation model and the superpixel block recognition model are both installed in the computer. The low-production laying hen data acquisition platform can adapt to the cage positions of laying hens at different heights, realize comprehensive data acquisition, and ensure flexibility and adaptability.
[0010] 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 JPG image.
[0011] In the step S1, for each static JPG image, during preprocessing, the edges of the combs of each laying hen in the static JPG 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.
[0012] 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.
[0013] In the 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, 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.
[0014] The mask of the image is mapped to the hyperspectral picture, the comb part in the hyperspectral image is segmented to obtain the hyperspectral image of the comb position, 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 with daily egg production lower than a preset threshold are classified as low-yield laying hens, and laying hens with daily egg production not lower than the preset threshold are classified as normal laying hens.
[0015] In the step S4, the static JPG 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 JPG image to be detected is obtained after processing, and then Canny edge detection is performed. If the comb part in the current static JPG image is motion blurred, it is eliminated, and the next static JPG image to be detected is processed, and the currently obtained mask is mapped to the hyperspectral image to be detected, and finally the comb part of each laying hen in the hyperspectral image to be detected is segmented, and then the comb part is segmented into hyperspectral superpixels by a simple linear iterative clustering SLIC (Simple Linear Iterative Clustering) algorithm and input into the trained superpixel block recognition model for processing, and finally the category detection result of each laying hen in the hyperspectral image to be detected is displayed.
[0016] In the step S4, the static JPG 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.
[0017] 2. A high-spectral detection system for low-laying laying hens, comprising: The data acquisition and processing unit collects the hyperspectral images of laying hens in each chicken cage in the chicken farm and performs image processing.
[0018] 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.
[0019] The result display unit displays the category detection result of the laying hen obtained by the image detection unit.
[0020] The beneficial effects of the present invention are: 1. The present invention can improve the accuracy and efficiency of breeding management: through the automated data collection platform and deep learning model, accurate identification of low-producing laying hens in the laying hen house is achieved. Compared with traditional manual inspection, the system greatly 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 the selection of low-producing laying hens.
[0021] 2. The present invention can optimize chicken breeding: through intelligent identification of low-laying hens, chickens with low egg-laying efficiency for a long time can be found as early as possible, and eliminated in time to avoid waste of resources, which helps the farm maintain an efficient group of laying hens, thereby improving overall production efficiency. At the same time, resources can be used more effectively, reducing feed waste, space occupation and environmental pressure caused by low-laying hens, and promoting farms to move towards a more environmentally friendly and sustainable breeding model.
[0022] 3. The present invention can provide intelligent decision support: The system of the present invention is not limited to real-time monitoring and data reporting, but also provides intelligent decision support, which can provide real-time monitoring and analysis support for various production data for farms, and help farmers dynamically adjust management strategies. This intelligent decision support mechanism makes farming management more scientific and flexible, and further improves farming efficiency and economic benefits. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 This is a schematic diagram of the low-laying chicken data collection platform of the present invention; Figure 2 This is a training result diagram of the target detection segmentation model Yolov8n-seg of the present invention, where: Figure 2 (a) is the bounding box loss, segmentation loss, classification loss and depth loss curve of the training set and the test set during training. Figure 2 (b) is a graph showing the precision, recall and average precision of bounding boxes and masks at different thresholds; Figure 3 is a graph showing the training results of superpixel block level and individual level in the present invention, where: Figure 3 (a) is a schematic diagram of training and testing losses at the pixel block level. Figure 3 (b) is a schematic diagram of training and testing accuracy at the pixel block level. Figure 3 (c) is a schematic diagram of the accuracy of identifying low-yield chickens and normal chickens in the test set; Figure 4 This is a distribution diagram of superpixel distribution and pixel block categories in the cockscomb area of the present invention, where: Figure 4 (a) is the cockscomb segmentation map, Figure 4 (b) is the super pixel block distribution map. Figure 4 (c) is the category distribution map of pixels identified as low-yield (red) and normal chicken pixels (green); Figure 5 A flow chart for individual identification of low-laying hens of the present invention; In the picture: 1. Mobile chassis, 2. Adjustable bracket, 3. Halogen lamp, 4. Computer, 5. Hyperspectral camera. DETAILED DESCRIPTION
[0024] The present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0025] like Figure 5 As shown, the hyperspectral detection method for low-laying laying hens of the present invention is specifically as follows: First, build a low-production laying hen data collection platform, such as Figure 1As shown, the low-production laying hen data collection platform includes a mobile chassis 1, an adjustable bracket 2, a halogen lamp 3, a computer 4 and a 400-1000nm hyperspectral camera 5, 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 facing the laying hens in the chicken cage when shooting, the computer 4 and the hyperspectral camera 5 are electrically connected, the hyperspectral image of the laying hens taken by the hyperspectral camera 5 is 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. The low-production laying hen data collection platform can adapt to the cage positions of laying hens of different heights, realize comprehensive data collection, and ensure flexibility and adaptability.
[0026] Then, the hyperspectral images of laying hens in each chicken cage in the chicken farm were collected through the low-laying laying hen data collection platform. For each hyperspectral image, the hyperspectral image was corrected with a whiteboard to obtain a standard image. Then, the three bands of 454nm, 458nm and 462nm were selected from the standard image through OpenCV, Numpy, osgeo and other libraries of 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 were annotated using the image annotation labelme tool using the segment annotation method to obtain an annotated image. The image quality of each annotated image was evaluated by Canny edge detection, and the motion blurred annotated images were removed. The retained annotated images were constructed as the first training set. The annotated images in the training set contained rich features for comb segmentation, providing high-quality training and verification data for the automatic segmentation of the comb part. In the specific implementation, 120 low-laying egg-laying hens and 120 normal chickens were selected and raised normally in cages, with 4 to 6 chickens in each cage. Images of 40 normal chickens and 40 low-laying egg-laying hens were randomly selected as the first training set, and the remaining 80 normal chickens and 80 low-laying egg-laying hens were used as the test set.
[0027] The present invention adopts the Canny edge detection algorithm to evaluate the clarity of the image, so as to automatically identify and eliminate low-quality cockscomb images with motion blur. For each annotated image, the Canny edge detection algorithm is first used to generate an edge feature map to detect all significant edge contours in the image, and then the edge density is calculated. The image area mask is set to limit the detection range, and then the edge density in the mask range in the edge feature map is calculated, and the edge density = the number of non-zero pixels in the Canny edge map / the number of non-zero pixels in the mask area.
[0028] The edge density represents the edge clarity of the image in the mask area. The clarity threshold is set based on experimental analysis. If the edge density value is lower than the clarity threshold, the image is judged to have motion blur and does not meet the requirements of subsequent processing. The image is automatically removed to ensure the image quality for subsequent processing.
[0029] Then, the target detection segmentation model is installed in the low-laying chicken data collection platform, and the first training set is input into the target detection segmentation model for training to obtain the trained target detection segmentation model and the mask of each labeled image in the first training set; the target detection segmentation model specifically adopts the Yolov8n-seg (You Only Look Once) model. When training the target detection segmentation model, select the PyTorch deep learning framework, set the preset training rounds, and update the model weights through forward propagation and back propagation to optimize the model performance; then evaluate the model training results, including loss evaluation, precision and recall analysis, and mean average precision mAP (mean Average Precision) curve drawing to ensure that the model reaches the expected accuracy level. Figure 2 As shown in (a), the bounding box loss, segmentation loss, classification loss, and depth loss results of the training set and test set of the target detection segmentation model Yolov8n-seg all show a downward trend and eventually converge to a lower level, which shows that the model is constantly learning and optimizing and can fit the data better. Figure 2 As shown in (b), the precision, recall, average precision (threshold is 0.5) and average precision (threshold is 0.5-0.95) of the bounding box and mask of the target detection and segmentation model Yolov8n-seg have all reached a high level, which shows that the model has high accuracy and reliability in target detection and segmentation tasks.
[0030] The target detection segmentation model Yolov8n-seg of the present invention can make preliminary predictions on static JPG images, thereby determining the target area in the hyperspectral image. By running batch inference on the visible light image, the bounding box and segmentation mask area information of the target area can be generated; according to the prediction results of the target detection 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 segmentation processing is performed according to the pixel threshold, and the pixel position below the threshold is set to zero, and the target area above the threshold is retained; the hyperspectral image is screened pixel by pixel using the mask, thereby retaining 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 range corresponding to the predicted area in the hyperspectral image is intercepted to retain the multi-band information of each target area. The specific boundary point refers to the specific position parameter 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, which are determined according to the bounding box generated by the target detection segmentation model Yolov8n-seg. These parameters are used as the standard 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 horizontal coordinate x and vertical coordinate y of its center point are obtained. The center point is the specific starting position of the segmented area, which 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. These dimensions are used to calculate the boundaries of the cropped area, that is, the left and right, upper and lower boundary points, to form a specific cropping range. The center point coordinates, width and height are combined to determine the left and right boundaries as x1=xw / 2 and x2=x+w / 2, and the upper and lower boundaries as y1=yh / 2 and y2=y+h / 2, and then the target area is cropped. This method ensures that the cropped hyperspectral image area fully matches the target area predicted by the model, and can retain the multi-band information of each pixel, thereby supporting fine spectral analysis.
[0031] 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.
[0032] 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.
[0033] The MultiHeadAttention3D module 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 feedforward enhancement network. The module first maps the input features and context features to channel dimensions through three independent three-dimensional convolutional layers to generate a query vector Query, a key vector Key, and a value vector Value. The query vector is obtained by projecting the current level features through the three-dimensional convolutional layer, and the key-value vector is extracted from the lower-level context features through three-dimensional convolutions of the same dimension to ensure strict alignment of spatial dimensions (depth, height, width). The projected features are reorganized into num_heads parallel computing heads through channel splitting, and the feature dimension of each head is in_channels / num_heads, where in_channels is the number of channel dimensions of the input feature tensor. The cross-level attention weights are then calculated through matrix multiplication, where the query vector and the key vector are transposed and multiplied, normalized by the scaling factor head_dim, and then activated by Softmax to generate an attention distribution map, and finally weighted summed with the value vector to achieve feature fusion. The fused multi-head features are concatenated to restore the original number of channels, and the channels are integrated through the output projection convolution layer. In the process, Dropout3d (drop probability p=0.1) is used for random inactivation to enhance generalization ability. The module adopts a dual residual connection design: the first residual adds the multi-head attention output to the original input features, and stabilizes the gradient distribution through three-dimensional batch normalization; the second residual is executed after the feedforward network processing, which consists of two levels of three-dimensional convolution. The first level convolution expands the channel to four times and applies ReLU nonlinear activation. The secondary convolution restores the original channel dimension, inserts a random inactivation layer in the middle to prevent overfitting, and finally completes the feature calibration through batch normalization. All three-dimensional convolution operations use a 1×1×1 kernel size to keep the spatial dimension unchanged. The attention calculation stage realizes tensor morphology transformation by reshaping the view and dimensional exchange transpose operations. By integrating the results of multiple attention heads, the diversity of data is captured from different angles, which enhances the model's understanding and generalization ability of complex tasks.
[0034] After the superpixel block recognition model is constructed, 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, and the comb position hyperspectral image is obtained. Then, the category of laying hens is marked on each comb position hyperspectral image as a label to obtain a label image, and each label image is constructed as the second training set; the categories of laying hens include low-yield and normal, and laying hens with daily egg production below the preset threshold are classified as low-yield laying hens, and laying hens with daily egg production not less 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 a trained superpixel block recognition model.
[0035] In actual detection, the hyperspectral images of each laying hen to be detected are first obtained through the low-laying hen data acquisition platform and preprocessed to obtain the static JPG image to be detected, and then the trained target detection segmentation model, superpixel segmentation algorithm and trained superpixel block recognition model are used for processing in turn. The static JPG image to be detected is first input into the trained target detection segmentation model for processing, and the comb part and its mask area in the static JPG image to be detected are obtained after processing. Then, through Canny edge detection, if the comb part in the current static JPG image is motion blurred, it is eliminated, and the next static JPG image to be detected is processed, and the currently obtained mask area is mapped to the hyperspectral image to be detected, and finally the comb part of each laying hen in the hyperspectral image to be detected is segmented, and then the comb part is hyperspectral superpixel segmented by the simple linear iterative clustering SLIC (Simple Linear Iterative Clustering) algorithm is input into the trained superpixel block recognition model for processing, and finally the category detection result of each laying hen in the hyperspectral image to be detected is displayed.
[0036] The Simple Linear Iterative Clustering (SLIC) algorithm performs 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, each of which represents an area in the image. Invalid pixel block screening: 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 zero reflectivity). Pixel blocks containing invalid values will be removed 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 of the spectral dimension, which can characterize the reflectance 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 network input. Superpixel segmentation reduces the number of processed units and improves data processing efficiency. At the same time, the accuracy of subsequent classification is guaranteed by extracting effective spectral features.
[0037] After the final processing, the category detection results of each laying hen in the hyperspectral image to be detected are output and displayed. The static JPG image to be detected is first processed by the trained target detection segmentation model to segment the comb part, such as Figure 4 As shown in (a), the pixel blocks of the comb are then segmented using the superpixel segmentation algorithm SLIC, and then processed using the trained superpixel block recognition model to identify the category of each pixel block in the comb, as shown in Figure 4 As shown in (b), the number of pixel blocks identified as low-yield categories (marked in red) and normal categories (marked in green) is obtained, and then super-pixel block threshold detection is performed, as shown in Figure 4 As shown in (c), the ratio of pixel blocks identified as low-yield categories to the total pixel blocks is obtained. When the 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-yield laying hen. The detection of low-yield laying hens is realized to improve the efficiency and accuracy of chicken house management through automation and intelligent means.
[0038] After training the superpixel block recognition model ImprovedResNet3D of the present invention, the model training results need to be evaluated, including loss evaluation, precision and recall analysis, to ensure that the model reaches the expected accuracy level, as shown in Table 1.
[0039] Table 1
[0040] The classification results of superpixel blocks are calculated as file-level prediction labels. File-level labels are generated by counting the pixel block classification results of each file and outputting a classification report. The specific steps are as follows: Pixel block prediction result statistics: After completing the classification of pixel blocks in each file, the module counts the number of pixel blocks belonging to different categories in each file based on the output of the classification model. For example, the number of pixel blocks in category 0 (low-laying chicken category) and category 1 (normal chicken category) is counted.
[0041] Category ratio calculation: Based on the number of pixel blocks counted, calculate the ratio of pixel blocks of the target category (category 1) in the file. For example, for each file, calculate the ratio of pixel blocks of category 1 to the total number of pixel blocks for file-level label inference.
[0042] Threshold-based classification of low-laying chickens: Based on the target category ratio, a threshold is set to determine the final category label of the file. If the target category ratio exceeds the set threshold, the file is judged as category 1, otherwise it is category 0. This method ensures that the individual-level label can accurately reflect the main category 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 predictions and provides a convenient and accurate classification scheme for large-scale hyperspectral image analysis. The individual recognition results of low-laying chickens and normal chickens are shown in Table 2.
[0043] Table 2
[0044] like Figure 3 (a) Figure 3 (b) and Figure 3 (c) shows the training and test losses at the pixel block level, the training and test accuracy at the pixel block level, and the individual recognition accuracy of low-yield chickens and normal chickens in the test set. It can be found that the training and test losses at the pixel block level are initially high, and both decrease significantly as the training progresses. The two are close in the later stage, indicating that the model learns effectively during the training process without overfitting. The training and test accuracy 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 effect and good generalization ability. The individual recognition accuracy of low-yield chickens and normal chickens in the test set increases rapidly with the improvement of the pixel block level recognition accuracy, indicating that the prediction ability of this low-yield chicken recognition method for individual samples is relatively stable and reliable.
[0045] When the method of the present invention is applied in a scenario, the trained model is first deployed to the inspection system of the laying hen house to realize 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, and the system generates a low-producing laying hen data analysis report, including key indicators such as the number of low-producing laying hens and the distribution of low-producing laying hens, and provides a friendly interactive function through the user interface. Farming management personnel can query and view the number, distribution and change trend of low-producing laying hens through the interface, and timely understand the production performance of the laying hen group; 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 acquisition devices, and supports a variety of data interfaces to meet the needs of farms of different sizes. The system also reserves an extended function interface to facilitate the subsequent introduction of new data sources and identification methods in the identification model to further improve the identification accuracy. The present invention realizes an efficient and accurate low-producing laying hen identification method, which helps to improve breeding management efficiency, reduce costs, and promote the sustainable development of the breeding industry.
[0046] The present invention also designs a hyperspectral detection system for low-laying chickens, which includes a data acquisition and processing unit, an image detection unit and a result display unit. The data acquisition and processing unit collects hyperspectral images of laying hens in each chicken cage in a 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.
[0047] It should be understood by those skilled in the art that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, the present application may take 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 codes. The schemes in the embodiments of the present application may 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.
[0048] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. 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.
[0049] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application belong to the scope of equivalent technologies of the present invention, the present application is also intended to include these modifications and variations.
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: The hyperspectral image of each laying hen to be detected is obtained through the low-laying hen data acquisition platform and the static image to be detected is obtained after the same processing as in step S1, and then processed in sequence through the trained target detection segmentation model, superpixel segmentation algorithm and trained superpixel block recognition model, and finally the category detection result of each laying hen is obtained after superpixel block threshold detection and displayed on the display, thereby realizing the detection of low-laying hens.
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 according to claim 1, characterized in that: 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.
6. The method for detecting low laying hens by high spectrum according to claim 1, characterized in that: In the step S3, the improved residual module group 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.
7. 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.
8. 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.
9. 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 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.
10. A high-spectral detection system for low-laying hens suitable for the method according to any one of claims 1 to 9, 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
Method and system for monitoring egg laying performance of laying hen zone of cage-rearing laying hens
CN111134047A
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
Method and system for monitoring egg-laying performance of caged laying hens at laying-hen positions
WO2021073092A1
Three-dimensional lidar point cloud semantic segmentation method and apparatus based on deep learning
WO2024130776A1
Cited By
Low-yield laying hen detection system and method based on multi-target behavior tracking
CN120052284A
Low-yield laying hen detection system and method based on multi-object behavior tracking
CN120052284B