Implementation of Machine Vision Methods for Cattle Detection and Activity Monitoring - Roman Bumbálek; Tomáš Zoubek; Jean de Dieu Marcel Ufitikirezi; Sandra Nicole Umurungi; Radim Stehlík; Zbyněk Havelka; Radim Kuneš; Petr Bartoš (Technologies)
The goal of this research was to implement machine vision algorithms in a cattle stable to detect cattle in stalls and determine their activities. It also focused on finding the optimal hyperparameter settings for training the model, as balancing prediction accuracy, training time, and computational demands is crucial for real-world implementation. The investigation of suitable parameters was carried out on the YOLOv5 convolutional neural network (CNN). The types of the YOLOv5 network (v5x, v5l, v5m, v5s, and v5n), the effect of the learning rate (0.1, 0.01, and 0.001), the batch size (4, 8, 16, and 32), and the effect of the optimizer used (SGD and Adam) were compared in a step-by-step process. The main focus was on mAP 0.5 and mAP 0.5:0.95 metrics and total training time, and we came to the following conclusions: In terms of optimization between time and accuracy, the YOLOv5m performed the best, with a mAP 0.5:0.95 of 0.8969 (compared to 0.9070 for YOLOv5x). The training time for YOLOv5m was 7:48:19, while YOLOv5x took 16:53:27. When comparing learning rates, the variations in accuracy and training time were minimal. The highest accuracy (0.9028) occurred with a learning rate of 0.001, and the lowest (0.8897) with a learning rate of 0.1. For training time, the fastest was 7:47:17, with a difference of 1:02:00 between the fastest and slowest times. When comparing the effect of batch size, model accuracy showed only minimal differences (in tenths of a percentage), but there were significant time savings. When using a batch size of 8, the training time was 12:50:48, while increasing the batch size to 32 reduced the training time to 6:07:13, thus speeding up the training process by 6:43:35. The last parameter compared was the optimizer. SGD and Adam optimizers were compared. The choice of optimizer had a minimal impact on the training time, with differences only in seconds. However, the accuracy of the trained model was 6 per cent higher (0.8969) when using the SGD optimizer.