Pig farm intelligent inspection method and system based on image processing

By using depth cameras and convolutional neural networks in pig farms to build behavior recognition models, it solves the problem that existing technology cannot monitor pig growth and feeding conditions in real time, and achieves comprehensive monitoring of pig health and environment. Improved the automation and intelligence level of the farm.

CN118628951APending Publication Date: 2024-09-10INSTITUTE OF ANIMAL SCIENCES OF CHINESE ACADEMY OF AGRICULTURAL SCIENCES

Patent Information

Application Number
CN202410645337.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-05-23
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

The inspection process of existing pig farms cannot be reasonably controlled based on the daily behavior of pigs, resulting in poor energy conservation and the inability to monitor pig growth and feeding conditions in real time. This increases food safety hazards and unnecessary capital investment, and reduces the cost of breeding. Profit and effectiveness of smart farms.

Method used

An intelligent inspection method based on image processing is used to obtain video images through a depth camera, conduct pre-processing and convolutional neural network training, build a behavior recognition model, detect the biological status of pigs in real time, and provide early warning and feedback.

Benefits of technology

By combining convolutional neural networks and long-short-term memory networks, spatio-temporal information is captured, improving the accuracy and reliability of intelligent inspections, achieving comprehensive monitoring of pig health and environmental conditions, and improving the automation and intelligence level of farms. .

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118628951A
    Figure CN118628951A
Patent Text Reader

Abstract

The invention discloses a pig farm intelligent inspection method and system based on image processing, and belongs to the technical field of image recognition, and the method comprises the steps: carrying out the photographing of a pig farm through a depth camera, and obtaining a pig farm video image; preprocessing the pig farm video image to obtain a to-be-calculated data set; constructing an improved convolutional neural network, and training the improved convolutional neural network to obtain a behavior recognition model; inputting the to-be-calculated data set into the behavior recognition model for calculation to obtain a live pig behavior result; and detecting the biological state of the pig farm based on the live pig behavior recognition result. According to the method, the LSTM and the CNN are used as knowledge distillation models, so that fusion of multi-modal data can be realized, namely, image data and time sequence data are combined. Therefore, the state of the pig farm can be more comprehensively understood, and the capability of monitoring pig health and environmental conditions is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image recognition, and in particular relates to an intelligent inspection method and system for pig farms based on image processing. Background Art

[0002] In recent years, my country's breeding and animal husbandry industries have experienced rapid development and are moving towards the transformation of modern animal husbandry. However, with the expansion of the scale of the breeding industry, traditional manual monitoring, feeding and feeding methods can no longer meet the needs of efficient breeding. Modern and scientific pig breeding models are gradually being promoted and applied. my country's breeding industry has shifted to a modern, intensive, standardized and large-scale mode, but my country's current breeding monitoring methods are mostly manual monitoring, which is time-consuming and prone to fatigue. The development of the times has put forward higher requirements for the development of China's breeding industry. Standardized, modernized, automated and intelligent pig farms can improve the success rate of re-breeding and are being vigorously promoted.

[0003] However, the current inspection process of pig farms cannot make reasonable control based on the daily behavior of pigs to achieve energy-saving effects. It is also impossible to make scientific and reasonable judgments on the growth and feeding conditions of pigs in real time. Moreover, due to the reduction of manpower, large farms are even less able to monitor the body of pigs in real time, resulting in the situation where one sick pig can infect many pigs, increasing food safety risks and unnecessary capital investment, thereby reducing breeding profits and the effect of smart farms. Summary of the invention

[0004] In order to solve the above technical problems, the present invention proposes an intelligent inspection method and system for pig farms based on image processing to solve the problems existing in the above-mentioned prior art.

[0005] To achieve the above object, the present invention provides an intelligent inspection method for pig farms based on image processing, comprising:

[0006] The pig farm is photographed by a depth camera to obtain video images of the pig farm;

[0007] Preprocessing the pig farm video image to obtain a data set to be calculated;

[0008] Constructing an improved convolutional neural network, and training the improved convolutional neural network to obtain a behavior recognition model;

[0009] Inputting the data set to be calculated into the behavior recognition model for calculation to obtain pig behavior results;

[0010] The biological status of the pig farm is detected based on the pig behavior recognition results.

[0011] Preferably, the process of photographing the pig farm by a depth camera to obtain a video image of the pig farm includes:

[0012] Deploy depth cameras based on the pig farm environment;

[0013] Calibrate the depth camera and set the shooting resolution and depth perception range of the depth camera;

[0014] The pig farm is photographed in real time by the set depth camera to obtain the video image of the pig farm.

[0015] Preferably, the process of preprocessing the pig farm video image to obtain the data set to be calculated includes:

[0016] Cutting the continuous video stream in the pig farm video image to obtain a time segment video stream;

[0017] Performing denoising processing on each frame of the video stream in the time period to obtain a denoised image;

[0018] Extracting the depth distance of the depth camera to uniquely mark the organism and environment of the denoised image to obtain a marked image;

[0019] The labeled images are cleaned and screened to obtain the data set to be calculated.

[0020] Preferably, the process of constructing an improved convolutional neural network, training the improved convolutional neural network, and obtaining a behavior recognition model includes:

[0021] Obtaining a pig behavior sample set, and performing standardization processing on the pig behavior sample set to obtain a training set and a test set;

[0022] Constructing a long short-term memory network, inputting the training set into the long short-term memory network for forward propagation, and obtaining the output of the long short-term memory network;

[0023] Constructing a convolutional neural network, taking the output of the long short-term memory network as the input of the convolutional neural network, and then performing back propagation to obtain a student network model;

[0024] Constructing an attention mechanism module and a residual module, and introducing the attention mechanism module and the residual module into the student network model to generate an improved convolutional neural network;

[0025] Training the improved convolutional neural network using the training set to obtain a training model;

[0026] Training the training model using the test set to generate training results;

[0027] The training model is fine-tuned based on the training results to generate the behavior recognition model.

[0028] Preferably, the pig behavior sample set includes: the movements of the pig when it is sick, the movements of the pig when it is normal, the movements of the pig when it is eating, the movements of the sow when it is in estrus, the movements of the piglet when it is pressed, and the movements of the pig when it is sleeping.

[0029] Preferably, the process of training the improved convolutional neural network by using the training set to obtain the training model includes:

[0030] Using the training set to train the improved convolutional neural network, selecting a cross entropy loss function, and minimizing the cross entropy loss function through a stochastic gradient descent algorithm to obtain a stochastic gradient descent model;

[0031] The learning rate and the number of pooling layers of the stochastic gradient descent model are optimized to obtain the training model.

[0032] Preferably, the process of inputting the to-be-calculated data set into the behavior recognition model for calculation to obtain the pig behavior result includes:

[0033] Inputting the data set to be calculated into the behavior recognition model for calculation to generate a recognition result;

[0034] If the environment or the pig's state is abnormal in the recognition result, the frame image is fed back to the user and a pig behavior result report is generated;

[0035] Early warning and feedback are provided based on the pig behavior result report.

[0036] To achieve the above object, the present invention also provides an intelligent inspection system for pig farms based on image processing, comprising:

[0037] A camera module is used to shoot the pig farm through a depth camera to obtain video images of the pig farm;

[0038] A data processing module, used for preprocessing the pig farm video image to obtain a data set to be calculated;

[0039] A model building module, used to build an improved convolutional neural network, train the improved convolutional neural network, and obtain a behavior recognition model;

[0040] A calculation module, used for inputting the data set to be calculated into the behavior recognition model for calculation to obtain pig behavior results;

[0041] The detection module is used to detect the biological status of the pig farm based on the pig behavior recognition result.

[0042] Compared with the prior art, the present invention has the following advantages and technical effects:

[0043] The LSTM network of the present invention can capture the time series information of pigs in the pig farm, such as behavior patterns and changes in health status, while CNN can effectively extract spatial information in the image, such as the location, quantity and environmental conditions of the pigs. By combining the two, it is possible to comprehensively utilize spatiotemporal information to improve the accuracy and reliability of intelligent inspections. At the same time, LSTM and CNN, as knowledge distillation models, can realize the fusion of multimodal data, that is, combining image data and time series data. In this way, the status of the pig farm can be more comprehensively understood, and the monitoring ability of pig health and environmental conditions can be improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0045] Figure 1 This is a flow chart of an intelligent inspection method for pig farms based on image processing according to an embodiment of the present invention;

[0046] Figure 2 Schematic diagram of an intelligent pig farm inspection system based on image processing according to an embodiment of the present invention. DETAILED DESCRIPTION

[0047] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0048] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0049] Embodiment 1

[0050] like Figure 1 As shown, this embodiment provides a pig farm intelligent inspection method based on image processing, including:

[0051] The pig farm is photographed by a depth camera to obtain video images of the pig farm;

[0052] Selecting depth cameras that are suitable for the pig farm environment is the first priority. These cameras can provide depth information such as distance and shape of objects, rather than just images from ordinary cameras.

[0053] Depth cameras are installed at strategic locations on the pig farm to ensure that the entire area is covered and the required information is captured. This may require mounting on walls, brackets or other equipment.

[0054] Set the camera parameters such as shooting resolution, frame rate, depth perception range, etc. according to the specific needs of the pig farm.

[0055] Connect the camera to a power source and data storage device (such as a hard drive or cloud storage), and configure the device to ensure secure storage and management of data.

[0056] After installation, the depth camera is calibrated to ensure accurate distance measurement and clear image capture.

[0057] Preprocessing the pig farm video image to obtain a data set to be calculated;

[0058] Constructing an improved convolutional neural network, and training the improved convolutional neural network to obtain a behavior recognition model;

[0059] Inputting the data set to be calculated into the behavior recognition model for calculation to obtain pig behavior results;

[0060] The biological status of the pig farm is detected based on the pig behavior recognition results.

[0061] Specifically: collect image data of pig farms and annotate them to mark the location, number, behavior and other information of the pigs, as well as the environmental information of the pig farms.

[0062] The collected image data is preprocessed, including resizing, cropping, contrast enhancement and other operations, to improve the training effect of the convolutional neural network model.

[0063] Design and train a convolutional neural network model for tasks such as object detection and behavior analysis on pig farm images. You can use existing pre-trained models (such as YOLO, Faster R-convolutional neural network, etc.) and fine-tune them to suit the specific pig farm scenario.

[0064] Use the trained convolutional neural network model to perform target detection on images of pig farms and identify the location and number of pigs.

[0065] Based on the detected location and number of pigs, combined with time series information, the pigs' behavior patterns, such as drinking, eating, resting, etc., as well as abnormal behaviors or events are analyzed.

[0066] Analyze the pig farm environmental information in the image, such as temperature, humidity, light, etc., and monitor whether the environmental conditions are suitable for pig growth and health.

[0067] The convolutional neural network model is integrated into the intelligent monitoring system of the pig farm to monitor the status of the pig farm in real time, provide early warning and feedback based on the detection results, and handle abnormal situations in a timely manner.

[0068] Based on actual applications and feedback, the convolutional neural network model is continuously optimized to improve its performance and accuracy in order to enhance the effectiveness and reliability of the intelligent inspection system for pig farms.

[0069] To further optimize the scheme, the process of photographing the pig farm with a depth camera and obtaining the video image of the pig farm includes:

[0070] Deploy depth cameras based on the pig farm environment;

[0071] Calibrate the depth camera and set the shooting resolution and depth perception range of the depth camera;

[0072] The pig farm is photographed in real time by the set depth camera to obtain the video image of the pig farm.

[0073] Further optimizing the scheme, preprocessing the pig farm video image, and obtaining the data set to be calculated includes:

[0074] Cutting the continuous video stream in the pig farm video image to obtain a time segment video stream;

[0075] Performing denoising processing on each frame of the video stream in the time period to obtain a denoised image;

[0076] Extracting the depth distance of the depth camera to uniquely mark the organism and environment of the denoised image to obtain a marked image;

[0077] The labeled images are cleaned and screened to obtain the data set to be calculated.

[0078] Further optimizing the scheme, the process of constructing an improved convolutional neural network, training the improved convolutional neural network, and obtaining a behavior recognition model includes:

[0079] Obtaining a pig behavior sample set, and performing standardization processing on the pig behavior sample set to obtain a training set and a test set;

[0080] Constructing a long short-term memory network, inputting the training set into the long short-term memory network for forward propagation, and obtaining the output of the long short-term memory network;

[0081] Constructing a convolutional neural network, taking the output of the long short-term memory network as the input of the convolutional neural network, and then performing back propagation to obtain a student network model;

[0082] Constructing an attention mechanism module and a residual module, and introducing the attention mechanism module and the residual module into the student network model to generate an improved convolutional neural network;

[0083] Training the improved convolutional neural network using the training set to obtain a training model;

[0084] Training the training model using the test set to generate training results;

[0085] Based on the training results, the parameters of the training model are fine-tuned to generate the behavior recognition model. First, the training data and labels of the LSTM model need to be prepared. This can be sequence data, such as text, time series data or other continuous data.

[0086] Train an LSTM model using the prepared data to learn sequential patterns and long-term dependencies in the data. Ensure that the LSTM model achieves suitable performance on the training set.

[0087] After training is complete, extract the output of the LSTM model. This is usually the hidden state or cell state of the LSTM layer.

[0088] Use the output of the LSTM model as the input to the convolutional neural network. This may require some preprocessing of the LSTM output, such as adjusting the shape or adding additional dimensions, to fit the input requirements of the convolutional neural network.

[0089] Build a convolutional neural network model based on task requirements and data characteristics. This includes selecting appropriate convolutional layers, pooling layers, activation functions, and other layer designs.

[0090] Feed the output of the LSTM as input to a convolutional neural network model. This typically involves concatenating or stacking the LSTM output with the convolutional neural network input to form a complete model.

[0091] The convolutional neural network model that integrates the LSTM output is trained together with the labels to learn the feature representation and pattern recognition of the data. The training can be performed using the back-propagation algorithm.

[0092] Evaluate the performance of the ensemble model using a validation or test set to ensure its generalization ability on unseen data.

[0093] To further optimize the solution, the pig behavior sample set includes: the movements of the pig when it is sick, the movements of the pig when it is normal, the movements of the pig when it is eating, the movements of the sow when it is in estrus, the movements of the piglet when it is pressed, and the movements of the pig when it is sleeping.

[0094] Further optimizing the scheme, the improved convolutional neural network is trained by the training set, and the process of obtaining the training model includes:

[0095] Using the training set to train the improved convolutional neural network, selecting a cross entropy loss function, and minimizing the cross entropy loss function through a stochastic gradient descent algorithm to obtain a stochastic gradient descent model;

[0096] The expression of the stochastic gradient descent algorithm is:

[0097] [\theta_{t+1}=\theta_t-\eta\cdot\nablaJ(\theta_t)]

[0098] in:

[0099] (\theta_t) represents the value of the model parameters at the (t)th iteration.

[0100] (\eta) represents the learning rate, which is used to control the step size of each parameter update.

[0101] (J(\theta_t)) represents the gradient of the loss function with respect to the model parameters (\theta_t).

[0102] (\nablaJ(\theta_t)) represents the gradient of the loss function, that is, the partial derivative with respect to the parameter (\theta_t).

[0103] The learning rate and the number of pooling layers of the stochastic gradient descent model are optimized to obtain the training model. Specifically:

[0104] First, according to experience or benchmark models, set the initial learning rate and the number and type of pooling layers. Usually, a smaller value can be selected for the initial learning rate, while the number and type of pooling layers can be set according to the complexity of the problem and the characteristics of the data set.

[0105] The model is trained using the initially set learning rate and number of pooling layers. During the training process, the performance of the model on the validation set is monitored and the changes in the loss function are recorded.

[0106] Dynamically adjust the learning rate based on the performance of the model on the validation set. If the model does not perform well on the validation set, try increasing the learning rate to speed up the convergence of the model; if the model performs well on the validation set, try decreasing the learning rate to prevent the model from oscillating around the local optimum.

[0107] Adjust the number and type of pooling layers based on the performance of the model on the validation set. You can try increasing or decreasing the number of pooling layers, or try different types of pooling layers (such as maximum pooling, average pooling, etc.) to find the best model structure.

[0108] Further optimizing the scheme, the data set to be calculated is input into the behavior recognition model for calculation, and the process of obtaining the pig behavior results includes:

[0109] Inputting the data set to be calculated into the behavior recognition model for calculation to generate a recognition result;

[0110] If the environment or the pig's state is abnormal in the recognition result, the frame image is fed back to the user and a pig behavior result report is generated;

[0111] Early warning and feedback are provided based on the pig behavior result report.

[0112] Embodiment 1

[0113] like Figure 2 As shown, this embodiment provides a pig farm intelligent inspection system based on image processing, including:

[0114] A camera module is used to shoot the pig farm through a depth camera to obtain video images of the pig farm;

[0115] A data processing module, used for preprocessing the pig farm video image to obtain a data set to be calculated;

[0116] A model building module, used to build an improved convolutional neural network, train the improved convolutional neural network, and obtain a behavior recognition model;

[0117] A calculation module, used for inputting the data set to be calculated into the behavior recognition model for calculation to obtain pig behavior results;

[0118] The detection module is used to detect the biological status of the pig farm based on the pig behavior recognition result.

[0119] The above are only preferred specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. An intelligent inspection method for pig farms based on image processing, characterized in that: The following steps are involved: The pig farm is photographed by a depth camera to obtain video images of the pig farm; Preprocessing the pig farm video image to obtain a data set to be calculated; Constructing an improved convolutional neural network, and training the improved convolutional neural network to obtain a behavior recognition model; Inputting the data set to be calculated into the behavior recognition model for calculation to obtain pig behavior results; The biological status of the pig farm is detected based on the pig behavior recognition results.

2. The intelligent inspection method for pig farms based on image processing according to claim 1 is characterized in that: The process of photographing the pig farm by using a depth camera to obtain a video image of the pig farm includes: Deploy depth cameras based on the pig farm environment; Calibrate the depth camera and set the shooting resolution and depth perception range of the depth camera; The pig farm is photographed in real time by the set depth camera to obtain the video image of the pig farm.

3. The intelligent inspection method for pig farms based on image processing according to claim 1 is characterized in that: The process of preprocessing the pig farm video image to obtain the data set to be calculated includes: Cutting the continuous video stream in the pig farm video image to obtain a time segment video stream; Performing denoising processing on each frame of the video stream in the time period to obtain a denoised image; Extracting the depth distance of the depth camera to uniquely mark the organism and environment of the denoised image to obtain a marked image; The labeled images are cleaned and screened to obtain the data set to be calculated.

4. The intelligent inspection method for pig farms based on image processing according to claim 1 is characterized in that: The process of constructing an improved convolutional neural network, training the improved convolutional neural network, and obtaining a behavior recognition model includes: Obtaining a pig behavior sample set, and performing standardization processing on the pig behavior sample set to obtain a training set and a test set; Constructing a long short-term memory network, inputting the training set into the long short-term memory network for forward propagation, and obtaining the output of the long short-term memory network; Constructing a convolutional neural network, taking the output of the long short-term memory network as the input of the convolutional neural network, and then performing back propagation to obtain a student network model; Constructing an attention mechanism module and a residual module, and introducing the attention mechanism module and the residual module into the student network model to generate an improved convolutional neural network; Training the improved convolutional neural network using the training set to obtain a training model; Training the training model using the test set to generate training results; The training model is fine-tuned based on the training results to generate the behavior recognition model.

5. The intelligent inspection method for pig farms based on image processing according to claim 4 is characterized in that: The pig behavior sample set includes: the movements of a sick pig, the movements of a normal pig, the movements of a pig while eating, the movements of a sow in estrus, the movements of a piglet when being pressed, and the movements of a pig while sleeping.

6. The intelligent inspection method for pig farms based on image processing according to claim 4 is characterized in that: The process of training the improved convolutional neural network by using the training set to obtain the training model includes: Using the training set to train the improved convolutional neural network, selecting a cross entropy loss function, and minimizing the cross entropy loss function through a stochastic gradient descent algorithm to obtain a stochastic gradient descent model; The learning rate and the number of pooling layers of the stochastic gradient descent model are optimized to obtain the training model.

7. The intelligent inspection method for pig farms based on image processing according to claim 1 is characterized in that: The process of inputting the data set to be calculated into the behavior recognition model for calculation to obtain the pig behavior result includes: Inputting the data set to be calculated into the behavior recognition model for calculation to generate a recognition result; If the environment or the pig's state is abnormal in the recognition result, the frame image is fed back to the user and a pig behavior result report is generated; Early warning and feedback are provided based on the pig behavior result report.

8. An intelligent inspection system for pig farms based on image processing, characterized in that: include: A camera module is used to shoot the pig farm through a depth camera to obtain video images of the pig farm; A data processing module, used for preprocessing the pig farm video image to obtain a data set to be calculated; A model building module, used to build an improved convolutional neural network, train the improved convolutional neural network, and obtain a behavior recognition model; A calculation module, used for inputting the data set to be calculated into the behavior recognition model for calculation to obtain pig behavior results; The detection module is used to detect the biological status of the pig farm based on the pig behavior recognition result.

Citation Information

Patent Citations

  • Analysis method for detecting group pig attack behaviors by adopting convolutional neural network and long-term and short-term memory

    CN111160422A

  • Pig ingestion monitoring method and device

    CN112931289A

  • Live pig aggressive behavior identification method based on double-flow convolutional neural network

    CN117671793A

  • Main shaft protection monitoring system for phase modifier unit

    CN117748741A

Cited By

  • Pig health assessment method based on rail-mounted inspection robot

    WO2026061014A1