A visually assisted detection method for the health status of large-scale chicken farming
By applying technical means such as connected domain analysis, edge irregularity coefficient and adhesion index in a large-scale chicken breeding environment, the problem of inaccurate segmentation of individual chickens in the existing technology has been solved, and the accuracy of health status detection has been improved.
Patent Information
- Application Number
- CN202411514977.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-29
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-10-29
AI Technical Summary
The existing image segmentation method is difficult to accurately identify a single chicken in chicken-scale breeding environment, resulting in a low accuracy in health status detection.
By collecting chicken coop videos, frame differentiation and gray image processing are performed, and technical means such as connecting domain analysis, edge irregular coefficients, light flow estimates and adhesion indexes, the chicken group area is selected and separated from individual chicken individual areas.
The individual segmentation accuracy of chickens in high -density breeding environments is improved, and the accuracy of chicken healthy state detection is enhanced.
Smart Images

Figure CN119027984B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image segmentation and processing, and in particular to a method for visually assisting detection of the health status of large-scale chicken farming. Background Art
[0002] The poultry industry is a traditional industry in animal husbandry and occupies an important position in my country's animal husbandry. The large-scale breeding of poultry has not only improved the breeding efficiency, but also reduced the breeding cost to a certain extent. However, the disease problem has always been one of the important factors restricting the development of the poultry industry. At present, common diseases of chickens include foot pad dermatitis, avian influenza, Newcastle disease and parasitic diseases. Sick chickens often show changes in appearance, posture, behavior, feces, body temperature and other aspects.
[0003] At present, detecting the health status of chickens through machine vision has become a mainstream detection method. However, the existing image detection methods usually detect individual chickens when detecting chickens. In a large-scale breeding environment, the number of chickens is huge and there are occlusions between them. The existing image segmentation method is difficult to accurately identify a single chicken, and the segmentation effect is poor, resulting in low accuracy in detecting the health status of chickens. Summary of the invention
[0004] In order to solve the above technical problems, the present application provides a visually assisted detection method for the health status of large-scale chicken farming to solve the existing problems.
[0005] The present invention discloses a visually assisted detection method for the health status of chickens in large-scale farming, which adopts the following technical scheme:
[0006] An embodiment of the present application provides a visually assisted detection method for the health status of chickens in large-scale farming, the method comprising the following steps:
[0007] S1, collect and decompose the chicken house detection video to obtain the grayscale image of each frame of the chicken house;
[0008] S2, performing connected domain analysis on the grayscale image of the chicken house to obtain each connected domain; obtaining the edge irregularity coefficient of each connected domain according to the difference in the grayscale change direction of the edge pixel points of each connected domain; obtaining the corner points in each frame of the chicken house grayscale image; screening the chicken area according to the movement of the corner points in each connected domain in the adjacent frames of the chicken house grayscale image, the edge irregularity coefficient and the edge grayscale change;
[0009] S3, according to the difference between the shape of each chicken group area and the circle, obtain the adhesion index of each chicken group area; divide the adhesion chicken group area and the chicken individual area according to the numerical distribution of the adhesion index of all chicken group areas; according to the difference in texture and grayscale change direction within the local window of adjacent pixels on the edge of the adhesion chicken group area, divide the adhesion chicken group area into each sub-chicken group area;
[0010] S4, dividing each chicken group area into a number of chicken individual areas according to the adhesion index of each chicken group area; and performing health status detection on all chicken individual areas.
[0011] Furthermore, the method for obtaining the edge irregularity coefficient of each connected domain includes:
[0012] For each connected domain, the pixel points on the edge of the connected domain are recorded as edge pixel points; the gradient direction of each edge pixel point is obtained; the gradient direction difference between each edge pixel point and the edge pixel point closest to it is calculated; the average value of the gradient direction difference of all edge pixel points contained in the connected domain is recorded as the edge irregularity coefficient of each connected domain.
[0013] Further, the method for screening the chicken area comprises:
[0014] The optical flow estimation method is used to obtain the motion vector of each corner point in the grayscale image of the chicken house; the mean of the motion vectors of all corner points in each connected domain is calculated as the average movement coefficient of each connected domain;
[0015] For each connected domain, the average movement coefficient, edge irregularity coefficient and edge grayscale change of the connected domain are integrated to obtain the movement confidence of the connected domain;
[0016] The moving confidence of all connected domains in the grayscale image of the chicken house is analyzed by threshold to obtain the segmentation threshold; the connected domain with a moving confidence greater than or equal to the segmentation threshold is recorded as the chicken group area.
[0017] Furthermore, the method for obtaining the mobility confidence of the connected domain includes:
[0018] The mobility confidence of the connected domain is recorded as A. ; In the formula, is the average mobility coefficient of the connected domain; is the maximum value of the average moving coefficient of all connected domains; r is the edge irregularity coefficient of the connected domain, is the gray value variance of all edge pixels in the connected domain.
[0019] Further, the adhesion index of each chicken group area is obtained according to the difference between the shape of each chicken group area and the circle, including:
[0020] For each chicken flock area, the number of all pixels in the chicken flock area is obtained, recorded as the area S, and the number of pixels on the edge of the chicken flock area is obtained, recorded as the perimeter L; based on the numerical comparison of the area and perimeter of the chicken flock area, the circular similarity factor of the chicken flock area is obtained;
[0021] Obtain the minimum bounding rectangle of each chicken group area, and record the absolute value of the difference between the area of each chicken group area and the number of all pixels in its minimum bounding rectangle as the bounding rectangle difference of each chicken group area;
[0022] The ratio of the normalized value of the circumscribed rectangle difference of each chicken group area to the circular similarity factor was taken as the adhesion index of each chicken group area.
[0023] Furthermore, the method for obtaining the circular similarity factor of the chicken flock area includes: recording the circular similarity factor of the chicken flock area as f, ; Where S is the area of the chicken area; L is the perimeter of the chicken area; is the ratio of pi.
[0024] Further, the method of dividing the adhesion chicken group area and the chicken individual area according to the numerical distribution of the adhesion index of all chicken group areas includes:
[0025] Threshold analysis was performed on the adhesion index of all chicken flock areas to obtain the adhesion threshold. The chicken flock areas with adhesion index greater than the adhesion threshold were recorded as adhesion chicken flock areas; and the chicken flock areas with adhesion index less than or equal to the adhesion threshold were recorded as individual chicken areas.
[0026] Furthermore, the method of segmenting the adhesion chicken group area into sub-chicken group areas according to the difference in texture and grayscale change direction in the local window of adjacent pixels on the edge of the adhesion chicken group area includes:
[0027] For each adhesion chicken group area, a pixel window of a preset size is constructed with each edge pixel point of the adhesion chicken group area as the center; the texture feature of the pixel window is obtained; the gradient direction of each pixel point in the pixel window is obtained; the variance of the gradient direction of all pixel points in the pixel window with each edge pixel point as the direction difference within the window of each edge pixel point is recorded;
[0028] The concave point confidence of each edge pixel is obtained according to the texture features of each edge pixel and the direction difference within the window;
[0029] Calculate the sum of the concave point confidences of any two edge pixels, recorded as the first sum value; calculate the maximum value difference of the gradient direction of all pixels in the pixel window of the any two edge pixels; take the difference between the maximum value difference and the first sum value as the corresponding concave point confidence between the any two edge pixels; record the two edge pixels with the largest corresponding concave point confidences in the adhesion chicken group area as the two segmentation concave points of the adhesion chicken group area;
[0030] Connect the two segmentation concave points of the adhesion chicken group area and divide the adhesion chicken group area into two sub-chicken group areas.
[0031] Further, the concave point confidence of each edge pixel point is obtained according to the texture feature of each edge pixel point and the direction difference within the window, including:
[0032] Let the concave point confidence of the vth edge pixel be , ; In the formula, is the direction difference within the window of the vth edge pixel; Respectively represent the maximum values of the gradient directions of all pixels in the pixel window centered on the vth and v-1th edge pixels; They represent the texture features of the pixel windows centered on the vth and v-1th edge pixels respectively.
[0033] Furthermore, the method divides each sub-chicken group area into a plurality of individual chicken areas according to the adhesion index of each sub-chicken group area, including: repeating the division operation of the adhesion chicken group area and the individual chicken area for each sub-chicken group area until the adhesion index of all sub-chicken group areas is less than or equal to the adhesion threshold, thereby obtaining all individual chicken areas.
[0034] This application has at least the following beneficial effects:
[0035] This application takes into account the interference problem caused by the complex background feature points in the frame grayscale image of the chicken house, and uses the movement characteristics of the chicken to obtain the edge irregularity coefficient through the change of pixels in adjacent frame images to distinguish the moving foreground from the fixed background and screen the chicken area; further considering the problem of chicken adhesion caused by high breeding density, the adhesion index is constructed through the shape of the chicken area to evaluate whether adhesion has occurred in the connected domain; further according to the adhesion index, the adhesion chicken area and the chicken individual area are divided; for the adhesion chicken area, the edge morphology of the chicken individual in the adhesion chicken area is analyzed, and the adhesion chicken area is divided into chicken individual areas layer by layer according to the texture and grayscale change direction differences at the edge of the adhesion chicken area. This application mainly improves the segmentation accuracy of individual chickens in breeding scene images under high-density breeding environments by extracting the adhesion connected domain and performing individual segmentation. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0037] Figure 1 A flowchart of the steps of a visually assisted detection method for the health status of large-scale chicken farming provided in this application;
[0038] Figure 2 A flowchart of a chicken screening method provided in accordance with an embodiment of the present application;
[0039] Figure 3 A schematic diagram of segmenting an area of adhering chickens is provided for one embodiment of the present application. DETAILED DESCRIPTION
[0040] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. In the absence of conflict, the embodiments of the present application and the technical features in the embodiments can be combined with each other. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0041] Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs.
[0042] The specific scheme of the visually assisted detection method for the health status of large-scale chicken farming provided by the present application is described in detail below with reference to the accompanying drawings.
[0043] An embodiment of the present application provides a visually assisted detection method for the health status of chickens in large-scale breeding. Specifically, the following visually assisted detection method for the health status of chickens in large-scale breeding is provided. Figure 1 , the method comprises the following steps:
[0044] S1, collect the chicken house detection video and decompose it to obtain the grayscale image of each frame of the chicken house.
[0045] A specific implementation scenario of the embodiment of the present application is an image segmentation scenario of a chicken house image in a farm. By connecting to a high-definition camera in a chicken house in a farm, a chicken house detection video is obtained, and the chicken house detection video is decomposed frame by frame, and a 1-second video is decomposed into h=20 frames of images. Then, each frame image is subjected to median filtering to eliminate noise in the image, and finally all frame images are converted into grayscale images to obtain grayscale images of each frame of the chicken house.
[0046] S2, performing connected domain analysis on the grayscale image of the chicken house to obtain each connected domain; obtaining the edge irregularity coefficient of each connected domain according to the difference in the grayscale change direction of the edge pixels of each connected domain; obtaining the corner points in each frame of the chicken house grayscale image; screening the chicken area according to the movement of the corner points in each connected domain in the adjacent frames of the chicken house grayscale image, the edge irregularity coefficient and the edge grayscale change.
[0047] In a real farming environment, factors that make it difficult to identify individual chickens include but are not limited to the following: the image feature points are complicated due to background elements such as feed troughs, drinking troughs, and feces, and the color of the chicken's feathers may be similar to the color of the surrounding environment. Therefore, in order to detect the health status of chickens, it is first necessary to accurately identify the individual chickens from the current image.
[0048] Although the color of the chicken's feathers may be similar to the color of the surrounding environment, considering that in the obtained video, except for the chickens that often move and change their positions, the positions of objects such as feeding troughs and drinking troughs are fixed and almost never change. Therefore, the moving foreground image and the fixed background image can be distinguished by the change of pixels in adjacent frame images.
[0049] Specifically, a connected domain analysis is performed on the grayscale image of the chicken house to obtain each connected domain; for each connected domain, the pixel points on the edge of the connected domain are recorded as edge pixel points; the gradient direction of each edge pixel point is obtained; the gradient direction difference between each edge pixel point and the edge pixel point closest to it is calculated; and the average value of the gradient direction difference of all edge pixel points contained in the connected domain is recorded as the edge irregularity coefficient of the connected domain.
[0050] Taking the i-th frame of the chicken coop grayscale image as an example, the i-th frame of the chicken coop grayscale image is used as input, the connected domain in the image is obtained by the connected domain extraction algorithm, and the gradient direction of each edge pixel is obtained by the Sobel operator. Among them, the difference in the gradient direction of each edge pixel point and the edge pixel point closest to it is the absolute value of the difference between the gradient direction of each edge pixel point and the edge pixel point closest to it in Euclidean distance. Among them, the connected domain analysis and the Sobel operator are well-known technologies, and the specific implementation process will not be repeated.
[0051] If the value of the edge irregularity coefficient is low, it means that the edge gradient changes smoothly and the edge is relatively regular, which is more likely to be a background connected domain such as a feeding trough or a drinking trough; if the value of the edge irregularity coefficient is high, it means that the edge changes irregularly and may be a chicken flock area.
[0052] Similarly, since the colors of a chicken's comb, tail, and claws are usually quite different and chickens have obvious motion characteristics in farming scenes, if a connected domain is a flock of chickens, the pixel values of the edge pixels of the connected domain will also be quite different.
[0053] For each frame of the chicken house grayscale image, corner point detection is performed on the chicken house grayscale image to obtain each corner point; the optical flow estimation method is used to obtain the motion vector of each corner point in the chicken house grayscale image.
[0054] Taking the i-th frame of the chicken house grayscale image as an example, the Harris corner detection algorithm is used to obtain the corner points in the image, and the i-th frame of the chicken house grayscale image and all the corner points in the previous frame of the chicken house grayscale image are used as input, and the KLT optical flow method is used to obtain the motion vector of each corner point in the i-th frame of the chicken house grayscale image; wherein, the KLT optical flow method and the Harris corner detection algorithm are well-known technologies, and the specific implementation process is not repeated here. The motion vector obtained by the KLT optical flow method is usually expressed as a two-dimensional vector, indicating displacement in the horizontal and vertical directions. It should be noted that the motion vector of each corner point in the first frame of the chicken house grayscale image is 0.
[0055] Calculate the mean of the motion vectors of all corner points in each connected domain as the average motion coefficient of each connected domain; for each connected domain, the average motion coefficient, edge irregularity coefficient and edge grayscale change of the connected domain are comprehensively considered to obtain the motion confidence of the connected domain;
[0056] Specifically, the mobility confidence of the connected domain is recorded as A, In the formula, is the average mobility coefficient of the connected domain; is the maximum value of the average moving coefficient of all connected domains; r is the edge irregularity coefficient of the connected domain, is the gray value variance of all edge pixels in the connected domain.
[0057] If the average movement coefficient of the connected domain is larger, it means that multiple corner points have moved in the connected domain, and the average movement distance is larger; It reflects the movement of the average movement coefficient of the connected domain relative to other connected domains in the grayscale image of the chicken house in the current frame. If the ratio is larger, it means that the movement of the connected domain is significant among all connected domains; if the edge irregularity coefficient of the connected domain is larger, it means that the edge change in the connected domain is more irregular, and the more it conforms to the characteristics of the chicken connected domain; if the gray value variance of all edge pixels in the connected domain is larger, it means that in the connected domain, the pixel value difference between each edge pixel is larger; the larger the final movement confidence, the greater the possibility that the connected domain is a moving chicken area.
[0058] Since the edge features and corner point movement between the background connected domain and the chicken area are very different, the foreground and background connected domains can be distinguished by the Otsu threshold method.
[0059] Therefore, this embodiment performs threshold analysis on the movement confidence of all connected domains in each frame of the chicken house grayscale image to obtain a segmentation threshold; the connected domain with a movement confidence greater than or equal to the segmentation threshold is recorded as the chicken flock area. Specifically, all movement confidences are used as inputs of the Otsu threshold method to output the segmentation threshold. The Otsu threshold method is a well-known technology, and the specific implementation process will not be repeated.
[0060] A flowchart of the steps of the flock screening method, such as Figure 2 shown.
[0061] S3, according to the difference between the shape of each chicken group area and the circle, the adhesion index of each chicken group area is obtained; the adhesion chicken group area and the chicken individual area are divided according to the numerical distribution of the adhesion index of all chicken group areas; according to the difference in texture and grayscale change direction within the local window of adjacent pixels on the edge of the adhesion chicken group area, the adhesion chicken group area is divided into each sub-chicken group area.
[0062] In a large-scale breeding environment, the density of chickens is high, and multiple chickens may aggregate and stick together. In addition, since the color characteristics of chickens raised in the same batch are relatively consistent, when extracting the chicken flock area, there will usually be multiple chickens in one chicken flock area. Therefore, it is still necessary to identify and segment the individual chickens in the chicken flock area.
[0063] By observing and analyzing the chickens raised in the same batch, we found that the chickens have consistent color characteristics, as well as consistent volume, size and shape. Therefore, if there is no adhesion between the chickens in the extracted chicken flock area, the size of each chicken flock area should be relatively consistent; if there is adhesion between the chickens, the area of the chicken flock area with adhesion will be significantly larger than the area of the chicken flock area without adhesion. At the same time, if adhesion occurs, the boundary contour of the adhesion chicken flock area will be more complicated due to the randomness of the chicken's position after movement.
[0064] Get the number of all pixels in each chicken area, record it as area S, get the number of pixels on the edge of the chicken area, record it as perimeter L. According to the numerical comparison of the area and perimeter of the chicken area, the circular similarity factor of the chicken area is obtained; .in, is the ratio of pi, which is 3.14 in this embodiment.
[0065] The circular similarity factor f can reflect the degree of similarity between the chicken flock area and the ideal circle. If the edge of the chicken flock area is closer to a circle, f is closer to the maximum value 1; if the edge of the chicken flock area is more irregular or complex, f is smaller. It should be noted that the circle is the most regular and compact shape. According to the relevant knowledge of the area and circumference of a circle, the ratio of the area to the circumference of a standard circle is ; For a given area S, the circumference of a circle is the smallest; if the boundary of the chicken area is complex, with depressions or protrusions, then with the same area, its circumference will increase accordingly, and f will become smaller; therefore, if the chicken area is a standard circle, the value of f will reach the maximum value of 1; if the shape of the chicken area is close to a circle, the value of f is close to 1; if the shape of the chicken area is very different from a circle, or the edge distortion is more serious, the value of f will be smaller.
[0066] Furthermore, the minimum bounding rectangle of each chicken group area is obtained, and the absolute value of the difference between the area of each chicken group area and the number of all pixels in its minimum bounding rectangle is recorded as the difference in the bounding rectangle of each chicken group area; if the chicken group area is not adhered, the area difference between the chicken group area and its minimum bounding rectangle is small. The ratio of the normalized value of the bounding rectangle difference of each chicken group area to the circular similarity factor is used as the adhesion index of each chicken group area. The adhesion threshold is obtained by threshold analysis of the adhesion index of all chicken groups, and the chicken group area with an adhesion index greater than the adhesion threshold is recorded as the adhesion chicken group area. The chicken group area with an adhesion index less than or equal to the adhesion threshold is recorded as the chicken individual area. Among them, the threshold analysis is performed using the Otsu threshold method.
[0067] In the extracted chicken flock area, although the shape of the chicken flock area of a single chicken is not circular, when the chickens are adhered, the chicken flock area formed by the adhesion is very different from the circle, and the edge is more irregular, and the circular similarity factor will be significantly reduced; therefore, if the circular similarity factor is smaller, it means that the chicken flock area is more likely to be an adhered chicken flock area. The circumscribed rectangle difference reflects the size of the blank area between the chicken flock area and its circumscribed rectangle. If the chicken flock area is not adhered, there is only a single chicken in the chicken flock area, which is relatively compact, and the difference between the chicken flock area and its own circumscribed rectangle is small; if adhesion occurs, the overall outline of the chicken flock area will become more irregular, and the blank area between the chicken flock area and its own circumscribed rectangle will increase significantly; therefore, if the external rectangle difference is larger, it means that the overall outline of the chicken flock area is more irregular, the distribution is more discrete, and the possibility of adhesion is greater.
[0068] Since the adhesion chicken group area is generated by multiple chickens in close proximity, and the adhesion parts of chickens will produce a concave area, the concave area corresponds to the chicken group area, which is manifested as a large change in the edge pixel points of the adhesion chicken group area. Therefore, this embodiment uses the concave point segmentation method to segment the adhesion chicken group area by finding the concave points in the chicken group area to distinguish individual chickens. Chicken feathers have texture characteristics, and the texture and feather direction in adjacent areas are relatively consistent, while the texture characteristics will change at the adhesion of different chickens.
[0069] For each adhesion chicken group area, a 5×5 pixel window is constructed with each edge pixel point of the adhesion chicken group area as the center. The texture feature of the pixel window is obtained; in this implementation, all the pixels in the pixel window are used as input, and the MLBP algorithm is used to obtain the texture feature information in the pixel window.
[0070] Let the concave point confidence of the vth edge pixel be , In the formula, is the in-window direction difference of the vth edge pixel, expressed as the variance of the gradient direction of all pixels in the pixel window centered on the vth edge pixel; Respectively represent the maximum values of the gradient directions of all pixels in the pixel window centered on the vth and v-1th edge pixels; They represent the texture features of the pixel windows centered on the vth and v-1th edge pixels respectively.
[0071] If the direction difference within the window is greater, it means that the gradient direction difference between pixels in the same window is greater; It reflects the difference between the maximum gradient direction of the current and previous edge pixels. The larger the value, the more significant the difference between the gradient direction of the current edge pixel and the previous edge pixel. It reflects the difference between the texture feature information of the current edge pixel and the previous edge pixel. The larger the value, the greater the difference in texture features between adjacent pixels. The larger the value is, the greater the difference between the vth edge pixel and its adjacent pixels is, and the greater the possibility that the vth edge pixel is a concave point is.
[0072] Furthermore, the sum of the concave point confidences of any two edge pixels is calculated and recorded as the first sum; the maximum value difference of the gradient directions of all pixels in the pixel window of the any two edge pixels is calculated; the smaller the maximum value difference, the more opposite the corresponding gradient direction. The difference between the maximum value difference and the first sum is used as the corresponding concave point confidence between the any two edge pixels. The two edge pixels with the largest corresponding concave point confidences in the adhesion chicken flock area are recorded as the two segmentation concave points of the adhesion chicken flock area. The maximum value difference is the absolute value of the maximum value difference. Figure 3 As shown, two segmentation concave points of the adhesion chicken group area are connected to segment the adhesion chicken group area into two sub-chicken group areas.
[0073] S4, dividing each chicken group area into a number of chicken individual areas according to the adhesion index of each chicken group area; and performing health status detection on all chicken individual areas.
[0074] According to the positions of the two corresponding concave points, a line is connected to complete the construction of the segmentation line, and the adhesion group area is segmented. The division operation of the adhesion group area and the chicken individual area is repeated for each sub-group area until the adhesion index of all sub-group areas is less than or equal to the adhesion threshold, and all chicken individual areas are obtained; specifically, after the segmentation of the adhesion group area is completed, its adhesion index is calculated again. If the adhesion index is still greater than the adhesion threshold, the adhesion group area is continued to be segmented until the adhesion index is less than or equal to the adhesion threshold.
[0075] After the individual connected domains of the chickens are divided, the original grayscale image of the chicken house in the i-th frame is segmented according to the size of the connected domain and its position in the grayscale image of the chicken house in the i-th frame. After that, the individual chicken images after division are standardized and used as the input of the convolutional neural network for health status detection. The output of the convolutional neural network is the health status of the chicken. It should be noted that: the training data set of the convolutional neural network is a public chicken training set, the optimization algorithm is Adam, and the loss function is the cross entropy loss function; the convolutional layer is 4 layers, followed by 1 fully connected layer, the number of iterations is set to 100 times, and the batch size is 32. The training of convolutional neural networks is a well-known technology and will not be repeated here. A visually assisted detection method for the health status of large-scale chicken farming is implemented.
[0076] Through the above description of the implementation method in combination with the accompanying drawings, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0077] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be covered by the protection scope of the present application.
Claims
1. A visually assisted detection method for the health status of large-scale chicken farming, characterized in that: The method comprises the following steps: S1, collect and decompose the chicken house detection video to obtain the grayscale image of each frame of the chicken house; S2, performing connected domain analysis on the grayscale image of the chicken house to obtain each connected domain; obtaining the edge irregularity coefficient of each connected domain according to the difference in the grayscale change direction of the edge pixel points of each connected domain; obtaining the corner points in each frame of the chicken house grayscale image; screening the chicken area according to the movement of the corner points in each connected domain in the adjacent frames of the chicken house grayscale image, the edge irregularity coefficient and the edge grayscale change; S3, according to the difference between the shape of each chicken group area and the circle, obtain the adhesion index of each chicken group area; divide the adhesion chicken group area and the chicken individual area according to the numerical distribution of the adhesion index of all chicken group areas; according to the difference in texture and grayscale change direction within the local window of adjacent pixels on the edge of the adhesion chicken group area, divide the adhesion chicken group area into each sub-chicken group area; S4, dividing each chicken group area into a number of chicken individual areas according to the adhesion index of each chicken group area; and performing health status detection on all chicken individual areas; The method of segmenting the adhesion chicken group area into sub-chicken group areas according to the difference in texture and grayscale change direction in the local window of adjacent pixels on the edge of the adhesion chicken group area includes: For each adhesion chicken group area, a pixel window of a preset size is constructed with each edge pixel point of the adhesion chicken group area as the center; the texture feature of the pixel window is obtained; the gradient direction of each pixel point in the pixel window is obtained; the variance of the gradient direction of all pixel points in the pixel window with each edge pixel point as the direction difference within the window of each edge pixel point is recorded; The concave point confidence of each edge pixel is obtained according to the texture features of each edge pixel and the direction difference within the window; Calculate the sum of the concave point confidences of any two edge pixels, recorded as the first sum value; calculate the maximum value difference of the gradient direction of all pixels in the pixel window of the any two edge pixels; take the difference between the maximum value difference and the first sum value as the corresponding concave point confidence between the any two edge pixels; record the two edge pixels with the largest corresponding concave point confidences in the adhesion chicken group area as the two segmentation concave points of the adhesion chicken group area; Connect the two segmentation concave points of the adhesion chicken group area to divide the adhesion chicken group area into two sub-chicken group areas; The step of obtaining the concave point confidence of each edge pixel point according to the texture feature of each edge pixel point and the direction difference within the window includes: Let the concave point confidence of the vth edge pixel be , ; In the formula, is the direction difference within the window of the vth edge pixel; Respectively represent the maximum values of the gradient directions of all pixels in the pixel window centered on the vth and v-1th edge pixels; They represent the texture features of the pixel windows centered on the vth and v-1th edge pixels respectively.
2. A visually assisted detection method for the health status of chickens in large-scale farming as claimed in claim 1, characterized in that: The method for obtaining the edge irregularity coefficient of each connected domain includes: For each connected domain, the pixel points on the edge of the connected domain are recorded as edge pixel points; the gradient direction of each edge pixel point is obtained; the gradient direction difference between each edge pixel point and the edge pixel point closest to it is calculated; the average value of the gradient direction difference of all edge pixel points contained in the connected domain is recorded as the edge irregularity coefficient of each connected domain.
3. A visually assisted detection method for the health status of chickens in large-scale farming as claimed in claim 1, characterized in that: The method for screening a chicken flock area comprises: The optical flow estimation method is used to obtain the motion vector of each corner point in the grayscale image of the chicken house; the mean of the motion vectors of all corner points in each connected domain is calculated as the average movement coefficient of each connected domain; For each connected domain, the average movement coefficient, edge irregularity coefficient and edge grayscale change of the connected domain are integrated to obtain the movement confidence of the connected domain; The moving confidence of all connected domains in the grayscale image of the chicken house is analyzed by threshold to obtain the segmentation threshold; the connected domain with a moving confidence greater than or equal to the segmentation threshold is recorded as the chicken group area.
4. A visually assisted detection method for the health status of chickens in large-scale farming as claimed in claim 3, characterized in that: The method for obtaining the mobility confidence of the connected domain comprises: The mobility confidence of the connected domain is recorded as A. ; In the formula, is the average mobility coefficient of the connected domain; is the maximum value of the average moving coefficient of all connected domains; r is the edge irregularity coefficient of the connected domain, is the gray value variance of all edge pixels in the connected domain.
5. A visually assisted detection method for the health status of chickens in large-scale farming as claimed in claim 1, characterized in that: The adhesion index of each chicken group area is obtained according to the difference between the shape of each chicken group area and the circle, including: For each chicken flock area, the number of all pixels in the chicken flock area is obtained, recorded as the area S, and the number of pixels on the edge of the chicken flock area is obtained, recorded as the perimeter L; based on the numerical comparison of the area and perimeter of the chicken flock area, the circular similarity factor of the chicken flock area is obtained; Obtain the minimum bounding rectangle of each chicken group area, and record the absolute value of the difference between the area of each chicken group area and the number of all pixels in its minimum bounding rectangle as the bounding rectangle difference of each chicken group area; The ratio of the normalized value of the circumscribed rectangle difference of each chicken group area to the circular similarity factor was taken as the adhesion index of each chicken group area.
6. A visually assisted detection method for the health status of chickens in large-scale farming as claimed in claim 5, characterized in that: The method for obtaining the circular similarity factor of the chicken flock area includes: recording the circular similarity factor of the chicken flock area as f, ; Where S is the area of the chicken area; L is the perimeter of the chicken area; is the ratio of pi.
7. A visually assisted detection method for the health status of large-scale chicken farming as claimed in claim 6, characterized in that: The method of dividing the adhesion chicken group area and the chicken individual area according to the numerical distribution of the adhesion index of all chicken group areas includes: Threshold analysis was performed on the adhesion index of all chicken flock areas to obtain the adhesion threshold. The chicken flock areas with adhesion index greater than the adhesion threshold were recorded as adhesion chicken flock areas; and the chicken flock areas with adhesion index less than or equal to the adhesion threshold were recorded as individual chicken areas.
8. A visually assisted detection method for the health status of chickens in large-scale farming as claimed in claim 7, characterized in that: The method of dividing each sub-chicken group area into a plurality of individual chicken areas according to the adhesion index of each sub-chicken group area comprises: repeating the division operation of the adhesion chicken group area and the individual chicken area for each sub-chicken group area until the adhesion index of all sub-chicken group areas obtained is less than or equal to the adhesion threshold, thereby obtaining all individual chicken areas.
Citation Information
Patent Citations
Chicken flock activity amount real-time estimation method and chicken flock activity amount real-time estimation system based on multi-target tracking
CN111680587A
Broiler chicken breeding health state detection method based on artificial intelligence
CN116912260A