Pig data audit alarm method, device, electronic equipment and medium

By applying object detection algorithms and clustering center comparison technology in the breeding farm, the pig video streaming data is automatically audited, which solves the problem of traditional manual statistics dependence and achieves efficient and accurate data supervision and alarm.

CN118644873BActive Publication Date: 2025-02-14ZHENGDA AGRI SCI RES CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410523388.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-28
Publication Date
2025-02-14
Estimated Expiration
2044-04-28

AI Technical Summary

Technical Problem

In the traditional animal husbandry industry, the statistics of pig-related data rely on labor, which consumes a lot of manpower and time costs, and there are statistical errors, making problems unable to be discovered in time.

Method used

By target detection of pig video stream data based on the target detection algorithm, pig feature data is obtained, and the distance between the clustering center and the target pig data is compared, automatic auditing and alarm information is generated.

Benefits of technology

It realizes automatic auditing and alerting of aquaculture production data, quickly discover production abnormalities, reduce labor costs, and improve data accuracy and timeliness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118644873B_ABST
    Figure CN118644873B_ABST
Patent Text Reader

Abstract

The present invention provides a pig data audit alarm method, device, electronic device and medium, belonging to the field of data processing technology. The method includes: based on a target detection algorithm, performing target detection on pig video stream data at different times in a first time period to obtain at least one pig feature data; based on the cluster center of at least one pig feature data, calculating the distance between the cluster center and the target pig data, the target pig data is used to indicate the pig feature data input by the user in a second time period; based on the distance between the cluster center and the target pig data, determining the pig feature data associated with the target pig data in at least one pig feature data; based on the associated pig feature data and the target pig data, auditing to obtain difference information, the difference information is used to generate alarm information. The pig data audit alarm method provided by the present invention can realize automated audit alarms for pig data, thereby quickly discovering production anomalies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a pig data audit alarm method, device, electronic equipment and medium. Background Art

[0002] In traditional animal husbandry, pig-related data is usually collected manually, which requires a lot of manpower and time, and there are statistical errors, which makes it difficult to reduce breeding costs; problems may not be discovered in a timely manner and are highly dependent on the subjective judgment of observers.

[0003] In modern agriculture, automation technology is increasingly being used to improve production efficiency, reduce costs and reduce environmental impact. The pig access channel is a must for pigs to enter and exit the farm. How to conduct automated audit and supervision of the pig access channel is of great significance to reducing costs and increasing efficiency of the farm. Summary of the invention

[0004] The present invention provides a pig data audit alarm method, device, electronic equipment and medium, which are used to solve the problem that manual supervision of pig-related data in the prior art has errors and is time-consuming and labor-intensive.

[0005] The present invention provides a pig data audit alarm method, comprising:

[0006] Based on the target detection algorithm, target detection is performed on the pig video stream data at different times within the first period to obtain at least one piece of pig feature data, where each moment corresponds to one piece of pig feature data;

[0007] Based on the cluster center of the at least one piece of pig characteristic data, calculating the distance between the cluster center and the target pig data, the target pig data is used to indicate the pig characteristic data input by the user in a second time period, and the start time of the first time period is earlier than the start time of the second time period;

[0008] Based on the distance between the cluster center and the target pig data, determining the pig feature data associated with the target pig data in the at least one pig feature data;

[0009] An audit is performed based on the associated pig characteristic data and the target pig data to obtain difference information, and the difference information is used to generate alarm information.

[0010] In some embodiments, the step of calculating the distance between the cluster center and the target pig data based on the cluster center of the at least one pig feature data comprises:

[0011] Selecting one piece of the at least one piece of pig characteristic data as an initial cluster center, and calculating the distance between the initial cluster center and the target pig data;

[0012] Add the pig feature data one by one, and each time a piece of pig feature data is added, re-determine the cluster center based on all the added pig feature data to determine an updated cluster center;

[0013] Based on the updated cluster center, the distance between the updated cluster center and the target pig data is determined.

[0014] In some embodiments, the step of determining the pig feature data associated with the target pig data in the at least one pig feature data based on the distance between the cluster center and the target pig data comprises:

[0015] Determine a minimum distance based on the distance between the initial cluster center and the target pig data, and the distance between the effective cluster center and the target pig data;

[0016] Determining the pig feature data corresponding to the minimum distance in the at least one piece of pig feature data;

[0017] When the minimum distance is less than the first distance threshold, the pig characteristic data corresponding to the minimum distance is determined as the pig characteristic data associated with the target pig data.

[0018] In some embodiments, determining the effective cluster center based on the updated cluster center includes:

[0019] Determining the distance between any two cluster centers among the initial cluster centers and the updated cluster centers;

[0020] When the distance between the arbitrary two cluster centers is less than the second distance threshold, the arbitrary two cluster centers are determined to be valid cluster centers.

[0021] In some embodiments, the pig characteristic data include: event time, pig type, pig number, pig age, pig weight and entry and exit direction.

[0022] In some embodiments, the target detection algorithm is used to perform target detection on the pig video stream data at different times within the first period of time to obtain at least one piece of pig feature data, including:

[0023] Performing target detection on the pig video stream data based on the target detection algorithm, and determining the position coordinates of the same target pig in the first frame image and the last frame image of the pig video stream data;

[0024] Determine a movement vector of the target pig based on the position coordinates of the target pig in the first frame image and the last frame image;

[0025] Determining a direction vector based on a preset entry and exit direction corresponding to the pig video stream data;

[0026] Based on the direction vector and the movement vector, the entry and exit direction of the target pig is determined.

[0027] In some embodiments, the step of determining the entry and exit direction of the target pig based on the direction vector and the movement vector includes:

[0028] Perform a dot product of the direction vector and the movement vector to obtain a dot product result;

[0029] When the dot product result is greater than zero, the entry and exit direction of the target pig is pig out;

[0030] When the dot product result is less than zero, the entry and exit direction of the target pig is pig entry.

[0031] The present invention also provides a pig data audit alarm device, comprising:

[0032] An acquisition module, used for performing target detection on the pig video stream data at different moments in the first period based on a target detection algorithm to obtain at least one piece of pig feature data, wherein each moment corresponds to one piece of pig feature data;

[0033] A processing module, for calculating the distance between the cluster center and target pig data based on the cluster center of the at least one piece of pig feature data, wherein the target pig data is used to indicate the pig feature data input by the user in a second time period, and the start time of the first time period is earlier than the start time of the second time period;

[0034] A determination module, configured to determine, based on the distance between the cluster center and the target pig data, the pig feature data associated with the target pig data in the at least one pig feature data;

[0035] An audit module is used to perform an audit based on the associated pig characteristic data and the target pig data to obtain difference information, and the difference information is used to generate alarm information.

[0036] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, any of the above-mentioned pig data audit and alarm methods is implemented.

[0037] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the pig data audit alarm method as described in any one of the above is implemented.

[0038] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements any of the above-mentioned pig data audit and alarm methods.

[0039] The pig data audit and alarm method, device, electronic device and medium provided by the present invention automatically obtain at least one pig feature data and perform feature comparison with the target feature data input by the subsequent user to realize automated audit and alarm of breeding production data, thereby quickly discovering production anomalies. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0041] Figure 1 It is a flow chart of the pig data audit alarm method provided by the present invention;

[0042] Figure 2 It is a schematic diagram of the overall structure of the pig data audit alarm method provided by the present invention;

[0043] Figure 3 Schematic diagram of target detection algorithm of the pig data audit alarm method provided by the present invention;

[0044] Figure 4 It is a schematic diagram of the camera field of view area of ​​the pig data audit alarm method provided by the present invention;

[0045] Figure 5 This is one of the video image schematic diagrams of the pig data audit alarm method provided by the present invention;

[0046] Figure 6 This is the second video image schematic diagram of the pig data audit alarm method provided by the present invention;

[0047] Figure 7 It is a schematic diagram of the data audit process of the pig data audit alarm method provided by the present invention;

[0048] Figure 8 It is a structural schematic diagram of the pig data audit alarm device provided by the present invention;

[0049] Fig. 9 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0051] Combine the following Figure 1-Figure 9 The present invention describes the pig data audit alarm method, device, electronic equipment and medium.

[0052] Figure 1 Schematic diagram of the process of the pig data audit alarm method provided by the present invention. Figure 1 The pig data audit and alarm method provided by the present invention comprises:

[0053] Step 110: Based on the target detection algorithm, target detection is performed on the pig video stream data at different moments in the first period to obtain at least one piece of pig feature data, where each moment corresponds to one piece of pig feature data;

[0054] Step 120, based on the cluster center of at least one piece of pig characteristic data, calculating the distance between the cluster center and the target pig data, the target pig data is used to indicate the pig characteristic data input by the user in the second time period, and the start time of the first time period is earlier than the start time of the second time period;

[0055] Step 130: determining the pig characteristic data associated with the target pig data in at least one piece of pig characteristic data based on the distance between the cluster center and the target pig data;

[0056] Step 140: Audit the associated pig feature data and target pig data to obtain difference information, which is used to generate alarm information.

[0057] In actual implementation, the pig data audit alarm method of the present invention can realize automatic recording of production-related data of pigs passing through the entry and exit channels by setting up artificial intelligence (AI) in the farm to automatically audit the entry and exit channels.

[0058] At the entrances and exits, cameras and fixed light sources are installed in accordance with standards to obtain video stream data of pigs 24 hours a day.

[0059] like Figure 2As shown in the figure, the AI ​​perception algorithm is used to detect the target of the pig video stream data entering and exiting the channel. Among them, the AI ​​perception algorithm includes but is not limited to the region with CNN feature (R-CNN) algorithm, the fast region convolutional neural network fast R-CNN algorithm, the faster region convolutional neural network faster R-CNN algorithm, the yolo series algorithm and the single shot multibox detection (Single Shot MultiBox Detector, SSD) and other target detection algorithms.

[0060] Since multiple segments of pig video stream data can be obtained within the first time window T1, pig feature data can be extracted at different moments within the first time window T1, and one piece of pig feature data can be obtained at each moment. The first time window T1 refers to the first time period in step 110.

[0061] It should be noted that at different moments in the first time window T1, pig characteristic data of each pig can be extracted at each moment, and a data record can be formed at each moment, and a data record is a piece of pig characteristic data. Among them, the pig characteristic data can be represented by a feature vector composed of production-related characteristics of the pig.

[0062] In step 110, at least one piece of pig characteristic data may be pig characteristic data obtained after target detection is performed on the same pig at different times, or may include pig characteristic data obtained after target detection is performed on all pigs at different times.

[0063] In some embodiments, the pig characteristic data includes: event time, pig type, pig number, pig age, pig weight, and entry and exit direction.

[0064] It should be noted that event time refers to the time when pigs enter and exit; pig types include dead pigs or live pigs, which are used to determine the number of pigs that are dead and culled; the number of pigs refers to the number of pigs passing through the entry and exit channel; the age of the pigs is calculated from the day the pigs are born, which is used to determine the growth stage of the pigs; the weight of the pigs is used to understand the growth status of the pigs and to carry out feeding management; the entry and exit direction is used to determine the movement direction of the pigs for accurate counting.

[0065] In the second time window T2, the breeding production personnel enter the production data into the system, and can obtain information such as the number of pigs, the number of deaths, the weight of pigs, and the age of pigs, so as to form target pig data corresponding to the pig characteristic data. The target pig data is the data related to the pigs that need to be audited. Among them, the second time window T2 refers to the second time period in step 120.

[0066] The second time window T2 lags behind the first time window T1, that is, the start time corresponding to the first time window T1 is earlier than the start time of the second time window T2.

[0067] Within a certain time window, the pig feature data obtained by the AI ​​perception algorithm is compared with the production data (target pig data) through the AI ​​audit algorithm, and the comparison difference information is output for alarm judgment.

[0068] Combine the following Figure 3 The process of extracting pig feature data by the target detection algorithm is described in detail.

[0069] like Figure 3 As shown, the target detection algorithm includes filtering tasks, the filtering tasks include detection tasks, classification tasks and timing tasks, and the detection tasks include counting tasks and regression tasks.

[0070] 1. Filtering tasks

[0071] The filtering task is used to quickly determine whether there are pigs in the video. The video stream marked as containing pigs can save the pig video stream data for a fixed or preset duration, otherwise it will not be saved. The saved pig video stream data is used to perform subsequent detection tasks, which can save computing power.

[0072] 2. Detection tasks

[0073] The detection task is used to detect the position coordinates of the pigs in each frame of the video stream data of the pigs, which can be determined by algorithms such as target detection algorithm and image segmentation algorithm.

[0074] Pig training sample data may be affected by various complex scenes, camera angles and lighting environments. If computing power permits, the input layer size of the deep neural network can be set to the camera pixel size and the downsampling layer in the network structure can be reduced.

[0075] The confidence threshold of the detector used to perform the detection task can be set to be greater than the confidence mean - 1.96*confidence standard deviation or greater than the confidence mean - 2.58*confidence standard deviation. The pig area filtering threshold in the video image is greater than the area mean - area standard deviation, thereby further improving the recall rate and accuracy of pig detection, as well as the detection and recognition capabilities of complex scenes.

[0076] 3. Classification Task

[0077] The classification task is used to use a lightweight deep convolutional neural network to obtain a trained pig type classification model based on pig training sample data to identify pig types, such as dead pigs or live pigs.

[0078] 4. Timing Tasks

[0079] The timing task is used to record the time information of the pigs’ appearance. It is obtained by adding the start time of the pigs’ video stream data to the relative time when the pigs appear in the pigs’ video stream data.

[0080] 5. Regression Task

[0081] The regression task is used to extract pig characteristics such as pig area, body length and body width based on the detection task, establish a regression model for the relationship between pig characteristics and pig age and pig weight, and predict pig age and pig weight.

[0082] 6. Counting Task

[0083] The counting task is used to count the pigs appearing in the video stream data, determine the number of pigs, and determine the entry and exit directions of the pigs.

[0084] The following uses the pig's movement from left to right as an example to illustrate the direction, and the same applies to other movement directions.

[0085] like Figure 4 As shown in the figure, in order to effectively solve the problem of pig counting accuracy in the entrance and exit channels, the camera field of view is logically divided into Figure 4 There are several areas in the counting process, each of which plays a different role in the counting process, and is used to accurately count the pigs and determine their entry and exit directions.

[0086] The starting area is the starting area for the pigs to be driven and moved. A certain pixel width is reserved to ensure that the pigs’ moving target tracking will start only when their contour features are sufficiently exposed.

[0087] The tracking area is the pig motion tracking area. The motion tracking in this area provides a basis for the subsequent pig counting. In the tracking area, the motion tracking of each pig is realized. The position coordinates of the same pig between the previous and next frame images in the video can be output based on the detection task and associated through the Hungarian algorithm. In order to further improve the stability of the tracker, the Kalman filter algorithm is used to predict the position coordinates of the tracked pig in the next frame image, and then this position coordinate is used to associate with the position coordinates output by the detection task.

[0088] Each video segment saves the tracking status. When reading the next video segment, the tracking status data of the previous video segment is loaded, thereby achieving the purpose of continuous and stable counting of video segments.

[0089] like Figure 5 and Figure 6 As shown, it is the end and start of the two video segments. Figure 5 The video images in the figure show pig counts from 19 to 58. Figure 6The video image in FIG. 1 shows that the pig counting continues from 58, achieving the effect of counting pigs by continuous video clips.

[0090] The function of the buffer zone is to deal with the problems of pig occlusion, pig riding on pigs and loss of tracking of moving pigs. The width of the buffer zone is adjustable. When the width changes from large to small, the pig counting conditions will change from relaxed to strict.

[0091] In some embodiments, step 110 may include:

[0092] Performing target detection on the pig video stream data based on the target detection algorithm, determining the position coordinates of the same target pig in the first frame image and the last frame image of the pig video stream data;

[0093] Determine the moving vector of the target pig based on the position coordinates of the target pig in the first frame image and the last frame image;

[0094] Determine a direction vector based on a preset entry and exit direction corresponding to the pig video stream data;

[0095] Based on the direction vector and movement vector, the entry and exit direction of the target pig is determined.

[0096] In actual implementation, the detection task can determine the position coordinates of the same target pig in the first and last frames of any pig video stream data. The target pig's movement vector can be obtained by subtracting the target pig's position coordinates in the first frame from the target pig's position coordinates in the last frame.

[0097] In this step, the preset entry and exit directions of the pigs in the pig video stream data can be set according to the actual situation, and are not fixed, and can be determined according to the relative position of the channel in the video image. For example: the left is the direction for the pigs to exit, the right is the direction for the pigs to enter, or the obliquely upward is the direction for the pigs to exit, the obliquely downward is the direction for the pigs to exit, etc. According to the preset entry and exit directions, a direction vector can be introduced.

[0098] Perform dot product of the direction vector and the movement vector, and determine the pig's entry and exit direction based on the dot product result.

[0099] In some embodiments, based on the direction vector and the movement vector, determining the entry and exit direction of the target pig includes:

[0100] Perform dot product of the direction vector and the movement vector to obtain the dot product result;

[0101] When the dot product result is greater than zero, the target pig’s entry and exit direction is pig out;

[0102] When the dot product result is less than zero, the target pig's entry and exit direction is pig-in.

[0103] In actual implementation, the pigs' entry and exit directions are determined by introducing a movement vector and a direction vector, and the dot product of the movement vector and the direction vector is performed to obtain a dot product result.

[0104] If the dot product result is greater than zero, the pig is out, and if the dot product result is less than zero, the pig is in. This can determine the entry and exit direction of the target pig, and then the pig counting in different entry and exit directions can be achieved.

[0105] Figure 4 The end zone is the area where the pigs leave the camera's field of view. When they enter the end zone, the pigs stop tracking and start counting. There are two specific situations:

[0106] In the first case, when the pig's tracking trajectory can completely cover the entire interval from the starting area to the ending area, it is counted as a valid count.

[0107] In the second case, when the pig tracking trajectory cannot completely cover the entire interval from the starting area to the end area, that is, the pig movement tracking is lost due to occlusion, pig riding pigs and detector problems, the buffer size is adjusted to achieve counting. The specific description is as follows: a pig that is stably tracked from the starting area to cross the left boundary of the buffer, or a pig that is stably tracked from the buffer to cross the end area, is counted as a valid count. Therefore, the wider the buffer, the higher the probability that the pig counting result is greater than the true value, and vice versa, the probability that the pig counting result is lower than the true value increases.

[0108] Theoretically, assuming that the above system only considers the first case, the pig counting accuracy is a. Through this counting method, the accuracy can be improved to:

[0109]

[0110] Among them, w buffer is the pixel width of the buffer, w track is the pixel width of the tracking area. From the formula, we can see that when w buffer When it approaches 0, the accuracy can be improved to 100%. However, it is not recommended to set the buffer width to 0. The actual application results show that the conditions are too strict and the counting results may be lower than the actual value. The counting accuracy effect is shown in Table 1.

[0111] Table 1

[0112]

[0113] After extracting at least one piece of pig characteristic data to be audited, AI automated audit is performed by comparing the manually input breeding production data, i.e., the target pig data. The breeding production data includes manually determined pig characteristic data.

[0114] Based on the pig feature data extracted by AI perception algorithm, AI automated audit is performed by comparing the target pig data. Figure 7 As shown, the pig feature data extracted by the AI ​​perception algorithm is automatically generated in the first time window T1, and the target pig data is entered into the production system in the second time window T2. The two are randomly asynchronous in time, and the corresponding relationship between the two is one-to-one or many-to-one. Based on the above characteristics, an automatic feature comparison AI audit algorithm is proposed. Figure 7 Each data record corresponds to a piece of pig feature data extracted based on the AI ​​perception algorithm.

[0115] It should be noted that the pig feature data extracted based on the pig video stream data is usually data collected within a preset time period, that is, at least one piece of pig feature data to be audited is generated. The preset time period can be one day, half a day or a custom time period. The first time window can be any period of time in the preset time period.

[0116] In a data audit process, the start time of the first time window T1 is earlier than the start time of the second time window T2. The first time window T1 is a dynamic sliding window, and the second time window T2 is a fixed time window. After the audit is completed, the audited pig feature data is removed from the pig feature data to be audited, and then the next audit can be carried out.

[0117] The data audit process for pig characteristic data and target characteristic data is explained below.

[0118] The input of the data audit process is: the characteristic data D of the pigs to be audited 1 and target pig data D 2 . D 1 and D 2 The corresponding feature vector is: [time,type,nums,age,wgh,direct].

[0119] Among them, time represents the event time, type represents the pig type, nums represents the number of pigs, age represents the age of the pigs, wgh represents the weight of the pigs, and direct represents the direction of entry and exit.

[0120] The output of the data audit process is: Pig characteristic data D 1 and target pig data D 2 The difference information and event time between them. The difference information includes quantity difference, weight difference and age difference, and the event time includes pig characteristic data D 1 Generation time and target pig data D 2 The entry time of (breeding production data).

[0121] In actual implementation, a first time window T1 and a second time window T2 are initialized.

[0122] Initialize the first threshold distance d th , the first threshold distance d th The distance determination threshold between the cluster center of the pig characteristic data and the target pig data is used to determine the correlation between the pig characteristic data and the target pig characteristic data.

[0123] Initialize the second threshold distance d in , the second threshold distance d in It represents the intra-class threshold distance, that is, the category determination threshold of the pig feature data, which is used to judge the validity of the cluster center and then judge the correlation between different pig feature data.

[0124] Initialize the cluster center of at least one pig feature data.

[0125] In step 110, any one or more pieces of pig feature data may be selected from at least one piece of pig feature data, and different cluster centers may be determined, and then the distance between the cluster center and the target feature data may be determined.

[0126] It is understandable that the correlation between the pig characteristic data and the target characteristic data is unknown, that is, the correlation relationship needs to be established first. The correlation relationship is used to indicate that the data statistical period corresponding to the pig characteristic data is associated with the data statistical period of the target characteristic data. For example: the pig characteristic data extracted from 0 o'clock to 10 o'clock is associated with the target characteristic data manually input at 10 o'clock.

[0127] The distance between the cluster center and the target feature data can be used to determine the pig feature data associated with the target feature data.

[0128] In some embodiments, step 120 may include:

[0129] Selecting one piece of at least one piece of pig characteristic data as an initial cluster center, and calculating the distance between the initial cluster center and the target pig data;

[0130] Add pig feature data piece by piece, and for each added pig feature data, re-determine the cluster center based on all the added pig feature data to determine the updated cluster center;

[0131] Based on the updated cluster centers, determine the effective cluster centers;

[0132] Determine the distance between the effective cluster center and the target pig data.

[0133] In actual implementation, the distance between the initial cluster center and the target pig data is calculated first.

[0134] Optionally, at least one piece of pig feature data may be arranged in the order of data generation time, and the initial cluster center may be determined based on the earliest piece of pig feature data generated. Of course, any piece of pig feature data from at least one pig feature may also be selected to determine the pig feature data.

[0135] Then, pig feature data is added one by one, and the cluster center is re-determined each time a pig feature data is added. For example, the first pig feature data is the initial cluster center, and then a pig feature data is added, and all the pig feature data after the addition become two pig feature data, and then the cluster center of the two pig feature data is re-determined; or multiple pig feature data are added, and the cluster center of multiple pig feature data is re-determined.

[0136] It is understandable that the re-determined cluster center needs to be judged for its validity. This step is performed by using the second distance threshold d in The specific judgment process will be described in the subsequent embodiments.

[0137] In some embodiments, step 130 may include:

[0138] Determine the minimum distance based on the distance between the initial cluster center and the target pig data, and the distance between the effective cluster center and the target pig data;

[0139] Determine the pig characteristic data corresponding to the minimum distance in at least one piece of pig characteristic data;

[0140] When the minimum distance is less than the first distance threshold, the pig feature data corresponding to the minimum distance is determined as the pig feature data associated with the target pig data.

[0141] In actual implementation, after determining the distance between the effective cluster center and the target pig data, it is compared with the distance between the initial cluster center calculated last time or other effective cluster centers and the target pig data, and this process is repeated until the cluster center corresponding to the minimum distance is obtained. When the minimum distance is less than the first threshold distance d th In the case of, the pig characteristic data corresponding to the cluster center is determined as the pig characteristic data associated with the target pig data. The pig characteristic data corresponding to the cluster center is audited with the target pig data, and the difference information and event time are output.

[0142] If the minimum distance exceeds the first threshold distance d th , then the pig feature data corresponding to the cluster center does not have associated target pig data.

[0143] In some embodiments, determining effective cluster centers based on updated cluster centers includes:

[0144] Determine the distance between any two cluster centers among the initial cluster centers and the updated cluster centers;

[0145] When the distance between any two cluster centers is less than the second distance threshold, the any two cluster centers are determined to be valid cluster centers.

[0146] If the distance between any two cluster centers is less than the second distance threshold d in , indicating that the pig feature data corresponding to the two cluster centers have an associated relationship, which can be used to determine the pig feature data associated with the target pig data as a valid cluster center.

[0147] In actual implementation, the data audit process can be performed according to the following steps:

[0148] Step 1: Initialize the dynamic sliding window (first time window) W d =1, fixed sliding window (second time window) W f = Maximum business data entry delay time.

[0149] Step 2: Initialize the first threshold distance d th , the first threshold distance d th Represents the distance determination threshold between the cluster center of the pig feature data and the target pig data.

[0150] Step 3: Initialize the second threshold distance d in , the second threshold distance d in Represents the intra-class threshold distance, that is, the category determination threshold of pig feature data.

[0151] Step 4: Initialize the cluster center of at least one pig feature data Denotes the dynamic sliding window W d =1 The initial cluster center corresponding to the first pig feature data in the window range.

[0152] Step 5: Initialize d 0 =d 1 =min(dis(C 1 ,C 1 [0]+W f )),d 0 Represents the initial cluster center C 0 With the target feature data C 1 [0] The initial distance between 1 Represents the new cluster center C 1 With the target feature data C 1 [0] In a fixed sliding window W fThe minimum distance between each target feature data within C 1 [0] indicates that in a fixed sliding window W f The target feature data at the initial moment within.

[0153] Step 6: Loop through steps 7 to 15 or loop through steps 7 to 19 until the break condition for terminating the loop is met.

[0154] Step 7: Update the dynamic sliding window: W d =W d +1.

[0155] Step 8: If the distance C between two cluster centers 1 -C 0 <d in , then go to step 9. If C 1 -C 0 <d in , indicating that the new cluster center C 1 is a valid cluster center, then C can be calculated 1 With the target feature data C 1 [0] The distance between

[0156] Step 9: Execute update cluster center: C 0 =C 1 ,

[0157] Step 10: If d 0 -d 1 >0, update the minimum distance: d 0 =d 1 , d 1 =min(dis(C 1 ,C 1 [0]+W f )) is used to determine the cluster center corresponding to the minimum distance.

[0158] Step 11: If d 1 -d 0 >0 or D 1 [W d ][0]-D 1 [1][0]>W f , then d 0 and the first threshold distance d th Perform size comparison and go to step 12.

[0159] Among them, D 1 [W d ][0]-D 1 [1][0]>W fIndicates that the time difference between the pig characteristic data at two moments exceeds the maximum business lag time limit.

[0160] Step 12: If d 0 >d th , then go to step 13.

[0161] Step 13: Output unaudited to cluster center C 0 Corresponding target pig data D 2 , that is, the cluster center C 0 Corresponding pig characteristic data and target pig data D 2 No association.

[0162] Step 14: D 1 ←rm(D 1 ,C 0 ), remove the pig characteristic data D to be audited 1 The cluster center C 0 Corresponding pig characteristic data.

[0163] Step 15: Break

[0164] Step 16: On the contrary, if d th >d 0 , indicating that the cluster center C 0 Corresponding pig characteristic data and target pig data D 2 If there is a correlation, go to step 17.

[0165] Step 17: Output cluster center C 0 Pig characteristic data corresponding to the category and target pig data D 2 The difference between information and event time.

[0166] Step 18: D 2 ←rm(D 2 ,d 0 ), remove the target pig data D 2 The minimum distance d 0 The corresponding data indicates that the target pig data has been audited.

[0167] Step 19: Break

[0168] By repeatedly executing the above steps 1 to 19, the newly added pig characteristic data is continuously audited. The audit algorithm outputs the quantity difference, weight difference, and age difference information of the corresponding production data after the audit, which can be used for subsequent audit alarms, and the alarm threshold can also be flexibly set based on the age and weight of the pig.

[0169] The pig data audit and alarm method provided by the present invention realizes automated audit and alarm of breeding production data by automatically acquiring at least one piece of pig feature data and performing feature comparison with target feature data subsequently input by the user, thereby quickly discovering production anomalies.

[0170] The pig data audit alarm device provided by the present invention is described below. The pig data audit alarm device described below and the pig data audit alarm method described above can be referenced to each other.

[0171] Figure 8 This is a schematic diagram of the structure of the pig data audit alarm device provided by the present invention. Figure 8 The pig data audit alarm device provided by the present invention comprises:

[0172] An acquisition module 810 is used to perform target detection on the pig video stream data at different times within the first period based on a target detection algorithm to obtain at least one piece of pig feature data, where each moment corresponds to one piece of pig feature data;

[0173] A processing module 820 is used to calculate the distance between the cluster center and the target pig data based on the cluster center of the at least one pig feature data, wherein the target pig data is used to indicate the pig feature data input by the user in a second time period, and the start time of the first time period is earlier than the start time of the second time period;

[0174] A determination module 830, configured to determine, based on the distance between the cluster center and the target pig data, the pig feature data associated with the target pig data in the at least one pig feature data;

[0175] The audit module 840 is used to perform an audit based on the associated pig characteristic data and the target pig data to obtain difference information, and the difference information is used to generate alarm information.

[0176] The pig data audit and alarm device provided by the present invention automatically obtains at least one piece of pig feature data and performs feature comparison with target feature data subsequently input by the user to realize automated audit and alarm of breeding production data, thereby quickly discovering production anomalies.

[0177] In some embodiments, the processing module 820 is specifically configured to:

[0178] Selecting one piece of the at least one piece of pig characteristic data as an initial cluster center, and calculating the distance between the initial cluster center and the target pig data;

[0179] Add the pig feature data one by one, and each time a piece of pig feature data is added, re-determine the cluster center based on all the added pig feature data to determine an updated cluster center;

[0180] Based on the updated cluster center, the distance between the updated cluster center and the target pig data is determined.

[0181] In some embodiments, the determining module 830 is specifically configured to:

[0182] Determine a minimum distance based on the distance between the initial cluster center and the target pig data, and the distance between the effective cluster center and the target pig data;

[0183] Determining the pig feature data corresponding to the minimum distance in the at least one piece of pig feature data;

[0184] When the minimum distance is less than the first distance threshold, the pig characteristic data corresponding to the minimum distance is determined as the pig characteristic data associated with the target pig data.

[0185] In some embodiments, the apparatus further comprises:

[0186] An updating module, used for determining the distance between any two cluster centers among the initial cluster centers and the updated cluster centers;

[0187] When the distance between the arbitrary two cluster centers is less than the second distance threshold, the arbitrary two cluster centers are determined to be valid cluster centers.

[0188] In some embodiments, the pig characteristic data include: event time, pig type, pig number, pig age, pig weight and entry and exit direction.

[0189] In some embodiments, the acquisition module 810 is specifically used to:

[0190] Performing target detection on the pig video stream data based on the target detection algorithm, and determining the position coordinates of the same target pig in the first frame image and the last frame image of the pig video stream data;

[0191] Determine a movement vector of the target pig based on the position coordinates of the target pig in the first frame image and the last frame image;

[0192] Determining a direction vector based on a preset entry and exit direction corresponding to the pig video stream data;

[0193] Based on the direction vector and the movement vector, the entry and exit direction of the target pig is determined.

[0194] In some embodiments, the acquisition module 810 is specifically used to:

[0195] Perform a dot product of the direction vector and the movement vector to obtain a dot product result;

[0196] When the dot product result is greater than zero, the entry and exit direction of the target pig is pig out;

[0197] When the dot product result is less than zero, the entry and exit direction of the target pig is pig entry.

[0198] Fig. 9 An example of a physical structure diagram of an electronic device is shown in FIG. Fig. 9 As shown, the electronic device may include: a processor 910, a communications interface 920, a memory 930 and a communication bus 940, wherein the processor 910, the communications interface 920 and the memory 930 communicate with each other via the communication bus 940. The processor 910 may call the logic instructions in the memory 930 to execute the pig data audit alarm method, which includes:

[0199] Based on the target detection algorithm, target detection is performed on the pig video stream data at different times within the first period to obtain at least one piece of pig feature data, where each moment corresponds to one piece of pig feature data;

[0200] Based on the cluster center of the at least one piece of pig characteristic data, calculating the distance between the cluster center and the target pig data, the target pig data is used to indicate the pig characteristic data input by the user in a second time period, and the start time of the first time period is earlier than the start time of the second time period;

[0201] Based on the distance between the cluster center and the target pig data, determining the pig feature data associated with the target pig data in the at least one pig feature data;

[0202] An audit is performed based on the associated pig characteristic data and the target pig data to obtain difference information, and the difference information is used to generate alarm information.

[0203] In addition, the logic instructions in the above-mentioned memory 930 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0204] On the other hand, the present invention further provides a computer program product, the computer program product includes a computer program, the computer program can be stored on a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the pig data audit alarm method provided by the above methods, the method includes:

[0205] Based on the target detection algorithm, target detection is performed on the pig video stream data at different times within the first period to obtain at least one piece of pig feature data, where each moment corresponds to one piece of pig feature data;

[0206] Based on the cluster center of the at least one piece of pig characteristic data, calculating the distance between the cluster center and the target pig data, the target pig data is used to indicate the pig characteristic data input by the user in a second time period, and the start time of the first time period is earlier than the start time of the second time period;

[0207] Based on the distance between the cluster center and the target pig data, determining the pig feature data associated with the target pig data in the at least one pig feature data;

[0208] An audit is performed based on the associated pig characteristic data and the target pig data to obtain difference information, and the difference information is used to generate alarm information.

[0209] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the pig data audit alarm method provided by the above methods, the method comprising:

[0210] Based on the target detection algorithm, target detection is performed on the pig video stream data at different times within the first period to obtain at least one piece of pig feature data, where each moment corresponds to one piece of pig feature data;

[0211] Based on the cluster center of the at least one piece of pig characteristic data, calculating the distance between the cluster center and the target pig data, the target pig data is used to indicate the pig characteristic data input by the user in a second time period, and the start time of the first time period is earlier than the start time of the second time period;

[0212] Based on the distance between the cluster center and the target pig data, determining the pig feature data associated with the target pig data in the at least one pig feature data;

[0213] An audit is performed based on the associated pig characteristic data and the target pig data to obtain difference information, and the difference information is used to generate alarm information.

[0214] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0215] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0216] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A pig data audit alarm method, characterized in that: include: Based on the target detection algorithm, target detection is performed on the pig video stream data at different times within the first period to obtain at least one piece of pig feature data, where each moment corresponds to one piece of pig feature data; Based on the cluster center of the at least one piece of pig characteristic data, calculating the distance between the cluster center and the target pig data, the target pig data is used to indicate the pig characteristic data input by the user in a second time period, and the start time of the first time period is earlier than the start time of the second time period; Based on the distance between the cluster center and the target pig data, determining the pig feature data associated with the target pig data in the at least one pig feature data; Auditing the associated pig characteristic data and the target pig data to obtain difference information, wherein the difference information is used to generate alarm information; The step of calculating the distance between the cluster center and the target pig data based on the cluster center of the at least one piece of pig feature data comprises: Selecting one piece of the at least one piece of pig characteristic data as an initial cluster center, and calculating the distance between the initial cluster center and the target pig data; Add the pig feature data one by one, and each time a piece of pig feature data is added, re-determine the cluster center based on all the added pig feature data to determine an updated cluster center; Based on the updated cluster centers, determining effective cluster centers; Determine the distance between the effective cluster center and the target pig data; The step of determining the pig feature data associated with the target pig data in the at least one piece of pig feature data based on the distance between the cluster center and the target pig data comprises: Determine a minimum distance based on the distance between the initial cluster center and the target pig data, and the distance between the effective cluster center and the target pig data; Determining the pig feature data corresponding to the minimum distance in the at least one piece of pig feature data; When the minimum distance is less than the first distance threshold, the pig characteristic data corresponding to the minimum distance is determined as the pig characteristic data associated with the target pig data.

2. The pig data audit alarm method according to claim 1, characterized in that: The determining of the effective cluster center based on the updated cluster center includes: Determining the distance between any two cluster centers among the initial cluster centers and the updated cluster centers; When the distance between the arbitrary two cluster centers is less than the second distance threshold, the arbitrary two cluster centers are determined to be valid cluster centers.

3. The pig data audit alarm method according to any one of claims 1-2, characterized in that: The pig characteristic data include: event time, pig type, pig quantity, pig age, pig weight and entry and exit direction.

4. The pig data audit alarm method according to claim 3, characterized in that: The target detection algorithm is used to perform target detection on the pig video stream data at different times in the first period of time to obtain at least one piece of pig feature data, including: Performing target detection on the pig video stream data based on the target detection algorithm, and determining the position coordinates of the same target pig in the first frame image and the last frame image of the pig video stream data; Determine a movement vector of the target pig based on the position coordinates of the target pig in the first frame image and the last frame image; Determining a direction vector based on a preset entry and exit direction corresponding to the pig video stream data; Based on the direction vector and the movement vector, the entry and exit direction of the target pig is determined.

5. The pig data audit alarm method according to claim 4, characterized in that: The step of determining the entry and exit direction of the target pig based on the direction vector and the movement vector includes: Perform a dot product of the direction vector and the movement vector to obtain a dot product result; When the dot product result is greater than zero, the entry and exit direction of the target pig is pig out; When the dot product result is less than zero, the entry and exit direction of the target pig is pig entry.

6. A pig data audit alarm device, characterized in that: include: An acquisition module, used for performing target detection on the pig video stream data at different moments in the first period based on a target detection algorithm to obtain at least one piece of pig feature data, wherein each moment corresponds to one piece of pig feature data; A processing module, for calculating the distance between the cluster center and the target pig data based on the cluster center of the at least one pig feature data, wherein the target pig data is used to indicate the pig feature data input by the user within a second time period, and the starting time of the first time period is earlier than the starting time of the second time period; wherein the calculation of the distance between the cluster center and the target pig data based on the cluster center of the at least one pig feature data comprises: selecting one of the at least one pig feature data as the initial cluster center, and calculating the distance between the initial cluster center and the target pig data; adding the pig feature data one by one, and for each additional pig feature data, re-determining the cluster center based on all the added pig feature data, and determining an updated cluster center; determining an effective cluster center based on the updated cluster center; and determining the distance between the effective cluster center and the target pig data; A determination module, for determining the pig characteristic data associated with the target pig data in the at least one pig characteristic data based on the distance between the cluster center and the target pig data, specifically comprising: determining a minimum distance based on the distance between the initial cluster center and the target pig data, and the distance between the effective cluster center and the target pig data; determining the pig characteristic data corresponding to the minimum distance in the at least one pig characteristic data; and determining the pig characteristic data corresponding to the minimum distance as the pig characteristic data associated with the target pig data when the minimum distance is less than a first distance threshold; An audit module is used to perform an audit based on the associated pig characteristic data and the target pig data to obtain difference information, and the difference information is used to generate alarm information.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements the pig data audit alarm method as described in any one of claims 1 to 5.

8. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, it implements the pig data audit alarm method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Real-time traffic condition judging method based on time window

    CN102592453A

  • Data processing method and system for animal motion information statistics

    CN111627060A