Free-range sheep flock dynamic counting method and system based on multi-view vision

Through multi-view vision technology and parallel computing architecture, the problem of low counting accuracy and efficiency in free-range sheep counting is solved, and real-time and accurate sheep count monitoring is achieved in complex environments.

CN120412014AActive Publication Date: 2025-08-01ANHUI AGRICULTURAL UNIVERSITY

Patent Information

Application Number
CN202510475665.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-16
Publication Date
2025-08-01
Estimated Expiration
2045-04-16

AI Technical Summary

Technical Problem

The prior art has problems such as insufficient counting accuracy, poor environmental adaptability and low processing efficiency in free-range flock counting, especially in complex outdoor environments, which are difficult to achieve real-time and accurate dynamic monitoring of flock counts.

Method used

Using a multi-view vision method, image acquisition equipment is installed at different orientations, heights and angles in the active areas of the flock, combined with deep learning object detection, multi-object tracking and biometric recognition technology, a parallel computing architecture is built to realize the synchronous processing of image preprocessing, object detection, tracking and counting, and an environmental factor compensation model is constructed.

Benefits of technology

It realizes full coverage counting of flocks in complex outdoor environments, avoids duplication or missed counting, improves counting accuracy and processing efficiency, and provides timely and accurate information on flock counts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120412014A_ABST
    Figure CN120412014A_ABST
Patent Text Reader

Abstract

The invention discloses a free-range sheep flock dynamic counting method and system based on multi-view vision, and the method employs multi-view image collection deployment, and devices are installed in different directions, heights and angles of a sheep flock activity area, thereby achieving the complete coverage of the activity range. In the image preprocessing stage, graying, Gaussian filtering, histogram equalization and other operations are applied to improve the image quality. The sheep flock target is accurately detected by means of an improved deep learning model such as YOLOv5 containing a CBAM module. And multi-target tracking association is combined with Kalman filtering and a Hungary algorithm to realize stable tracking of sheep flock targets. The biological feature identification extracts sheep face features and compares the features with a database to identify individuals. And an environmental factor compensation model is constructed to cope with illumination and weather changes. And a parallel computing architecture and an optimized data storage and transmission mode are adopted, so that the processing efficiency is improved, and the dynamic counting of the free-range sheep flock is accurately realized in real time.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of sheep flock counting, and particularly to a method and system for dynamically counting free-range sheep flocks based on multi-view vision. Background Art

[0002] With the rapid development of the large-scale free-range sheep industry, accurately grasping the number of sheep flocks has become the key to efficient breeding management. In vast outdoor pastures, the activity range of sheep flocks is large and their behaviors are complex. The traditional method of relying on manual regular counting of sheep flocks not only consumes a large amount of manpower and time, but also is extremely prone to counting errors due to the continuous movement and uneven distribution of sheep flocks. In addition, the dynamic changes in the number of sheep flocks, such as the birth, loss or death of sheep, cannot be captured in time, which has caused great obstacles to breeders in planning feed reserves, evaluating breeding benefits, etc. Therefore, there is an urgent need for accurate and real-time dynamic counting technology for free-range sheep flocks.

[0003] Existing technologies have obvious shortcomings in counting accuracy. Most traditional counting methods only rely on single-view monitoring, which is difficult to comprehensively cover the activity area of sheep flocks, resulting in a large number of visual blind spots, causing some sheep to be missed or double-counted. At the same time, counting methods based on simple image recognition technology cannot effectively distinguish individual sheep. When there are occlusions, aggregations, etc. in the sheep flock, the counting accuracy drops sharply, making it difficult to meet the actual breeding needs. In a complex and changeable outdoor environment, the environmental adaptability of existing technologies is also very limited. The frequent changes in light intensity, from the soft light in the early morning to the strong direct sunlight at noon, will cause large fluctuations in the contrast and brightness of the captured images, resulting in blurred features of sheep in the images and interfering with the normal operation of recognition algorithms. In the face of bad weather, such as raindrop occlusion in rainy days and reduced visibility in foggy days, existing systems are even more difficult to obtain clear images, seriously affecting counting accuracy.

[0004] In terms of efficiency, existing counting systems usually adopt a serial processing mode, sequentially performing each link from image acquisition to data processing, with a slow processing speed and unable to reflect the dynamic changes in the number of sheep flocks in real time. Moreover, the data storage and transmission methods lack optimization. The storage of a large amount of image data occupies a large amount of space, and the transmission process is prone to jams and delays, further reducing the overall operation efficiency of the system and unable to provide timely and effective decision-making basis for breeders. Summary of the Invention

[0005] In order to overcome the shortcomings and deficiencies of existing technologies, the present invention provides a method and system for dynamically counting free-range sheep flocks based on multi-view vision.

[0006] A method for dynamically counting free-range sheep flocks based on multi-view vision includes:

[0007] Step 1: Multi-view image acquisition deployment. Install image acquisition devices at different positions, heights, and angles in the activity area of free-range sheep flocks, so that the images collected by each device cover the entire area where the sheep flocks are active and there is a certain overlapping area between them, and obtain multi-view image data of the sheep flocks' activities;

[0008] Step 2: Image preprocessing. Perform grayscale processing on the original images collected from each view, convert the color images into grayscale images to simplify the subsequent processing calculation amount; at the same time, perform noise reduction processing, use the Gaussian filtering algorithm to filter the grayscale images, and remove the noise interference in the images; then perform image enhancement processing, use the histogram equalization algorithm to expand the grayscale dynamic range of the images and improve the clarity of the image detail features;

[0009] Step 3: Sheep flock target detection. Based on the deep learning target detection algorithm, build a target detection model for sheep flocks, use a large number of multi-view image sample data including sheep flocks to train the model, so that the model learns the characteristics of sheep flocks. After the training is completed, input the preprocessed images from each view into the trained target detection model, detect the sheep flock targets in the images, and mark the position and contour information of each sheep flock target;

[0010] Step 4: Multi-target tracking and association. For the detected sheep flock targets, use the Hungarian algorithm combined with the Kalman filtering algorithm to establish a multi-target tracking model. Use the Kalman filtering algorithm to predict the positions of the sheep flock targets in the next frame of the image, and then use the Hungarian algorithm to match and associate the predicted positions with the sheep flock targets detected in the next frame of the image to determine the corresponding relationships of the sheep flock targets between different frames and perform continuous tracking of the sheep flock targets;

[0011] Step 5: Biometric recognition. During the process of tracking sheep flock targets, extract the biometric features of individual sheep, including the facial features and horn shape features of the sheep, build a biometric database, and use the feature matching algorithm to compare the biometric features extracted in real time with the features in the database to identify the individual identity information of each sheep;

[0012] Step 6: Dynamic counting and statistics. According to the results of multi-target tracking and association and biometric recognition, count and statistics the sheep flocks of different individuals. When a sheep enters or leaves the set counting area, increase or decrease the counting result accordingly, update the sheep flock quantity information in real time, and store and output and display the dynamic counting result.

[0013] Further, in the second step, the conversion formula used for grayscale processing is: Grayscale value = 0.299 × Red component + 0.587 × Green component + 0.114 × Blue component; in the Gaussian filtering algorithm, the size of the Gaussian kernel is set to 5×5, and the standard deviation σ is 1.5; in the histogram equalization algorithm, by calculating the grayscale histogram of the image, according to the formula: New grayscale value = round((Current grayscale value - Minimum grayscale value) × (Maximum grayscale value - 0) / (Total number of image pixels - 1)), the grayscale values of the image are remapped. When performing noise reduction processing, the bilateral filtering weight calculation formula is introduced:

[0014]

[0015] where (i, j) and (k, l) are the coordinates of different pixel points in the image, I represents the pixel value, and σ d is the standard deviation in the spatial domain, set to 2.5, and σ r is the standard deviation in the value domain, set to 0.2.

[0016] Further, in the third step, the constructed deep learning object detection model uses an improved YOLOv5 model. An attention mechanism module CBAM is added to the backbone network part of the original model. The module parameters are set as follows: the number of neurons in the fully connected layer of the channel attention part is 1 / 16 of the original number of channels, and the convolution kernel size of the spatial attention part is 7×7; when training the model, the loss function used is: L = Lcls + λ1 × Lbox + λ2 × Lobj, where Lcls is the classification loss, using the cross-entropy loss function, Lbox is the bounding box regression loss, using the CloU loss function, Lobj is the object confidence loss, using the binary cross-entropy loss function, and λ1 and λ2 are weight coefficients, set to 0.5 and 0.3 respectively; during the model training process, to adjust the learning rate, the cosine annealing learning rate adjustment formula is used:

[0017]

[0018] where η t is the learning rate at the current training epoch T c ur, η max and η min are the initial maximum learning rate and the final minimum learning rate respectively. Let η max = 0.001, η min = 0.00001, and T m ax is the total number of training epochs, set to 300.

[0019] Further, in the fourth step, in the Kalman filtering algorithm,

[0020] The state transition matrix A = [[1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]];

[0021] The observation matrix H = [[1, 0, 0, 0], [0, 1, 0, 0]];

[0022] The process noise covariance matrix Q = [[0.01, 0, 0, 0], [0, 0.01, 0, 0], [0, 0, 0.01, 0], [0, 0, 0, 0.01]],

[0023] The measurement noise covariance matrix R = [[0.1, 0], [0, 0.1]];

[0024] In the Hungarian algorithm during the matching process, the constructed cost matrix is generated by calculating the Euclidean distance between the target predicted position and the detection position, according to the formula: d = sqrt((x1 - x2) ∧ 2 + (y1 - y2) ∧ 2), where (x1, y1) are the coordinates of the predicted position and (x2, y2) are the coordinates of the detection position; the target tracking stability is introduced to measure the stability of the tracking target, and the calculation formula is:

[0025]

[0026] where N is the number of consecutive tracking frames, and d n is the Euclidean distance between the target predicted position and the detection position in the nth frame. When the S value is closer to 1, it indicates that the target tracking is more stable.

[0027] Furthermore, in step five, the local binary pattern (LBP) algorithm is used to extract the sheep face features. The image is divided into multiple 32×32 sub-regions, and the LBP feature histogram is calculated within each sub-region. The number of bins of the histogram is set to 59; when constructing the biometric database, a dimensionality reduction algorithm based on principal component analysis (PCA) is used to project the high-dimensional biometric feature vectors into a low-dimensional space, and the projection dimension is set to 30. The feature matching algorithm uses the Euclidean distance matching algorithm, and the Euclidean distance between the real-time feature vector and the feature vector in the database is calculated according to the formula: d = sqrt(sum((x - y) ∧ 2)) for matching, where x is the real-time feature vector and y is the feature vector in the database. When constructing the biometric database, to evaluate the discriminability of the feature vectors, the within-class scatter and between-class scatter are calculated. The formula for the within-class scatter is:

[0028]

[0029] The formula for the between-class scatter is:

[0030]

[0031] Among them, C is the number of categories, that is, the number of individual sheep, N i is the number of samples in the i-th category, N is the total number of samples, X i is the set of samples in the i-th category, μ i is the mean vector of the samples in the i-th category, and μ is the mean vector of all samples.

[0032] Furthermore, in step six, the set counting area is defined by the vertex coordinates of a polygon. When the centroid position coordinates of the sheep flock target satisfy the polygon area determination condition, it is determined whether the sheep flock enters or leaves the counting area. The polygon area determination condition uses the ray method, that is, a ray is emitted from the target centroid position in a certain direction, and the number of intersections between the ray and the polygon boundary is counted. If the number of intersections is odd, the target is inside the polygon area, otherwise it is outside the area; the counting result is stored using a MySQL database. The database table structure design includes fields for the number of sheep, timestamp field, and counting area identification field. To optimize the database storage performance, when writing the sheep number data, the batch insertion optimization formula is used to calculate the batch size for insertion:

[0033]

[0034] Among them, M is the size of the database server memory used for temporary data storage, set to 1024 * 1024 bytes, and T is the size of a single sheep number data record, set to 50 bytes.

[0035] Furthermore, in step one, the installation position of the image acquisition device is determined by a three-dimensional coordinate positioning system. The coordinate positioning system uses the Global Positioning System (GPS) combined with an Inertial Measurement Unit (IMU). GPS is used to obtain the longitude, latitude, and altitude information of the device, and IMU is used to measure the attitude angle information of the device. By fusing the two data, the three-dimensional coordinate position of the image acquisition device in space is accurately calculated. The coordinate calculation model is: [X, Y, Z] = [GPS_X + IMU_Xoffset, GPS_Y + IMU_Yoffset, GPS_Z + IMU_Zoffset], where [X, Y, Z] is the final three-dimensional coordinate, GPS_X, GPS_Y, GPS_Z are the GPS measurement values, and IMU_Xoffset, IMU_Yoffset, IMU_Zoffset are the offsets of the IMU measurement values after calibration; during the GPS and IMU data fusion process, the extended Kalman filter fusion formula is used to update the attitude angle information:

[0036]

[0037] Among them, is the updated attitude angle estimation value at time k, is the predicted attitude angle value at time k based on the previous moment, K k is the Kalman gain, z k is the attitude angle value measured by the IMU, and H is the observation matrix, which is set as the identity matrix.

[0038] Furthermore, the method adopts a parallel computing architecture, distributes the steps of image preprocessing, object detection, multi-object tracking association, biometric recognition, and dynamic counting statistics to multiple computing cores for simultaneous processing. The parallel computing task allocation model adopts a task queue scheduling algorithm. The task queue is sorted according to the task priority, and the priority is determined according to the task processing time and data dependency relationship. The task processing time is obtained through statistical analysis of historical data, and the data dependency relationship is determined through the data input and output relationship between tasks; when scheduling the task queue, in order to balance the computing resource load, a load balance degree calculation formula is introduced:

[0039]

[0040] where n is the number of computing cores, set to 8, W i is the current task load of the i-th computing core, is the average value of the task loads of all computing cores.

[0041] Furthermore, in step two, during image preprocessing, for illumination changes, the Retinex algorithm is combined with adaptive histogram equalization CLAHE for compensation. In the Retinex algorithm, the standard deviation σ of the Gaussian function is set to 30, and in the CLAHE algorithm, the cliplimit is set to 4.0 and the tilegridsize is set to 8×8; for weather conditions, a mapping table between weather types and image enhancement parameters is established. When different weather types are detected, the image enhancement parameters are automatically adjusted. When it is rainy, the contrast enhancement parameter of the image is increased, and when it is foggy, the defogging algorithm intensity parameter of the image is increased. When dealing with illumination changes, in order to dynamically adjust the gain coefficient in the Retinex algorithm, an illumination intensity change rate calculation formula is adopted:

[0042]

[0043] where L t is the illumination intensity value at the current moment, obtained through an illumination sensor, L t-1 is the illumination intensity value at the previous moment. The gain coefficient of the Retinex algorithm is adjusted according to the value of ΔL. When ΔL is greater than the set threshold, the gain coefficient is increased to adapt to rapid illumination changes.

[0044] A free-range sheep flock dynamic counting system based on multi-view vision includes the following units:

[0045] The image acquisition unit consists of multiple image acquisition devices installed at different positions in the activity area of free-range sheep flocks, and is used to acquire multi-view sheep flock activity image data and transmit the acquired image data to the image preprocessing unit;

[0046] The image preprocessing unit receives the image data transmitted by the image acquisition unit, performs grayscale conversion, noise reduction, and image enhancement preprocessing operations, and outputs the preprocessed image data to the sheep flock target detection unit;

[0047] The sheep flock target detection unit, based on the deep learning target detection model, performs sheep flock target detection on the preprocessed image data, marks the position and contour information of the sheep flock target, and transmits the detection results to the multi-target tracking and association unit;

[0048] The multi-target tracking and association unit uses the Hungarian algorithm combined with the Kalman filter algorithm to track and associate the sheep flock targets detected by the sheep flock target detection unit, determines the corresponding relationships of the sheep flock targets between different frames, and transmits the tracking results to the biometric recognition unit;

[0049] The biometric recognition unit extracts the biometric features of individual sheep, compares them with the biometric database, identifies the individual identity information of each sheep, and transmits the recognition results to the dynamic counting and statistics unit;

[0050] The dynamic counting and statistics unit performs dynamic counting and statistics on the sheep flock according to the results of the multi-target tracking and association unit and the biometric recognition unit, stores and outputs the sheep flock quantity information, and receives external instructions to configure the system parameters. Data interaction between each unit is carried out through a data transmission bus.

[0051] Beneficial effects:

[0052] The present invention proposes a method and system for dynamically counting free-range sheep based on multi-view vision. In terms of counting accuracy, the multi-view image acquisition and deployment ensure full coverage of the sheep activity area, reduce visual blind spots, and combined with advanced object detection and biometric recognition technologies, can accurately identify the individual identities of each sheep, effectively avoiding double counting or missing counting, and greatly improving the counting accuracy. It includes a deep learning object detection model trained with a large number of samples, which can accurately learn the characteristics of the sheep flock. Cooperating with a multi-object tracking algorithm, it can stably track targets during the complex movement of the sheep flock. Strong environmental adaptability is its prominent advantage. Facing the complex and changeable outdoor environment, including light changes and weather differences, the environmental factor compensation model constructed by this system can automatically adjust the image enhancement parameters. When the light changes, the Retinex algorithm combined with the adaptive histogram equalization CLAHE is used for effective compensation; under different weather conditions, according to the mapping table between the weather type and the image enhancement parameters, it is automatically optimized to ensure that clear and available image data can be obtained in various environments and maintain the counting accuracy. In terms of efficiency improvement, a parallel computing architecture is adopted to allocate each processing step to multiple computing cores for simultaneous processing, significantly shortening the overall processing time. The task queue scheduling algorithm reasonably allocates tasks according to the task priorities, and combines the load balancing degree calculation to optimize the resource allocation to achieve efficient operation. At the same time, in terms of data storage, the appropriate write batch size is calculated through the batch insertion optimization formula, reducing the number of database write operations and improving the storage efficiency. In addition, the units of the system cooperate closely through the data transmission bus to achieve smooth data interaction, ensuring the efficient operation of the entire dynamic counting process and providing timely and accurate data support for the management of free-range sheep flocks. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 It is a flowchart of the method steps of the present invention.

[0054] Figure 2 It is a diagram of the system unit composition of the present invention. DETAILED DESCRIPTION OF THE INVENTION

[0055] It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments can be combined with each other. The following will further describe the present application in detail with reference to the drawings and specific embodiments.

[0056] As Figure 1 shown, a method for dynamically counting free-range sheep based on multi-view vision includes the following steps:

[0057] Step 1: Multi-view image acquisition and deployment. Install multiple image acquisition devices at different positions, heights, and angles in the activity area of the free-range sheep flock to ensure that the images collected by each device can cover the entire area of the sheep flock activity and there is a certain overlapping area between them, and obtain multi-view image data of the sheep flock activity;

[0058] Specifically, in order to comprehensively capture the dynamics of free-range sheep herds in a vast activity area, multiple image acquisition devices need to be ingeniously installed at different positions, heights, and angles. For example, in a rectangular pasture with an area of 5000 square meters, at the four top corner positions of the pasture, a high-definition camera with a height of 3 meters is respectively set up, and the camera is directed towards the central area of the pasture, with the angle slightly tilted downward by 30 degrees. In this way, the activities of the sheep near the edge of the pasture can be clearly photographed. In the central position of the pasture, a panoramic camera with a height of 5 meters is erected. It can rotate 360 degrees to take pictures and cover the middle area of the pasture in all directions. The images collected by each device should not only cover the entire pasture, but also have a certain overlapping area with each other. Generally, the overlapping ratio is preferably controlled at 20%-30%. Taking two adjacent cameras as an example, in the pictures taken by them, the overlapping part can clearly show the complete process of some sheep entering the field of view of one camera from the field of view of another camera. This provides a guarantee of continuity for subsequent data integration and analysis, and finally obtains rich and comprehensive multi-perspective image data of the sheep's activities.

[0059] Step 2: Image preprocessing. Perform grayscale processing on the original images collected from each perspective to convert the color images into grayscale images to simplify the subsequent processing calculation amount; then perform noise reduction processing, use the Gaussian filtering algorithm to filter the grayscale images to remove noise interference in the images and improve the image quality; then perform image enhancement processing, use the histogram equalization algorithm to expand the grayscale dynamic range of the images and enhance the clarity of the image detail features;

[0060] Specifically, the amount of original color image data collected is huge and some information is not necessary for subsequent analysis. Therefore, grayscale processing is carried out first. Color images contain three color channels: red, green, and blue. Grayscale processing is to simplify this rich color information into a single grayscale value, greatly reducing the calculation amount of subsequent processing. For example, when using the OpenCV library in Python for grayscale processing, the originally complex color image can be converted into a grayscale image that is easy to process. Then, the Gaussian filtering algorithm is used for noise reduction. Since the image acquisition process is easily interfered by environmental factors, such as the slight shaking of the camera caused by a gentle breeze and the light spots caused by sunlight reflection, these noises will affect the image quality. Gaussian filtering can effectively remove these noise interferences and make the image smoother by setting a filtering template of a size like 5×5 and performing weighted averaging on each pixel point in the image and its surrounding neighborhood pixels, with a standard deviation set to 1.5. Finally, the histogram equalization algorithm is used for image enhancement. In some images with uneven illumination, some areas are too bright or too dark and the details are difficult to see clearly. Histogram equalization can redistribute the grayscale values of the image, evenly distribute the pixels originally concentrated in some narrow grayscale intervals to a wider grayscale range, significantly enhance the clarity of the image detail features, and make features such as the outline and hair of the sheep more clearly distinguishable.

[0061] Step 3: Sheep flock target detection. Based on the deep learning target detection algorithm, a target detection model for the sheep flock is constructed. A large number of multi-view image sample data including the sheep flock are used to train the model, enabling the model to learn the characteristics of the sheep flock. After the training is completed, the pre-processed images from each view are input into the trained target detection model to detect the sheep flock targets in the images, and mark the position and contour information of each sheep flock target;

[0062] Specifically, constructing an accurate detection model for the sheep flock based on the deep learning target detection algorithm is a key step. The improved YOLOv5 model can be selected, and an attention mechanism module called CBAM is added to its backbone network part. Among them, the number of neurons in the fully connected layer of the channel attention part is set to one-sixteenth of the original number of channels, and the convolution kernel size of the spatial attention part is set to 7×7, which can make the model focus more on the key features of the sheep flock. To enable the model to have strong generalization ability, a large amount of diverse multi-view image sample data including the sheep flock need to be used for training. These samples should cover images in different seasons, different weather conditions (sunny, cloudy, light rainy days), different time periods (early morning, noon, evening), and different sheep flock densities (sparse, medium, dense), etc. During the training process, a composite loss function composed of classification loss, bounding box regression loss, and object confidence loss is used to optimize the model parameters. After the training is completed, the pre-processed images from each view are input into the model, and the model can accurately detect the sheep flock targets in the images, and clearly mark the position and contour information of each sheep with a rectangular box. Even if there is partial occlusion or aggregation of the sheep flock, it can be recognized relatively accurately.

[0063] Step 4: Multi-object tracking association. For the detected sheep flock targets, the Hungarian algorithm combined with the Kalman filter algorithm is used to establish a multi-object tracking model. The Kalman filter algorithm is used to predict the positions of the sheep flock targets in the next frame of the image, and then the Hungarian algorithm is used to match and associate the predicted positions with the sheep flock targets detected in the next frame of the image to determine the corresponding relationships of the sheep flock targets between different frames and perform continuous tracking of the sheep flock targets;

[0064] Specifically, for the detected flock targets, the Hungarian algorithm and the Kalman filtering algorithm need to be combined to establish a multi-target tracking model to achieve continuous and stable tracking of the flock targets. The Kalman filtering algorithm predicts the position of the flock targets in the next frame of the image based on their historical motion states. For example, by analyzing the position, speed, and other information of a certain sheep in the previous few frames, the possible position range of it in the next frame can be predicted. When setting relevant parameters, such as the state transition matrix, the observation matrix, the process noise covariance matrix, and the measurement noise covariance matrix, the prediction can be made more accurate. The Hungarian algorithm is responsible for matching and associating the positions predicted by the Kalman filter with the flock targets actually detected in the next frame of the image. It calculates the distance between the two and selects the optimal matching pairs to determine the corresponding relationships of the flock targets between different frames. For example, when the flock is continuously moving in the pasture, this model can accurately determine that a certain sheep in the current frame is the one that was at a specific position in the previous frame, without confusing the targets due to the complex movement of the flock, and achieve continuous and stable tracking of each sheep.

[0065] Step Five: Biometric recognition. During the process of tracking the flock targets, extract the biometric features of individual sheep, such as the facial features of the sheep, the shape features of the sheep's horns, etc., construct a biometric database, and use the feature matching algorithm to compare the biometric features extracted in real time with the features in the database to identify the individual identity information of each sheep.

[0066] Specifically, during the process of tracking the flock targets, extract the unique biometric features of individual sheep to identify the identity of each sheep. Taking the extraction of sheep facial features as an example, use the local binary pattern algorithm to divide the sheep facial image into numerous 32×32 sub-regions, and generate a feature histogram containing 59 intervals in each sub-region. Through these histograms, the texture and other features of the sheep face can be effectively described. When constructing the biometric database, considering that the original biometric feature data has high dimensions and large storage and calculation costs, use the principal component analysis algorithm to project the high-dimensional feature vectors into a low-dimensional space, for example, set the projection dimension to 30 dimensions. Then use the feature matching algorithm, such as calculating the distance between the biometric feature vectors extracted in real time and the existing feature vectors in the database. When the distance is less than a pre-set reasonable threshold, the individual identity information of the sheep can be accurately identified. This is like finding the "identity page" of a specific sheep in a "big dictionary" with the identity information of numerous sheep by comparing the features.

[0067] Step Six: Dynamic counting and statistics. According to the results of multi-target tracking association and biometric recognition, count and statistically analyze different individual flocks. When a sheep enters or leaves the set counting area, increase or decrease the counting result accordingly, update the flock quantity information in real time, and store and output the dynamic counting results for display.

[0068] Specifically, according to the results of the previous multi-object tracking association and biometric recognition, accurate counting and statistics are carried out on flocks of sheep of different individuals. First, a clear counting area needs to be set in the pasture image. For example, by defining a polygonal area, which can be set according to the actual management needs of the pasture, such as a specific area near the sheepfold or an area that is often used as a gathering point for the flock. When the center of gravity position of a sheep enters the area from outside the counting area, the counting system automatically adds 1 to the number of the flock; conversely, when the center of gravity position moves out of the area to outside the area, the number is decreased by 1. To determine whether the center of gravity position of the sheep is within the counting area, the ray method is used. A virtual ray is emitted from the center of gravity position of the sheep in a certain direction, and the number of intersections between the ray and the polygon boundary is counted. An odd number of intersections indicates that the sheep is inside the area, and an even number indicates that it is outside the area. The system will update the flock number information in real time and store these dynamic counting results in a database such as MySQL. The database table structure design includes fields such as flock number, recording time, and counting area identifier, which is convenient for subsequent query and analysis. At the same time, the latest flock number is displayed to the breeders through a display screen or a mobile APP, etc., so that they can keep track of the dynamic flock number at any time.

[0069] Preferably, in the image preprocessing of the second step, the conversion formula used for grayscale processing is: grayscale value = 0.299 × red component + 0.587 × green component + 0.114 × blue component; in the Gaussian filtering algorithm, the size of the Gaussian kernel is set to 5×5, and the standard deviation σ is 1.5; in the histogram equalization algorithm, by calculating the grayscale histogram of the image, according to the formula: new grayscale value = round((current grayscale value - minimum grayscale value) × (maximum grayscale value - 0) / (total number of image pixels - 1)), the grayscale values of the image are remapped. When performing noise reduction processing, to further optimize the noise removal effect, the bilateral filtering weight calculation formula is introduced:

[0070]

[0071] where (i, j) and (k, l) are the coordinates of different pixel points in the image, I represents the pixel value, and σ d is the standard deviation in the spatial domain, set to 2.5, and σ r is the standard deviation in the value domain, set to 0.2.

[0072] Preferably, in the sheep flock target detection in step three, the constructed deep learning target detection model uses an improved YOLOv5 model. An attention mechanism module CBAM is added to the backbone network part of the original model. The module parameters are set as follows: the number of neurons in the fully connected layer of the channel attention part is 1 / 16 of the original number of channels, and the convolution kernel size of the spatial attention part is 7×7. When training the model, the loss function used is: L = Lcls + λ1×Lbox + λ2×Lobj, where Lcls is the classification loss, and the cross-entropy loss function is used; Lbox is the bounding box regression loss, and the CloU loss function is used; Lobj is the object confidence loss, and the binary cross-entropy loss function is used. λ1 and λ2 are weight coefficients, which are set to 0.5 and 0.3 respectively. During the model training process, to adjust the learning rate, the cosine annealing learning rate adjustment formula is used:

[0073]

[0074] where η t is the learning rate of the current training round T c ur, η max and η min are the initial maximum learning rate and the final minimum learning rate respectively. Let η max = 0.001, η min = 0.00001, and T m ax is the total number of training rounds, which is set to 300.

[0075] Preferably, in the multi-target tracking association in step four, in the Kalman filter algorithm, the state transition matrix A = [[1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]], the observation matrix H = [[1, 0, 0, 0], [0, 1, 0, 0]], the process noise covariance matrix Q = [[0.01, 0, 0, 0], [0, 0.01, 0, 0], [0, 0, 0.01, 0], [0, 0, 0, 0.01]], and the measurement noise covariance matrix R = [[0.1, 0], [0, 0.1]]. In the matching process of the Hungarian algorithm, the constructed cost matrix is generated by calculating the Euclidean distance between the predicted position and the detected position of the target according to the formula: d = sqrt((x1 - x2) ∧ 2 + (y1 - y2) ∧ 2), where (x1, y1) is the predicted position coordinate and (x2, y2) is the detected position coordinate. To measure the stability of the tracking target, a target tracking stability calculation formula is introduced:

[0076]

[0077] where N is the number of consecutive tracking frames, and d nIt is the Euclidean distance between the target prediction position and the detection position in the nth frame. When the S value is closer to 1, it indicates that the target tracking is more stable.

[0078] Preferably, in the biometric recognition in the fifth step, the Local Binary Pattern (LBP) algorithm is used to extract the facial features of the sheep. The image is divided into multiple sub-regions of 32×32. The LBP feature histogram is calculated within each sub-region, and the number of bins of the histogram is set to 59. When constructing the biometric database, a dimensionality reduction algorithm based on Principal Component Analysis (PCA) is used to project the high-dimensional biometric feature vectors into a low-dimensional space, and the projection dimension is set to 30. The feature matching algorithm uses the Euclidean distance matching algorithm. By calculating the Euclidean distance between the real-time feature vector and the feature vector in the database, according to the formula: d = sqrt(sum((x - y) ∧ 2)) for matching, where x is the real-time feature vector and y is the feature vector in the database. When constructing the biometric database, to evaluate the discriminability of the feature vectors, the within-class scatter and between-class scatter are calculated. The formula for the within-class scatter is:

[0079]

[0080] The formula for the between-class scatter is:

[0081]

[0082] where C is the number of classes (i.e., the number of individual sheep), N i is the number of samples in the i-th class, N is the total number of samples, X i is the set of samples in the i-th class, μ i is the mean vector of the i-th class of samples, μ is the mean vector of all samples. Ideally, it is hoped that S w is as small as possible and S b is as large as possible to improve the feature discriminability.

[0083] Preferably, in the dynamic counting statistics in the sixth step, the set counting area is defined by the vertex coordinates of a polygon. When the centroid position coordinates of the sheep flock target satisfy the polygon area determination condition, it is determined that the sheep flock enters or leaves the counting area. The polygon area determination condition uses the ray method, that is, a ray is emitted from the target centroid position in a certain direction, and the number of intersections of the ray and the polygon boundary is counted. If the number of intersections is odd, the target is inside the polygon area, otherwise it is outside the area. The counting results are stored using a MySQL database. The database table structure design includes fields such as the sheep flock quantity field, the timestamp field, and the counting area identification field, etc. To optimize the database storage performance, when writing the sheep flock quantity data, the batch insertion optimization formula is used to calculate the batch size for insertion:

[0084]

[0085] Among them, M is the size of the database server memory available for temporary data storage (unit: byte), set to 1024 * 1024 bytes, and T is the size of a single flock quantity data record (unit: byte), set to 50 bytes. The appropriate batch size B is calculated through this formula to reduce the number of database write operations and improve storage efficiency.

[0086] Preferably, in the multi-view image acquisition and deployment step, the installation position of the image acquisition device is determined by a three-dimensional coordinate positioning system. The coordinate positioning system uses the Global Positioning System (GPS) combined with an Inertial Measurement Unit (IMU). GPS is used to obtain the longitude, latitude, and altitude information of the device, and IMU is used to measure the attitude angle information of the device. By fusing the data of the two, the three-dimensional coordinate position of the image acquisition device in space is accurately calculated. The coordinate calculation model is: [X, Y, Z] = [GPS_X + IMU_Xoffset, GPS_Y + IMU_Yoffset, GPS_Z + IMU_Zoffset], where [X, Y, Z] is the final three-dimensional coordinate, GPS_X, GPS_Y, GPS_Z are the GPS measurement values, and IMU_Xoffset, IMU_Yoffset, IMU_Zoffset are the offsets after calibration of the IMU measurement values; during the GPS and IMU data fusion process, to improve the fusion accuracy, the Extended Kalman Filter fusion formula is used to update the attitude angle information:

[0087]

[0088] Among them, is the estimated value of the attitude angle at the updated k-th moment, is the predicted attitude angle value at the k-th moment based on the previous moment, K k is the Kalman gain, z k is the attitude angle value measured by the IMU, and H is the observation matrix, set to the identity matrix.

[0089] Preferably, in the entire method process, to improve the processing efficiency, a parallel computing architecture is adopted. Steps such as image preprocessing, object detection, multi-object tracking association, biometric recognition, and dynamic counting statistics are allocated to multiple computing cores for simultaneous processing. The parallel computing task allocation model uses a task queue scheduling algorithm. The task queue is sorted according to the task priority, and the priority is determined based on the task processing time and data dependency relationship. The task processing time is obtained through statistical analysis of historical data, and the data dependency relationship is determined through the data input and output relationship between tasks; during the task queue scheduling, to balance the load of computing resources, a load balance degree calculation formula is introduced:

[0090]

[0091] Among them, n is the number of computing cores, set to 8, and W i is the current task load of the i-th computing core (converted by task processing time), is the average value of the task loads of all computing cores. By adjusting the task allocation, the value of L is minimized as much as possible to achieve better load balancing.

[0092] Preferably, to cope with the influence of complex environmental factors on the counting accuracy, such as light changes, weather conditions, etc., an environmental factor compensation model is constructed. In the image preprocessing stage, for light changes, the Retinex algorithm combined with adaptive histogram equalization CLAHE is used for compensation. In the Retinex algorithm, the standard deviation σ of the Gaussian function is set to 30, and in the CLAHE algorithm, the cliplimit is set to 4.0, and the tilegridsize is set to 8×8; for weather conditions, a mapping table between weather types and image enhancement parameters is established. When different weather types are detected, the image enhancement parameters are automatically adjusted. For example, in rainy days, the contrast enhancement parameter of the image is increased, and in foggy days, the intensity parameter of the defogging algorithm of the image is increased. When dealing with light changes, to dynamically adjust the gain coefficient in the Retinex algorithm, the following formula for calculating the light intensity change rate is used:

[0093]

[0094] Among them, L t is the light intensity value at the current moment, obtained by a light sensor, and L t-1 is the light intensity value at the previous moment. The gain coefficient of the Retinex algorithm is adjusted according to the magnitude of the ΔL value. When ΔL is greater than the set threshold (set to 0.1), the gain coefficient is increased to better adapt to rapid light changes.

[0095] Such as Figure 2 shown, a free-range flock dynamic counting system based on multi-view vision includes the following units:

[0096] An image acquisition unit, which consists of multiple image acquisition devices installed at different positions in the activity area of the free-range flock, is used to acquire multi-view flock activity image data and transmit the acquired image data to the image preprocessing unit;

[0097] An image preprocessing unit, which receives the image data transmitted by the image acquisition unit, performs preprocessing operations such as grayscale conversion, noise reduction, and image enhancement, and outputs the preprocessed image data to the flock target detection unit;

[0098] A flock target detection unit, based on a deep learning target detection model, performs flock target detection on the preprocessed image data, marks the positions and contour information of the flock targets, and transmits the detection results to the multi-target tracking and association unit;

[0099] The multi-target tracking and association unit uses the Hungarian algorithm combined with the Kalman filtering algorithm to track and associate the sheep flock targets detected by the sheep flock target detection unit, determine the corresponding relationships of the sheep flock targets between different frames, and transmit the tracking results to the biometric recognition unit;

[0100] The biometric recognition unit extracts the biometric features of individual sheep, compares them with the biometric database, identifies the individual identity information of each sheep, and transmits the recognition results to the dynamic counting and statistics unit;

[0101] The dynamic counting and statistics unit performs dynamic counting and statistics on the sheep flock according to the results of the multi-target tracking and association unit and the biometric recognition unit, stores and outputs and displays the sheep flock quantity information, and can receive external instructions to perform operations such as parameter configuration on the system. Data interaction is carried out between the units through a data transmission bus to realize the overall operation of the system.

[0102] Existing free-range sheep flock counting technologies mostly rely on single-view monitoring, with many visual blind spots, making it difficult to comprehensively capture the activities of the sheep flock, resulting in a significant reduction in counting accuracy. For the method and system based on multi-view vision, by installing multiple image acquisition devices at different positions, heights and angles in the sheep flock activity area, it not only comprehensively covers the sheep flock activity range, but also uses the 20%-30% image overlapping area to ensure data integrity and continuity, greatly improving the counting accuracy. For example, in a large-area pasture, the multi-view devices can monitor the sheep flock without dead angles, avoiding missed counting or double counting caused by occlusion, uneven distribution, etc.

[0103] Facing the complex outdoor environment, existing technologies often fail due to changes in light and weather. A large fluctuation in light intensity will make the image contrast and brightness abnormal, and bad weather such as rainy days and foggy days will seriously interfere with the image quality, resulting in errors in the recognition algorithm. In contrast, the new system constructs an environmental factor compensation model. For light changes, it uses the Retinex algorithm combined with the adaptive histogram equalization CLAHE to automatically adjust the image enhancement parameters; according to the weather type and image enhancement parameter mapping table, it precisely optimizes the image under different weathers, maintains stable counting accuracy, and ensures normal operation in various complex environments.

[0104] Most existing counting systems adopt a serial processing mode, which proceeds sequentially from image acquisition to data processing. The processing speed is slow, and data storage and transmission are not optimized, resulting in easy lag and delay, and unable to reflect the dynamics of the flock in real time. The multi-view vision-based system adopts a parallel computing architecture, where each processing step is carried out synchronously. With the help of the task queue scheduling algorithm, tasks are reasonably allocated, and resource utilization is optimized by combining the calculation of the load balance degree, significantly improving the processing efficiency. At the same time, the data storage and transmission methods are optimized. For example, the appropriate write batch size is calculated through the optimized formula for batch insertion, reducing the number of database writes, achieving efficient storage and fast transmission, and providing timely and accurate dynamic information on the number of sheep for breeders.

[0105] Although the embodiments of the present invention have been shown and described, it will be understood by those of ordinary skill in the art that various equivalent changes, modifications, substitutions, and variations can be made to these embodiments without departing from the principles and spirit of the present invention. The scope of the present invention is defined by the appended claims and their equivalent scope.

Claims

1. A method for dynamically counting free-range sheep flocks based on multi-view vision, characterized in that, Including: Step 1: Multi-view image acquisition deployment. Install image acquisition devices at different positions, heights, and angles in the activity area of free-range sheep flocks, so that the images collected by each device cover the entire area of the sheep flock's activities and there is a certain overlapping area between them, and obtain multi-view image data of the sheep flock's activities; Step 2: Image preprocessing. Perform grayscale processing on the original images collected from each view, convert the color images into grayscale images to simplify the subsequent processing calculation amount; at the same time, perform noise reduction processing, use the Gaussian filtering algorithm to filter the grayscale images, and remove the noise interference in the images; Then perform image enhancement processing, use the histogram equalization algorithm to expand the grayscale dynamic range of the images and improve the clarity of the image detail features; Step 3: Sheep flock target detection. Based on the deep learning target detection algorithm, construct a target detection model for the sheep flock, use the multi-view image sample data of the sheep flock to train the model, so that the model learns the characteristics of the sheep flock. After the training is completed, input the preprocessed images from each view into the trained target detection model, detect the sheep flock targets in the images, and mark the position and contour information of each sheep flock target; Step 4: Multi-target tracking association. For the detected sheep flock targets, use the Hungarian algorithm combined with the Kalman filtering algorithm to establish a multi-target tracking model, use the Kalman filtering algorithm to predict the positions of the sheep flock targets in the next frame of the image, and then use the Hungarian algorithm to match and associate the predicted positions with the sheep flock targets detected in the next frame of the image to determine the corresponding relationships of the sheep flock targets between different frames and perform continuous tracking of the sheep flock targets; Step 5: Biometric recognition. During the process of tracking the sheep flock targets, extract the biometric features of individual sheep, including the facial features and horn shape features of the sheep, construct a biometric database, and use the feature matching algorithm to compare the biometric features extracted in real time with the features in the database to identify the individual identity information of each sheep; Step 6: Dynamic counting and statistics. According to the results of multi-target tracking association and biometric recognition, count and statistics the sheep flocks of different individuals. When a sheep enters or leaves the set counting area, increase or decrease the counting result accordingly, update the sheep flock quantity information in real time, and store and output and display the dynamic counting result.

2. The method for dynamically counting free-range sheep based on multi-view vision according to claim 1, wherein, In the said Step 2, the conversion formula used for grayscale processing is: Grayscale value = 0.299 × Red component + 0.587 × Green component + 0.114 × Blue component; in the Gaussian filtering algorithm, the size of the Gaussian kernel is set to 5×5, and the standard deviation σ is 1.5; in the histogram equalization algorithm, by calculating the grayscale histogram of the image, according to the formula: New grayscale value = round((Current grayscale value - Minimum grayscale value) × (Maximum grayscale value - 0) / (Total number of image pixels - 1)) to remap the grayscale values of the image, and when performing noise reduction processing, introduce the bilateral filtering weight calculation formula: where (i, j) and (k, l) are the coordinates of different pixel points in the image, I represents the pixel value, and σ d is the standard deviation in the spatial domain, set to 2.5, and σ r is the standard deviation in the value domain, set to 0.

2.

3. The method for dynamically counting free-range sheep based on multi-perspective vision according to claim 1, characterized in that In Step 3, the constructed deep learning object detection model uses an improved YOLOv5 model. An attention mechanism module CBAM is added to the backbone network of the original model. The module parameters are set as follows: the number of neurons in the fully connected layer of the channel attention part is 1 / 16 of the original number of channels, and the convolutional kernel size of the spatial attention part is 7×7. During model training, the loss function used is: L = Lcls + λ1×Lbox + λ2×Lobj, where Lcls is the classification loss, and the cross-entropy loss function is used; Lbox is the bounding box regression loss, and the CloU loss function is used; Lobj is the object confidence loss, and the binary cross-entropy loss function is used. λ1 and λ2 are weight coefficients, which are set to 0.5 and 0.3 respectively. During the model training process, to adjust the learning rate, the cosine annealing learning rate adjustment formula is used: Among them, η t is the learning rate of ur in the current training round T c where η max and η min are the initial maximum learning rate and the final minimum learning rate respectively. Let η max = 0.001, η min = 0.00001, and T m ax is the total number of training rounds, set to 300.

4. The method for dynamically counting free-range sheep based on multi-view vision according to claim 1, characterized in that In Step 4, in the Kalman filter algorithm, the state transition matrix A = [[1, 0, 1, 0], [0, 1, 0, 1], [0, 0, 1, 0], [0, 0, 0, 1]]; the observation matrix H = [[1, 0, 0, 0], [0, 1, 0, 0]]; the process noise covariance matrix Q = [[0.01, 0, 0, 0], [0, 0.01, 0, 0], [0, 0, 0.01, 0], [0, 0, 0, 0.01]], the measurement noise covariance matrix R = [[0.1, 0], [0, 0.1]]; During the matching process of the Hungarian algorithm, the constructed cost matrix is generated by calculating the Euclidean distance between the predicted position of the target and the detected position, according to the formula: d = sqrt((x1 - x2) ∧ 2 + (y1 - y2) ∧ 2), where (x1, y1) are the coordinates of the predicted position and (x2, y2) are the coordinates of the detected position; the stability of the target tracking is introduced to measure the stability of the tracking target, and the calculation formula is: where N is the number of consecutively tracked frames, and d n is the Euclidean distance between the predicted position and the detected position of the target in the n-th frame. The closer the S value is to 1, the more stable the target tracking is.

5. The method for dynamically counting free-range sheep based on multi-view vision according to claim 1, wherein In the fifth step, the local binary pattern (LBP) algorithm is used to extract the facial features of the sheep. The image is divided into multiple sub-regions of 32×32. The LBP feature histogram is calculated within each sub-region, and the number of bins of the histogram is set to 59. When constructing the biometric database, a dimensionality reduction algorithm based on principal component analysis (PCA) is adopted to project the high-dimensional biometric feature vectors into a low-dimensional space, and the projection dimension is set to 30. The feature matching algorithm uses the Euclidean distance matching algorithm. By calculating the Euclidean distance between the real-time feature vector and the feature vector in the database, according to the formula: d = sqrt(sum((x - y) ∧ 2)), where x is the real-time feature vector and y is the feature vector in the database. When constructing the biometric database, to evaluate the discriminability of the feature vectors, the within-class scatter and between-class scatter are calculated. The formula for the within-class scatter is: the between-class scatter calculation formula is: Among them, C is the number of categories, that is, the number of individual sheep, N i is the number of samples in the i-th category, N is the total number of samples, X i is the set of samples in the i-th category, μ i is the mean vector of the samples in the i-th category, and μ is the mean vector of all samples.

6. The method for dynamically counting free-range sheep flocks based on multi-perspective vision according to claim 1, characterized in that In Step 6, the set counting area is defined by the polygon vertex coordinates. When the centroid position coordinates of the sheep flock target meet the polygon area determination condition, it is determined that the sheep flock enters or leaves the counting area. The polygon area determination condition uses the ray method, that is, a ray is emitted from the target centroid position in a certain direction, and the number of intersections between the ray and the polygon boundary is counted. If the number of intersections is odd, the target is inside the polygon area, otherwise it is outside the area. The counting results are stored using a MySQL database. The database table structure design includes fields for the number of sheep, timestamp, and counting area identifier. To optimize the database storage performance, when writing the number of sheep data, the batch insertion optimization formula is used to calculate the batch insertion size: where M is the size of the database server memory used for temporary data storage, set to 1024 * 1024 bytes, and T is the size of a single record of the number of sheep data, set to 50 bytes.

7. The method for dynamically counting free-range sheep based on multi-perspective vision according to claim 1, wherein In the first step, the installation position of the image acquisition device is determined by a three-dimensional coordinate positioning system. The coordinate positioning system uses the Global Positioning System (GPS) combined with an Inertial Measurement Unit (IMU). The GPS is used to obtain the longitude, latitude, and altitude information of the device, and the IMU is used to measure the attitude angle information of the device. By fusing the data of the two, the three-dimensional coordinate position of the image acquisition device in space is accurately calculated. The coordinate calculation model is: [X, Y, Z] = [GPS_X + IMU_Xoffset, GPS_Y + IMU_Yoffset, GPS_Z + IMU_Zoffset], where [X, Y, Z] is the final three-dimensional coordinate, GPS_X, GPS_Y, GPS_Z are the GPS measurement values, and IMU_Xoffset, IMU_Yoffset, IMU_Zoffset are the offsets of the IMU measurement values after calibration; in the process of fusing GPS and IMU data, the extended Kalman filter fusion formula is used to update the attitude angle information: Among them, is the updated estimated attitude angle value at time k, is the predicted attitude angle value at time k based on the previous moment, K k is the Kalman gain, z k is the attitude angle value measured by the IMU, and H is the observation matrix, which is set as the identity matrix.

8. The method for dynamically counting free-range sheep based on multi-view vision according to claim 1, characterized in that This method adopts a parallel computing architecture. The steps of image preprocessing, target detection, multi-target tracking association, biometric recognition, and dynamic counting statistics are allocated to multiple computing cores for simultaneous processing. The parallel computing task allocation model uses a task queue scheduling algorithm. The task queue is sorted according to the task priority, and the priority is determined according to the task processing time and data dependency relationship. The task processing time is obtained through statistical analysis of historical data, and the data dependency relationship is determined by the data input and output relationship between tasks; when scheduling the task queue, in order to balance the load of computing resources, a load balance degree calculation formula is introduced: Among them, n is the number of computing cores, set to 8, and W i is the current task load of the i-th computing core, and is the average value of the task loads of all computing cores.

9. The method for dynamically counting free-range sheep flocks based on multi-perspective vision according to claim 1, wherein In the second step, during image preprocessing, for light changes, the Retinex algorithm combined with Contrast Limited Adaptive Histogram Equalization (CLAHE) is used for compensation. In the Retinex algorithm, the standard deviation σ of the Gaussian function is set to 30, and in the CLAHE algorithm, the cliplimit is set to 4.0 and the tilegridsize is set to 8×8; for weather conditions, a mapping table between weather types and image enhancement parameters is established. When different weather types are detected, the image enhancement parameters are automatically adjusted. When it is rainy, the contrast enhancement parameter of the image is increased, and when it is foggy, the intensity parameter of the defogging algorithm of the image is increased. When dealing with light changes, in order to dynamically adjust the gain coefficient in the Retinex algorithm, a light intensity change rate calculation formula is used: Among them, L t is the light intensity value at the current moment, obtained by a light sensor. L t-1 is the light intensity value at the previous moment. The gain coefficient of the Retinex algorithm is adjusted according to the value of ΔL. When ΔL is greater than the set threshold, the gain coefficient is increased to adapt to the rapid change of light intensity.

10. A free-range sheep flock dynamic counting system based on multi-view vision, characterized in that, It includes the following units: An image acquisition unit, which consists of multiple image acquisition devices installed at different positions in the free-range sheep activity area, is used to collect multi-view sheep activity image data and transmit the collected image data to the image preprocessing unit; An image preprocessing unit, which receives the image data transmitted by the image acquisition unit, performs grayscale conversion, noise reduction, and image enhancement preprocessing operations, and outputs the preprocessed image data to the sheep target detection unit; The sheep flock target detection unit, based on the deep learning target detection model, performs sheep flock target detection on the preprocessed image data, marks the position and contour information of the sheep flock target, and transmits the detection results to the multi-target tracking and association unit; The multi-target tracking and association unit uses the Hungarian algorithm combined with the Kalman filter algorithm to track and associate the sheep flock targets detected by the sheep flock target detection unit, determines the corresponding relationship of the sheep flock targets between different frames, and transmits the tracking results to the biometric recognition unit; The biometric recognition unit extracts the biometric features of individual sheep, compares them with the biometric database, identifies the individual identity information of each sheep, and transmits the recognition results to the dynamic counting and statistics unit; The dynamic counting and statistics unit performs dynamic counting and statistics on the sheep flock according to the results of the multi-target tracking and association unit and the biometric recognition unit, stores and outputs the sheep flock quantity information, and receives external instructions to configure the system parameters. Data interaction between each unit is carried out through the data transmission bus.

Citation Information

Patent Citations

  • The invention discloses an aqueduct pedestrian motion tracking detection system and a detection method thereof

    CN109840489A

  • Method for identifying and tracking behaviors of health-preserving pigs in group

    CN115223191A

  • Sheep growth information monitoring system and method

    CN117441635A

  • FastReID and IoU combined multi-target tracking and counting method

    CN118864521A

  • Lightweight scenic spot pedestrian counting system based on improved YOLOv10n and DeepSort

    CN119559482A

Cited By

  • Spatial-temporal feature fusion-based sheep water drinking behavior intelligent identification method and device

    CN121392891A