# AI-Based Intelligent Monitoring System for Estrus Prediction in the Livestock Industry
## 4 Estrus Prediction Using Livestock Activity Data  
As shown in Figure 2, the method of collecting activity data that has been recently highlighted involves attaching high-performance acceleration sensors for ID classification to cattle and collecting gait information through wireless communication. Using the method, the activities of the target Hanwoo can be measured directly, but it is not recommended in terms of animal welfare because the sensors must be directly attached to the target Hanwoo. Moreover, the meaning of the collected data is highly limited because the data are collected only for the gait information of the target Hanwoos. Therefore, since the image acquired through the camera installed in the farm can be processed into information of various meanings, the activity of the Hanwoo was converted into position data and turned into information. In the development of ARM, individual Hanwoo were defined as groups of similar shape, and activity data of individual Hanwoo were collected and defined into information such as the activities of mounting-motion, moving-path, and specified motion. For the ARM, the image coordinates for the unit time were converted into real-world positions for the Hanwoos, which were distinguished as individual objects from the images acquired in real-time by applying the multiple object tracking technologies, as shown in Figure 6. Then, the activities of the target Hanwoo were converted into data by synchronizing the data for the image acquisition frame times of ARM into cumulative moving distance information. As shown in Figure 6, to collect the location information of individual livestock, the movement distance was measured using the Euclidean distance method for the change of the acquired coordinates (x, y) to (x1, y1) from P1 to P3 of Hanwoo No. 6. The ARM collects the movements of individual Hanwoos over time and the coordinate (X, Y) values of the index (ID) that distinguishes individual objects, as shown in Figure 6. The collected data are quantified and stored as the activity information of individual Hanwoos. The changes in position coordinates of individual Hanwoo in the images can be changed to length changes in a real environment and can be used as actual activity data. The coordinate value of the collected individual Hanwoo can be used to calculate the movements of individual Hanwoos based on the frame changes (frame counter) of input images, and then the coordinate changes based on the pathway of individual Hanwoos can be summed, and that data can be changed to activity data for the Hanwoo's activities analysis. Figure 5: Identification of individual object IDs in a group of similar objects using the ARM. To calculate the actual movements of target objects individually, the changes of the center coordinate P (\(x\), \(y\)) of the recognition area (red square box) of individual target objects, detected in 2D images, were measured every second. The movement distances were calculated by Equations (1) and (2) and then summed every second. The distance data was accumulated on the ID set during the monitoring time. \[\text{L}=\sqrt{x^{2}+y^{2}} \tag{1}\]  
\[\text{D}=\sum_{t=0}^{3600}\sqrt{dx^{2}+dy^{2}} \tag{2}\]  
The total activity value, M(\(t\)), at a time (second, \(t\)), can be determined by an accumulation of the input image frame count numbers as follows:  
\[\text{M}(t)=\sum D(x,y,t) \tag{3}\]  
Therefore, the activity of each individual object at a specific time (\(t\)) can be identified, and if M(\(t\)) is larger than the specific threshold \(k\), it can be considered that the change in activity is large. The threshold \(k\) is normally used as the average activity value for the target object per 1 day. \[\text{A}(t)= \begin{cases}1,M(t)>k\\ 0,otherwise\end{cases}  \tag{4}\]  
A(\(t\)) can be used to determine at which \(t\) there were many movements and abnormal behaviors, such as the mounting activity by the target object.