Method, device and equipment for determining number of livestock and storage medium
Through infrared feature extraction and target detection, the problem of night counting errors in livestock breeding is solved, and accurate statistics on livestock numbers under poor lighting conditions are achieved, and the environment of multiple light rays and multi-angle are adapted to multi-light and multi-angle environments are adapted.
Patent Information
- Application Number
- CN202411005611.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-11-15
AI Technical Summary
In livestock breeding, there are errors in the counting of livestock numbers at night. The repeated calculations of traditional methods and the number of missing numbers are serious, and the recognition errors are relatively large under image recognition technology.
Infrared feature extraction and object detection methods are adopted. If the light intensity is lower than the preset threshold, the image sequence is obtained through the infrared camera, corner points, edges, textures and shape characteristics are extracted, and individual identification and counting of livestock are carried out, combining cross-frame position information. Update counts, exclude duplicate counts, and improve accuracy.
In the case of poor lighting conditions, the number of livestock can be accurately counted, errors can be reduced, statistics can be improved, and statistical accuracy and stability can be improved, and multi-ray and multi-angle conditions can be adapted to multi-light and multi-angle conditions.
Smart Images

Figure CN118968550A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of animal husbandry, and in particular to a method, a device, equipment and a storage medium for determining the number of livestock. Background Art
[0002] In the traditional livestock farming industry, due to the large number of livestock, especially when livestock are gathered together, manual counting of livestock will result in duplicate calculations and omissions; counting the number of livestock using image recognition technology also has the problem of large recognition errors. Summary of the invention
[0003] In view of this, the present invention provides a method, device, equipment and storage medium for determining the number of livestock, so as to solve the problem of errors in counting the number of livestock at night.
[0004] In a first aspect, the present invention provides a method for determining the number of livestock, the method comprising: if the light intensity is lower than a preset light threshold, acquiring a first image sequence within a preset area; performing infrared feature extraction on the images in the first image sequence, performing infrared target detection on the images in the first image sequence based on the extracted infrared features, and identifying individual livestock within the preset area, location information of the individual livestock, and a first number of livestock based on a result of the infrared target detection; judging whether the individual livestock is still within the preset area based on the location information of the individual livestock in adjacent frames of the image, and updating the first number of livestock based on the judgment result.
[0005] In an optional embodiment, the infrared feature extraction of the images in the first image sequence includes at least one of the following: based on scaling the images in the first image sequence, detecting local feature points, and extracting local feature descriptors in the neighborhood of the local feature points; matching feature points between different frame images based on the local feature descriptors to obtain corner point features of the target; based on the images in the first image sequence, obtaining the gradient of the image in a first direction, obtaining the gradient of the image in a second direction, and obtaining edge features of the image based on the gradient in the first direction and the gradient in the second direction, wherein the first direction is perpendicular to the second direction; calculating the grayscale distribution of image pixels in the first image sequence to obtain texture features of the images in the first image sequence; and performing contour extraction based on the images in the first image sequence to obtain shape features of the target.
[0006] In this way, under poor lighting conditions, target detection and recognition can be carried out to determine the number of livestock through infrared feature extraction such as corner features, edge features, texture features or shape features, and it can adapt to multiple lighting conditions and multiple image angles.
[0007] In an optional embodiment, the method further includes: if the light intensity is higher than or equal to the preset light threshold, acquiring a second image sequence within the preset area; performing target detection on the images in the second image sequence, and identifying the livestock individuals within the preset area, the location information of the livestock individuals, and the second number of livestock based on the target detection results; judging whether the livestock individuals are still within the preset area based on the location information of the livestock individuals in adjacent frames of the image, and updating the second number of livestock based on the judgment result.
[0008] In an optional embodiment, infrared target detection is performed on the images in the first image sequence based on the extracted infrared features, and based on the results of the infrared target detection, individual livestock in the preset area are identified, including: training an infrared classifier based on the extracted infrared features; and performing the infrared target detection based on the trained infrared classifier to identify the individual livestock.
[0009] In an optional embodiment, the training of the infrared classifier based on the extracted infrared features includes: extracting thermal contrast features of the image and normalizing the extracted thermal contrast features; training the infrared classifier based on the normalized data; evaluating the performance of the infrared classifier and adjusting the performance of the infrared classifier based on the evaluation results to obtain the trained infrared classifier.
[0010] In an optional embodiment, the method further includes: marking the number of livestock in images in the first image sequence to obtain the marked number of livestock; for the images in the first image sequence, based on the marked number of livestock corresponding to the images and the first number of livestock determined by identification, calculating the accuracy and / or precision and / or recall rate of the livestock number results obtained when the light intensity is lower than the preset light threshold condition; based on the calculation results, judging the stability of the livestock number determination method when the light intensity is lower than the preset light threshold condition.
[0011] In an optional embodiment, the identifying of the individual livestock includes: identifying the individual livestock based on multiple models to obtain multiple initial identification results; calculating evaluation indicators of the multiple models based on the number of marked livestock and the multiple initial identification results, the evaluation indicators including at least one of the following: accuracy, precision and recall; setting an initial weight for each model based on the evaluation indicator of each model; if the initial identification result of a target model among the multiple models is significantly different from the initial identification results obtained by other models, adjusting the initial weight of the target model, and obtaining the identification result of the individual livestock based on the initial identification result of the target model, the adjusted weight of the target model, the initial identification results of the other models and the initial weights of the other models.
[0012] In a second aspect, the present invention provides a device for determining the number of livestock, the device comprising: an image acquisition module, for acquiring a first image sequence within a preset area if the light intensity is lower than a preset light threshold; a first determination module, for performing infrared feature extraction on images in the first image sequence, performing infrared target detection on the first image sequence based on the extracted infrared features, and identifying individual livestock within the preset area, location information of the individual livestock, and a first number of livestock based on a result of the infrared target detection; an update module, for determining whether the individual livestock is still within the preset area based on the location information of the individual livestock in adjacent image frames, and updating the first number of livestock based on the determination result.
[0013] In a third aspect, the present invention provides a computer device comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the method for determining the number of livestock according to the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0014] In a fourth aspect, the present invention provides a computer-readable storage medium having computer instructions stored thereon, the computer instructions being used to cause a computer to execute the method for determining the number of livestock according to the first aspect or any corresponding embodiment thereof.
[0015] When the light intensity is lower than the preset light threshold, that is, when the lighting conditions are relatively poor, based on the characteristic that infrared images are less affected by lighting conditions, infrared features are extracted from images in the preset area to obtain the number of livestock in the preset area. Combined with the cross-frame position information of individual livestock, the movement direction of the livestock is obtained. If the livestock moves out of the preset area, the number of livestock decreases. If the livestock moves into the preset area, the number of livestock increases. The counting results in the preset area are updated accordingly, which can eliminate repeated counting due to livestock movement and obtain more accurate quantity statistics, thereby ensuring the accuracy of the determination of the number of livestock under poor lighting conditions. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A schematic flow chart of a method for determining the number of livestock in an embodiment of the present invention is shown;
[0018] Figure 2 A schematic diagram of a process for acquiring a first image sequence in an embodiment of the present invention is shown;
[0019] Figure 3 A schematic diagram of a process for processing a second image sequence in an embodiment of the present invention is shown;
[0020] Figure 4 A schematic diagram of a process for evaluating a model in an embodiment of the present invention is shown;
[0021] Figure 5 Another schematic diagram showing the process of the method for determining the number of livestock provided by an embodiment of the present invention;
[0022] Figure 6 A schematic diagram of the record of individual livestock behavior trajectories is shown;
[0023] Figure 7 Another schematic diagram showing the process of the method for determining the number of livestock provided by an embodiment of the present invention;
[0024] Figure 8 A schematic diagram of the structure of the device for determining the number of livestock in this embodiment is shown;
[0025] Fig. 9 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0027] Object detection is to identify and describe each detected object in an image using a bounding box, where the object is an instance of a predefined set of object categories. In this embodiment, the objects detected are livestock, including: pigs, cattle, sheep, horses, donkeys, camels, rabbits, chickens, ducks, geese, etc.
[0028] The principle of infrared target detection is to use the difference in radiation intensity between the target and the background to separate the two, thereby achieving target detection. Compared with visible light target detection, it lacks color information.
[0029] According to an embodiment of the present invention, an embodiment of a method for determining the number of livestock is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0030] In this embodiment, a method for determining the number of livestock is provided, which can be used in a mobile terminal, such as a mobile phone, a desktop computer or a tablet computer, etc. Figure 1 FIG. 4 is a flow chart showing a method for determining the number of livestock in an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0031] Step S101: if the light intensity is lower than a preset light threshold, a first image sequence in a preset area is acquired.
[0032] In this step, light intensity refers to the light energy received per unit area, measured in lux. The preset light threshold is used to determine the intensity of light. When the light intensity is lower than the preset light threshold, it indicates that the lighting conditions are poor and visibility is low. The preset light threshold can be set to about 5 lux, or it can be determined according to the specific scenario of the implementation of the embodiment of the present invention. The preset area is an area where livestock gather when the number of livestock needs to be determined. The preset area can be set to the aisle of a farm. In this step, the light intensity is continuously monitored, and when it is detected that the light intensity is lower than the preset light threshold, it is switched to the infrared image acquisition mode.
[0033] Figure 2 FIG. 2 shows a schematic diagram of a process for acquiring a first image sequence in an embodiment of the present invention. Figure 2 As shown, S201: Project start, start the all-weather video data collection project of livestock individual activities. S202: System planning, determine the required equipment types and technical specifications. S203: Determine the camera type, select the appropriate camera according to the needs of different time periods, and use infrared cameras to shoot when the light intensity is relatively poor. S204: Position planning and installation, set the camera installation position in the farm to ensure that all important areas are covered and the viewing angle is appropriate. S205: Power supply system deployment, install stable and reliable power supply facilities to ensure the continuous operation of infrared cameras. S206: Network transmission settings, establish a video data transmission link to ensure real-time or scheduled transmission of video data to the data center or cloud. S207: Synchronize calibration time, all infrared cameras need to calibrate time to ensure that the data has an accurate time tag. S208: Start all-weather recording, and the camera will record video uninterruptedly around the clock after it is turned on. S209: Video storage solution, video data can be stored through a large-capacity and efficient video storage structure, through local storage and combined with cloud storage. S210: Data backup strategy, which can formulate regular video data backup and redundant storage strategy to prevent data loss. S211: Monitoring and maintenance, which can conduct daily inspection and troubleshooting of cameras and storage devices to ensure stable operation of the system.
[0034] When the light intensity is lower than the preset light threshold, an infrared camera can be used to obtain the first image sequence in the preset area. S212: Timed and time-segmented acquisition. The collected video data can be divided into time periods by an infrared camera to facilitate subsequent analysis. S213: Light condition labeling. Video clips under different lighting conditions can be labeled to help with later algorithm training and optimization. S214: Image sequence segmentation. The video sequence can be cut into single frames to obtain a first image sequence; the video sequence can also be cut into continuous small segments. S215: Data preprocessing. The images in the first image sequence can be preprocessed by denoising, enhancement, and standardization to facilitate the identification of individual livestock behaviors. S216: Data analysis and identification of individual livestock behaviors. The data processed in the aforementioned steps can be used for data analysis and identification of individual livestock behaviors.
[0035] Step S103, performing infrared feature extraction on the images in the first image sequence, performing infrared target detection on the images in the first image sequence based on the extracted infrared features, and identifying individual livestock within a preset area, location information of the individual livestock, and the first livestock quantity based on the results of the infrared target detection.
[0036] In this step, infrared images of individual livestock in low-light environments are captured by infrared cameras, so that the outlines and thermal radiation characteristics of individual livestock can be clearly presented under poor lighting conditions, such as at night. The captured infrared images are preprocessed, including but not limited to noise reduction, contrast enhancement, and correction of geometric distortion. In this way, the input quality of subsequent recognition models can be improved. A series of artificial intelligence (AI) models optimized and trained for infrared images are loaded and enabled. These models can use livestock feature recognition under different light source conditions. Infrared features include: corner features, edge features, texture features, or shape features. The individual characteristics, position, and posture of livestock can be described by the aforementioned infrared features.
[0037] AI models that are optimized and trained for infrared images can be optimized in terms of feature recognition capabilities for infrared images. Since infrared images differ significantly from visible light images in terms of spectrum, contrast, and noise, the characteristics of infrared images are specially considered during the design and training of the trained AI models. The performance of the trained AI models on infrared images can be optimized by using specific convolution kernels, activation functions, or loss functions.
[0038] AI models that are optimized and trained for infrared images can also adapt to multiple lighting conditions. Livestock may be photographed under different lighting conditions, such as day, night, or cloudy days. AI models that are optimized and trained for infrared images can adapt to changes in these lighting conditions. This can be achieved by including images under multiple lighting conditions in the AI model's training data set, or by using data augmentation technology to simulate different lighting conditions.
[0039] AI models optimized and trained for infrared images can identify the individual characteristics, body shape, posture, and location information of livestock, and can use technologies such as target detection or image segmentation to locate and identify individual livestock in images.
[0040] When designing the AI model optimized and trained for infrared images, the computing efficiency and real-time requirements are taken into consideration. The AI model optimized and trained for infrared images can quickly process infrared images and give accurate recognition results.
[0041] The trained AI model optimized for infrared images can be compressed or optimized for easy integration and deployment, which can reduce the use of computing resources and storage space, and can be deployed and run on different hardware and operating systems.
[0042] Step S105, based on the position information of the individual livestock in the adjacent frames of the image, it is determined whether the individual livestock is still in the preset area, and the first livestock quantity is updated based on the determination result.
[0043] The method for determining the number of livestock provided in this embodiment, when the light intensity is lower than a preset light threshold, that is, when the lighting conditions are relatively poor, based on the characteristic that infrared images are less affected by lighting conditions, extracts infrared features from images within a preset area, obtains the number of livestock within the preset area, and obtains the movement direction of the livestock in combination with the cross-frame position information of the individual livestock. If the livestock moves out of the preset area, the number of livestock decreases, and if the livestock moves into the preset area, the number of livestock increases. The counting results within the preset area are updated accordingly, and repeated counting due to livestock movement can be eliminated, so as to obtain more accurate number statistics, thereby ensuring the accuracy of the determination of the number of livestock under relatively poor lighting conditions.
[0044] In some optional embodiments, infrared feature extraction is performed on images in the first image sequence, including at least one of the following: based on scaling the images in the first image sequence, local feature points are detected, and local feature descriptors are extracted in the neighborhood of the local feature points; feature points between different frame images are matched based on the local feature descriptors to obtain corner point features of the target; based on the images in the first image sequence, a gradient of the image in a first direction is obtained, a gradient of the image in a second direction is obtained, and edge features of the image are obtained based on the gradient in the first direction and the gradient in the second direction, wherein the first direction is perpendicular to the second direction; grayscale distribution of image pixels in the first image sequence is calculated to obtain texture features of the images in the first image sequence; and contour extraction is performed based on the images in the first image sequence to obtain shape features of the target.
[0045] In this embodiment, the infrared feature extraction of the image in the first image sequence includes: extracting the corner features of the target, extracting the edge features of the target, extracting the texture features of the target, extracting the shape features of the target, extracting the corner features and edge features of the target, extracting the corner features and texture features of the target, extracting the edge features and shape features of the target, extracting the edge features and texture features of the target, extracting the edge features and shape features of the target, extracting the texture features and shape features of the target, extracting the corner features, edge features and texture features of the target, extracting the corner features, edge features and shape features of the target, extracting the edge features, texture features and shape features of the target, extracting the corner features, edge features, texture features and shape features of the target. Among them, the edge features of the target can be extracted by edge detection algorithms such as Sobel or Laplacian; the corner features of the target can be extracted by key point detection and descriptor algorithms such as SIFT or SURF; the texture features of the target can be extracted by gray level co-occurrence matrix or Fourier transform; the shape features of the target can be extracted by contour extraction or Hu moment.
[0046] When the lighting conditions are poor or insufficient, the above infrared feature extraction strategies are automatically matched based on the lighting conditions and different angles of the image, or all of the above infrared feature extraction strategies are used to extract infrared features.
[0047] In this way, under poor lighting conditions, target detection and recognition can be carried out to determine the number of livestock through infrared feature extraction such as corner features, edge features, texture features or shape features, and it can adapt to multiple lighting conditions and multiple image angles.
[0048] In some optional embodiments, based on feature extraction, features can be further analyzed to identify the position of livestock, and target detection algorithms can be used, such as sliding window, Histogram of Oriented Gradient (HOG) + Support Vector Machine (SVM), Single Shot MultiBox Detector (SSD) or real-time target detection algorithm (You Only Look Once, YOLO). Based on the aforementioned algorithm, the position of individual livestock can be located in the image, and the corresponding bounding box can be given. Posture recognition can also be performed based on the key point detection algorithm to determine the posture information such as the body orientation of the livestock or the position of the livestock trunk, and OpenPose or DeepPose can be used specifically. The key points of the livestock in the image can be identified, such as the head or the limb joints, and the posture of the livestock can be inferred by the relative position of these key points.
[0049] In some optional embodiments, the aforementioned method for determining the number of livestock further includes: if the light intensity is higher than or equal to a preset light threshold, obtaining a second image sequence within a preset area; performing target detection on the images in the second image sequence, and based on the results of the target detection, identifying individual livestock within the preset area, the location information of the individual livestock, and the second number of livestock; based on the location information of the individual livestock in adjacent frames of the image, determining whether the individual livestock is still within the preset area, and updating the second number of livestock based on the determination result.
[0050] In this embodiment, Figure 3 FIG. 2 shows a schematic diagram of a process for processing a second image sequence in an embodiment of the present invention. Figure 3 As shown, S301: camera setting. S302: image acquisition. S303: image preprocessing. S304: target detection, inter-frame image association and livestock number counting. S305: result output, output of livestock number counting results.
[0051] Specifically, in S301, when the lighting conditions are relatively good, the second image sequence in the preset area can be obtained by setting a high-definition camera. In S302, a high-definition camera can be installed at a suitable position in the preset area to ensure that the high-definition camera can cover the entire preset area and capture clear images of livestock. The high-definition camera can continuously shoot livestock images in the preset area at a fixed frame rate, such as ten frames per second, and transmit the obtained second image sequence to the image processing system. In S303, the acquired livestock images are preprocessed, including: denoising, grayscale or binarization operations, so that the characteristics of the livestock can be better extracted. In S304, a deep learning algorithm can be used, such as You Only LookOnce, referred to as YOLO target detection algorithm, or Single Shot MultiBox Detector, referred to as SSD target detection algorithm, to perform target detection on the preprocessed image, identify livestock individuals in the image, and obtain the location information of the livestock individuals. The location information of livestock individuals in consecutive frames is associated, and the movement direction of the livestock is determined by comparing the position changes of livestock individuals in adjacent frames. In S305, the number of livestock detected in each frame is counted, and the average number of livestock in the preset area within the preset time is calculated to obtain the second number of livestock in the preset area. The livestock number and movement direction information obtained by counting can be output in a suitable manner, such as displaying on a monitoring screen or sending to a mobile terminal held by a manager. The number of livestock can be determined under good lighting conditions.
[0052] In some optional embodiments, the aforementioned method for determining the number of livestock further includes: identifying a preset area. By identifying the preset area, a passage path inside the farm can be obtained. When livestock enter the preset area, a video stream is acquired and image recognition is performed. By extracting features such as contours, textures, or colors from the image, combined with cross-frame information, it is possible to determine the situation of livestock entering and exiting the preset area, and update the second livestock number to ensure the accuracy of the statistical results.
[0053] In this embodiment, identifying the preset area includes: capturing the video stream with a camera, for details, please refer to step S301 and will not be repeated here; image acquisition and transmission, for details, please refer to step S302; image preprocessing, for details, please refer to step S303; target detection, for details, please refer to step S304; inter-frame association, associating the position information of individual livestock in consecutive frames, and determining the movement direction of the livestock by comparing the position changes of individual livestock in adjacent frames. Through inter-frame association, repeated counting caused by livestock movement can be eliminated to obtain more accurate quantity statistics; and quantity statistics, the specific content is the same as step S305.
[0054] For the recognition of preset areas, virtual boundaries can be set to simulate the channel path in the actual farm, so that the range of the channel can be accurately defined in various scenarios. The recognition of preset areas can be achieved by training the recognition channel model. Training and optimizing the recognition channel model includes: obtaining input data. The input data includes: actual channel data, which includes channel images or video data at different times, different lighting conditions, and different occlusion conditions; virtual boundary parameters, which include parameters that simulate the farm channel environment, such as channel width, length, and possible obstacle locations; initial model parameters, which include but are not limited to thresholds, filter parameters, or feature extraction parameters in image processing algorithms; performance indicator parameters, which include accuracy, recall rate, and F1 score, etc. The performance indicator parameters are used to evaluate the performance of the recognition channel model.
[0055] In some optional embodiments, training and optimizing the recognition channel model also includes: constructing constraints. The constraints include: real-time constraints, robustness constraints and accuracy constraints. Among them, the real-time constraints enable the recognition channel model to meet the requirements of real-time processing and ensure the timeliness of channel detection. The robustness constraints enable the recognition channel model to cope with various environmental changes and interferences, such as changes in illumination or obstructions. The accuracy constraints enable the recognition channel model to accurately define the channel range and avoid false detection or missed detection. The adjustment process of the recognition channel model includes: data preprocessing, model training and performance evaluation. Among them, data preprocessing includes: preprocessing operations such as cleaning, enhancing and labeling the actual channel data to meet the needs of recognition channel model training; model training includes: model training using preprocessed data and initial model parameters; performance evaluation includes: evaluating the trained model using performance indicators and recording the evaluation results. The evaluation results can be used to analyze the scenarios in which the recognition channel model performs poorly. For the scenarios with poor performance, the virtual boundary parameters or the recognition channel model parameters can be adjusted, and the recognition channel model training and performance evaluation steps can be repeated until the model performance meets the requirements. The results of the adjustment of the recognition channel model include: optimized model parameters, improved model performance, and enhanced model robustness. Among them, the optimized model parameters are the optimized model parameters obtained after multiple iterative adjustments, which can enable the model to accurately delineate the channel range in various scenarios. The model performance improvement means that compared with the model before optimization, the optimized model has improved performance indicators such as accuracy, recall rate, and F1 score. Enhanced robustness means that the optimized model can better cope with various environmental changes and interferences, such as lighting changes or occlusions.
[0056] In some optional embodiments, infrared target detection is performed on images in the first image sequence based on the extracted infrared features, and based on the results of the infrared target detection, individual livestock in a preset area are identified, including: training an infrared classifier based on the extracted infrared features; and performing infrared target detection based on the trained infrared classifier to identify individual livestock.
[0057] In this embodiment, the infrared classifier analyzes the input infrared data and establishes a model, and uses the model to classify the subsequent infrared data. The infrared data used for classification is a set of samples of known categories, each sample containing a set of identical attributes. The infrared classifier is used to realize the recognition of individual features of livestock. The infrared classifier determines to which individual the livestock in the input image belongs based on the extracted infrared features.
[0058] In some optional embodiments, an infrared classifier is trained based on the extracted infrared features, including: extracting thermal contrast features of the image and normalizing the extracted thermal contrast features; training an infrared classifier based on the normalized data; evaluating the performance of the infrared classifier and adjusting the performance of the infrared classifier based on the evaluation results to obtain a trained infrared classifier.
[0059] In this embodiment, the infrared image mainly captures the thermal radiation information of the object, the color information of the infrared image is relatively simple, and the infrared image is usually presented as a grayscale image. The infrared classifier can be trained based on the thermal contrast feature or the temperature feature. Since the background of the infrared image is usually simple and the temperature distribution is relatively uniform, the infrared classifier has relatively low requirements for background suppression and can focus more on the temperature characteristics of the target object. The infrared classifier is mainly affected by thermal noise and instrument noise. Since the information expression of the infrared image is relatively simple, the impact of noise on the classification result may be more significant. In the training process of the infrared classifier, a more effective noise suppression algorithm can be used to improve the classification accuracy. Due to the simple information expression, the training data may be relatively small, and the main focus is on features such as temperature distribution and thermal contrast. In the training process of the infrared classifier, it is necessary to use the limited training data more effectively to learn effective feature representation.
[0060] In some optional embodiments, a conventional classifier can also be trained based on the second image sequence, including: extracting color features of the images in the second image sequence. Conventional images contain relatively rich color information, which plays a key role in distinguishing different objects. The background in conventional images is usually relatively complex, containing a variety of color, texture, and shape information. Conventional classifiers can have the function of distinguishing foreground targets from backgrounds based on background modeling or color space segmentation. The trained conventional classifier has a certain degree of robustness and can cope with the effects of various noises such as lighting changes, shadows, or occlusions on the classification results. Conventional images are rich in color information, and the training data of conventional classifiers usually contains a large amount of color, texture, and shape information, which helps conventional classifiers learn more comprehensive feature representations.
[0061] In this way, by adopting different strategies based on feature selection, background suppression, noise processing and training data, the classifier can be trained to identify the individual characteristics of livestock under different lighting conditions, thereby improving the accuracy of livestock population determination under different lighting conditions.
[0062] In some optional embodiments, the aforementioned method for determining the number of livestock further includes: marking the number of livestock in images in the first image sequence to obtain the marked number of livestock; for the images in the first image sequence, based on the marked number of livestock corresponding to the images and the first number of livestock determined by identification, calculating the accuracy, precision and / or recall rate of the livestock number results obtained under the condition that the light intensity is lower than a preset light threshold; based on the calculation results, judging the stability of the livestock number determination method under the condition that the light intensity is lower than the preset light threshold.
[0063] Figure 4 FIG. 2 shows a schematic diagram of a process for evaluating a model in an embodiment of the present invention. Figure 4 As shown, in this embodiment, S405: under poor lighting conditions or at night, infrared images, i.e., images in the first image sequence, are collected and marked, S406: the infrared image recognition model is trained using the first image sequence, and S407: the accuracy and stability of the infrared image recognition model is tested using an independent night infrared image test set. Wherein, the accuracy includes: accuracy, precision and recall, etc. In this embodiment, for the images in the first image sequence, based on the number of marked livestock corresponding to the image and the first number of livestock determined by identification, the accuracy, precision, recall, accuracy and precision, accuracy and recall, precision and recall, and accuracy, precision and recall of the livestock number results obtained under the condition that the light intensity is lower than the preset light threshold can be calculated.
[0064] The calculation method of the accuracy between the prediction result of the infrared image recognition model and the actual marking result is as follows:
[0065]
[0066] Among them, TP is a true positive example, which correctly judges a positive example as a positive example, indicating that the infrared image recognition model predicts that it is a positive sample, and the number of samples that are actually positive samples. FP is a false positive example, which incorrectly judges a negative example as a positive example, indicating that the infrared image recognition model predicts that it is a positive sample, and the number of samples that are actually negative samples. FN is a false negative example, which incorrectly judges a positive example as a negative example, indicating that the infrared image recognition model predicts that it is a negative sample, and the number of samples that are actually positive samples. TN is a true negative example, which indicates that the infrared image recognition model predicts that it is a negative sample, and the number of samples that are actually negative samples. The calculation method of precision Precision is as follows:
[0067]
[0068] The recall rate can also be expressed as the true rate. The calculation method of the recall rate Recall is as follows:
[0069]
[0070] S408: The stability evaluation of the infrared image recognition model can be done by running the test multiple times and observing the performance fluctuation of the model in different tests. Statistics such as variance or standard deviation can be used to measure the stability of the infrared image recognition model. The smaller the variance or standard deviation, the higher the stability of the infrared image recognition model.
[0071] In this embodiment, S401: conventional images, i.e., images in the second image sequence, can also be collected and marked under relatively good lighting conditions or during the daytime, S402: the conventional image recognition model is trained using the second image sequence, and S403: the accuracy and stability of the conventional image recognition model is tested using an independent daytime conventional image test set. Wherein, the accuracy includes: accuracy, precision, and recall, etc. In this embodiment, for the images in the second image sequence, based on the number of marked livestock corresponding to the image and the number of second livestock determined by identification, the accuracy, precision, recall, accuracy and precision, accuracy and recall, precision and recall, and accuracy, precision and recall of the livestock number results obtained under the condition that the illumination intensity is higher than or equal to the preset illumination threshold can be calculated. The calculation method of the accuracy, precision or recall between the predicted result of the conventional image recognition model and the actual marking result is the same as the calculation formula of the infrared image recognition model, which will not be repeated here. The evaluation method of the stability of the conventional image recognition model is the same as that of the infrared image recognition model, which will not be repeated here. The effect of using a single model and multiple models working together can be compared to evaluate the contribution of the fusion of conventional image recognition models and infrared image recognition models in improving the efficiency of nighttime livestock recognition. The recognition results of the conventional image recognition model and the infrared image recognition model can be fused by weighted average to improve the contribution of multi-model fusion in improving the efficiency of nighttime livestock recognition.
[0072] In this way, we can not only evaluate the accuracy and stability of livestock population identification using a single model, but also further improve the efficiency of livestock population identification at night by fusing multiple models based on a single model.
[0073] In some optional embodiments, identifying livestock individuals includes: identifying livestock individuals based on multiple models to obtain multiple initial identification results; calculating evaluation indicators of multiple models based on the number of marked livestock and the multiple initial identification results, the evaluation indicators including at least one of the following: accuracy, precision and recall; setting the initial weight of each model based on the evaluation indicator of each model; if the initial identification result of the target model in the multiple models is significantly different from the initial identification results obtained by other models, adjusting the initial weight of the target model, and obtaining the identification result of the livestock individual based on the initial identification result of the target model, the adjusted weight of the target model, the initial identification results of other models and the initial weights with other models. Wherein, if the identification results obtained by the target model and other models mentioned in the present application are significantly different, it means that the statistical characteristics of the identification results obtained by the target model exceed a certain threshold compared with the statistical characteristics of other models.
[0074] In this embodiment, livestock individuals in the first image sequence are identified based on multiple models, and the initial weight of each model is set based on the evaluation index of each model. The initial weight is based on the performance of the model in the validation set, such as the accuracy or recall rate, and the model with better performance is set with a larger weight in the fusion process. If there is a significant difference in the recognition results obtained by the target model and other models, the recognition results of the target model can be corrected by the recognition results of multiple other models, which can be achieved by adjusting the initial weight of the target model, and the accuracy of the overall recognition can be improved.
[0075] Specifically, when the recognition result of the target model for the target feature, such as a certain posture of livestock, is significantly different from that of other models, consider whether these differences are caused by the insufficient recognition ability of the target model on the target feature, and use the recognition results of other models to correct the recognition results of the target model. First, obtain the recognition results of other models. Second, compare the recognition results of the target model with the recognition results of other models to evaluate the differences and consistency between the two. Third, based on the results of the comparison, determine the correction strategy, and a simple voting mechanism can be used, such as majority voting, or learning fusion. Fourth, according to the correction strategy, adjust or correct the recognition results of the target model, replace some prediction results, or adjust the probability of prediction or adjust the initial weight, etc. Fifth, verify the corrected results to ensure that the accuracy and reliability of the recognition of individual features are improved. The above process can also be iterated to further optimize the correction strategy. If the quality of the recognition result is not high, the above process can be repeated to adjust or correct the verification until the expected goal is achieved.
[0076] In this way, not only the performance differences of each model are taken into account, but also the complementarity and advantages between models are fully utilized, thereby improving the success rate and reliability of recognition. In the case of mutual correction between models, it is necessary to ensure that each model is independent of each other to avoid introducing additional bias. The selection of fusion strategy and the setting of weights can be adjusted and optimized based on specific application scenarios and requirements to achieve the best recognition effect. In practical applications, factors such as computing resources and time costs can be considered to ensure the efficiency and practicality of the fusion process.
[0077] Figure 5 Another schematic diagram of the process of the method for determining the number of livestock provided by an embodiment of the present invention is shown. Figure 5As shown, S601: environmental detection. S602: determine whether the lighting conditions are insufficient. If the lighting conditions are sufficient, turn on S603: normal mode; if the lighting conditions are insufficient, turn on S604: infrared mode. S605: acquire infrared images. S606: image preprocessing. S607: multimodal recognition, which can enable livestock individual recognition for each model. S608: infrared feature extraction. S609: fusion of recognition results of multiple models. S610: output recognition results. S611: record to database.
[0078] In some optional embodiments, the aforementioned method for determining the number of livestock further includes: video data acquisition and preprocessing, acquiring the original video data of the livestock, decoding the video, and ensuring that the video data is readable; video frame extraction, which can use video processing technology, such as a cross-platform computer vision library (OpenCV), etc., to divide the video into separate static images by frame to ensure consistent video frame rate for subsequent analysis; frame sequence division and storage, which can save each frame of the image in chronological order as an independent file, such as PNG or LPEG, and record the timestamp of each frame of the image in the original video, and may create metadata containing the frame sequence number and the corresponding timestamp. File; Image database construction, create an image database table structure, including fields such as image ID, image path, associated pig ID and timestamp, etc., set a unique identifier for each livestock individual, and the information will be stored in the database when the livestock individual enters the database, and generate a unique ID in the system at the same time. The ID can ensure uniqueness, such as UUID or snowflake ID, etc., and batch import each frame of image and its corresponding timestamp information into the image database; Spatiotemporal trajectory record generation, based on the timestamp information of the frames in the database, construct a behavior trajectory model for livestock individuals, analyze the position changes or other feature changes between consecutive frames, and form a behavior trajectory record of livestock in spatial and temporal dimensions. By analyzing the position changes or other feature changes between consecutive frames, such as speed or acceleration, the behavior patterns of livestock can be more carefully portrayed, and subtle changes in livestock behavior, such as short stays or rapid movements, can be captured. These changes are crucial to understanding the physiological and psychological state of livestock. At the same time, by comparing the behavior trajectories of different time periods, the periodicity or regularity of livestock behavior can also be discovered.
[0079] Figure 6 Figure 2 shows a schematic diagram of livestock individual behavior trajectory recording. Figure 6 As shown, the position changes of livestock A at different time points can be obtained, thereby inferring the possible behavior pattern of livestock A. For example, if the distance from V2 to V3 is far and the speed is fast, it may mean that livestock A moved or ran quickly in the time period from T1 to T2.
[0080] Recording the behavioral trajectories of individual livestock in both space and time can form a comprehensive behavioral data set. Multi-dimensional data recording not only provides a detailed description of livestock behavior, but also facilitates various complex data analysis and pattern recognition. These data can be used to identify specific behaviors of livestock, such as foraging, resting, or socializing, and analyze the correlation and influencing factors between different behaviors. This can more accurately determine the number of livestock. While determining the number of livestock, it can also more accurately understand the behavioral patterns of livestock, which can provide strong data support for breeding management and disease prevention and control.
[0081] Figure 7 Another schematic diagram of the process of the method for determining the number of livestock provided by an embodiment of the present invention is shown. Figure 7 As shown, S701: obtain video files, collect all-weather video data containing livestock activities, including image sequences under different time periods and different lighting conditions. S702: video data import. S703: video data segmentation, divide the video data into single frames and frame sequences, and transfer them to S704: single-frame image sequences, import them into the image database construction module, and generate spatiotemporal trajectory records of individual livestock behaviors. The spatiotemporal trajectory records of livestock are generated by processing the following steps. Video data import, such as mp4 or .avi formats, read video files, and prepare for subsequent processing. Video data segmentation, input the original video data stream, divide the video into single-frame images according to time intervals, such as 1 frame per second or 1 frame every few seconds, and output single-frame image sequences. S705: frame sequence import, input single-frame image sequences, and import single-frame images into the image database construction module. Output result S707: frame index or reference in the database. S706: Image preprocessing, input a single frame image, perform preprocessing operations such as denoising, enhancement or binarization on the image to facilitate subsequent pig detection and tracking. S709: Output the preprocessed image. S708: Individual livestock detection, input the preprocessed image, and then use a deep learning model, such as a target detection model, to detect individual livestock in the image. S711: Obtain its position information, such as a bounding box; generate the position information of the individual livestock, that is, the bounding box coordinates. S710: Livestock tracking, input the livestock position information in continuous frames, and then track the movement trajectory of the livestock by comparing the position changes of the livestock in adjacent frames, using a tracking algorithm, such as a Kalman filter or an optical flow method, etc. S712: Generate the spatiotemporal trajectory data of the livestock, such as the ID, position coordinates and timestamp of each pig. Obtain S713: Spatiotemporal trajectory record file or database entry.
[0082] Spatiotemporal trajectory record, input the spatiotemporal trajectory data of the pigs, then organize the trajectory data into a format that is easy to query and analyze (such as CSV file or database record), and output the spatiotemporal trajectory record file or database entry.
[0083] In this embodiment, a device for determining the number of livestock is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceived.
[0084] Figure 8 The schematic diagram of the structure of the device for determining the number of livestock in this embodiment is shown. This embodiment provides a device for determining the number of livestock, such as Figure 8 As shown, including:
[0085] The image acquisition module 801 is used to acquire a first image sequence in a preset area if the light intensity is lower than a preset light threshold.
[0086] The first determination module 802 is used to extract infrared features from images in the first image sequence, perform infrared target detection on the first image sequence based on the extracted infrared features, and identify individual livestock within a preset area, location information of individual livestock, and the first number of livestock based on the results of the infrared target detection.
[0087] The updating module 803 is used to determine whether the individual livestock is still in the preset area based on the position information of the individual livestock in the adjacent image frames, and update the first livestock quantity based on the determination result.
[0088] In some optional implementations, the first determining module 802 includes:
[0089] The first unit of the first determination module is used to detect local feature points based on scaling the images in the first image sequence, and extract local feature descriptors in the neighborhood of the local feature points; match feature points between different frame images based on the local feature descriptors to obtain corner point features of the target; obtain the gradient of the image in a first direction based on the images in the first image sequence, obtain the gradient of the image in a second direction, and obtain the edge feature of the image based on the gradient in the first direction and the gradient in the second direction, wherein the first direction is perpendicular to the second direction; calculate the grayscale distribution of image pixels in the first image sequence to obtain texture features of the images in the first image sequence; and extract contours based on the images in the first image sequence to obtain shape features of the target.
[0090] In some optional embodiments, the aforementioned device for determining the number of livestock further comprises:
[0091] The conventional recognition module is used to obtain a second image sequence within a preset area if the light intensity is higher than or equal to a preset light threshold; perform target detection on the images in the second image sequence, and based on the target detection results, identify the livestock individuals, the location information of the livestock individuals, and the second livestock quantity within the preset area; based on the location information of the livestock individuals in adjacent frames of the image, determine whether the livestock individuals are still within the preset area, and update the second livestock quantity based on the determination result.
[0092] In some optional implementations, the first determining module 802 further includes:
[0093] The second unit of the first determination module is used to train an infrared classifier based on the extracted infrared features; perform infrared target detection based on the trained infrared classifier to identify individual livestock.
[0094] In some optional implementations, the second unit of the first determination module includes:
[0095] The first subunit of the second unit of the first determination module is used to extract thermal contrast features of the image and normalize the extracted thermal contrast features; train an infrared classifier based on the normalized data; evaluate the performance of the infrared classifier, and adjust the performance of the infrared classifier based on the evaluation results to obtain a trained infrared classifier.
[0096] In some optional embodiments, the aforementioned device for determining the number of livestock further comprises:
[0097] An evaluation module is used to mark the number of livestock in images in the first image sequence to obtain the number of marked livestock; for the images in the first image sequence, based on the number of marked livestock corresponding to the images and the first number of livestock determined by identification, calculate the accuracy and / or precision and / or recall rate of the livestock number results obtained under the condition that the light intensity is lower than a preset light threshold; based on the calculation results, determine the stability of the livestock number determination method under the condition that the light intensity is lower than the preset light threshold.
[0098] In some optional embodiments, the evaluation module includes:
[0099] An evaluation unit is used to identify livestock individuals based on multiple models to obtain multiple initial identification results; based on the number of marked livestock and the multiple initial identification results, calculate evaluation indicators of the multiple models, the evaluation indicators including at least one of the following: accuracy, precision and recall; based on the evaluation indicator of each model, set the initial weight of each model; if the initial identification result of a target model in the multiple models is significantly different from the initial identification results obtained by other models, adjust the initial weight of the target model, and obtain the identification result of the livestock individual based on the initial identification result of the target model, the adjusted weight of the target model, the initial identification results of other models and the initial weights with other models.
[0100] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0101] The device for determining the number of livestock in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0102] The embodiment of the present invention also provides a computer device having the above Figure 8 An apparatus for determining the number of livestock is shown.
[0103] See also Fig. 9 , Fig. 9 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Fig. 9 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Fig. 9 A processor 10 is taken as an example.
[0104] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include a hardware chip. The hardware chip may be a dedicated integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable gate array, a general purpose array logic or any combination thereof.
[0105] The aforementioned memory 20 stores instructions executable by at least one processor 10, so that the aforementioned at least one processor 10 executes the method shown in the above embodiment.
[0106] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0107] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0108] The computer device also includes an input device 30 and an output device 40. The processor 10, the memory 20, the input device 30 and the output device 40 may be connected via a bus or other means. Figure 8 The example of connecting through bus is taken in the following.
[0109] The input device 30 can receive input digital or character information, and generate key signal input related to the user settings and function control of the computer device, such as a touch screen, a keypad, a mouse, a track pad, a touch pad, an indicator bar, one or more mouse buttons, a trackball, a joystick, etc. The output device 40 may include a display device, an auxiliary lighting device (e.g., an LED) and a tactile feedback device (e.g., a vibration motor), etc. The above-mentioned display device includes but is not limited to a liquid crystal display, a light emitting diode, a display and a plasma display. In some optional embodiments, the display device can be a touch screen.
[0110] The embodiment of the present invention also provides a computer-readable storage medium. The method according to the embodiment of the present invention can be implemented in hardware, firmware, or can be implemented as a computer code that can be recorded in a storage medium, or can be implemented as a computer code that is originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium through a network download, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller, or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor, or hardware, the method shown in the above embodiment is implemented.
[0111] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of the computer program instruction in a computer-readable medium includes, but is not limited to, a source file, an executable file, an installation package file, etc., and accordingly, the way in which the computer program instruction is executed by the computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable storage medium or communication medium accessible to the computer.
[0112] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for determining the number of livestock, characterized in that The method comprises: If the light intensity is lower than a preset light threshold, acquiring a first image sequence within a preset area; Extracting infrared features from the images in the first image sequence, performing infrared target detection on the images in the first image sequence based on the extracted infrared features, and identifying individual livestock within the preset area, location information of the individual livestock, and the first number of livestock based on the results of the infrared target detection; Based on the position information of the individual livestock in adjacent frames of the image, it is determined whether the individual livestock is still within the preset area, and the first livestock quantity is updated based on the determination result.
2. The method according to claim 1, characterized in that The step of extracting infrared features from the images in the first image sequence comprises at least one of the following: Based on performing a scale transformation on the images in the first image sequence, local feature points are detected, and local feature descriptors are extracted in the neighborhood of the local feature points; feature points between different frame images are matched based on the local feature descriptors to obtain corner point features of the target; Based on an image in the first image sequence, obtaining a gradient of the image in a first direction, obtaining a gradient of the image in a second direction, and obtaining an edge feature of the image based on the gradient in the first direction and the gradient in the second direction, wherein the first direction is perpendicular to the second direction; Calculating the grayscale distribution of image pixels in the first image sequence to obtain texture features of the images in the first image sequence; and Contour extraction is performed based on the images in the first image sequence to obtain shape features of the target.
3. The method according to claim 1 or 2, characterized in that: The method further comprises: If the illumination intensity is higher than or equal to the preset illumination threshold, acquiring a second image sequence within the preset area; Performing target detection on the images in the second image sequence, and identifying the livestock individuals, the location information of the livestock individuals, and the number of the second livestock within the preset area based on the target detection result; Based on the position information of the individual livestock in adjacent frames of the image, it is determined whether the individual livestock is still within the preset area, and the second livestock quantity is updated based on the determination result.
4. The method according to claim 1, characterized in that: Performing infrared target detection on the images in the first image sequence based on the extracted infrared features, and identifying livestock individuals in the preset area based on the results of the infrared target detection, including: Based on the extracted infrared features, training an infrared classifier; The infrared target detection is performed based on the trained infrared classifier to identify the individual livestock.
5. The method according to claim 4, characterized in that The step of training an infrared classifier based on the extracted infrared features comprises: Extracting thermal contrast features of the image, and normalizing the extracted thermal contrast features; Based on the normalized data, train the infrared classifier; The performance of the infrared classifier is evaluated, and the performance of the infrared classifier is adjusted based on the evaluation result to obtain the trained infrared classifier.
6. The method according to claim 4, characterized in that The method further comprises: marking the number of livestock on the images in the first image sequence to obtain the number of marked livestock; For an image in the first image sequence, based on the number of marked livestock corresponding to the image and the first number of livestock determined by identification, calculating the accuracy and / or precision and / or recall of the livestock number result obtained under the condition that the light intensity is lower than the preset light threshold; Based on the calculation results, the stability of the method for determining the number of livestock when the light intensity is lower than the preset light threshold is determined.
7. The method according to claim 6, characterized in that The identifying of the livestock individuals comprises: Identify the livestock individuals based on multiple models to obtain multiple initial identification results; Based on the number of marked livestock and the plurality of initial identification results, calculating evaluation indicators of the plurality of models, the evaluation indicators comprising at least one of the following: accuracy, precision and recall; Based on the evaluation indicators of each model, set the initial weight of each model; If the initial recognition result of the target model among the multiple models is significantly different from the initial recognition results obtained by other models, the initial weight of the target model is adjusted, and the recognition result of the individual livestock is obtained based on the initial recognition result of the target model, the adjusted weight of the target model, the initial recognition results of the other models and the initial weights of the other models.
8. A device for determining the number of livestock, characterized in that The device comprises: An image acquisition module, configured to acquire a first image sequence within a preset area if the light intensity is lower than a preset light threshold; a first determination module, configured to extract infrared features from images in the first image sequence, perform infrared target detection on the first image sequence based on the extracted infrared features, and identify livestock individuals in the preset area, location information of the livestock individuals, and the first livestock quantity based on the result of the infrared target detection; An updating module is used to determine whether the individual livestock is still within the preset area based on the position information of the individual livestock in adjacent image frames, and to update the first livestock quantity based on the determination result.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the method for determining the number of livestock according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions for causing a computer to execute the method for determining the number of livestock according to any one of claims 1 to 7.
Citation Information
Patent Citations
Livestock and poultry statistical method and device, electronic equipment and medium
CN115760904A
Infrared pig instance segmentation method and system based on deep learning
CN117409409A
Cited By
System and method for evaluating health status of poultry bred under forest
CN120226999A
Livestock intelligent filing method, device and system based on RFID tag
CN120851055A
Intelligent counting and weight detecting method and device for livestock
CN121438175A
