# Deep Learning Seehive Monitoring System for Early Detection of the Varroa Mite
## 4 Proposed Method for Varroa Mite Early Detection  
Training a Convolutional Neural Network for an object initiates with the collection of the sample of images that contain the objects to be detected. If no object localization applies to the image, then the process involved is a classification process that assists in classifying  
Figure 2: Proposed algorithm process flowchart for the detection of Varroa mite. the entire image contents. On the other hand, suppose the localization of multiple objects in the image is enforced. In that case, the constructed process is a detection one, and it may provide output bounding boxes or masked areas of the detected objects. The first is called object segmentation, while the latter is called instance segmentation. For CNN classifiers or detectors, different models can apply. In this paper, the Regional CNN algorithm Faster R-CNN [42] is used on pre-trained models [43], for the collection of fixed size bounding boxes and confidence scores in the presence of object instances. In these pre-trained models, arbitrary classes can be set, attached, and trained as part of the model's classes. The most well-known algorithms are the Single Shot MultiBox Detector (SSD) [38] and the Faster R-CNN [44]. These algorithms and these used models are the most common because they have been created to balance efficiency and accuracy. The SSD algorithm uses a Convolutional Neural Network (CNN) to input images only once and outputs a feature map [38]. The feature map then goes through a convolutional kernel to predict the bounding boxes and the possibility of classifying them. The Faster-RCNN algorithm uses a small convolutional network called the Region Proposal Network (RPN) to create areas of interest in which the network predicts the probability of being the background or object of interest [44]. For the implementation of their bee-detection process, the authors have selected MobileNet pre-trained CNN models since they are proven lightweight models with short detection times and can be used in embedded systems as part of deep industrial learning real-time or close to real-time applications [45]. Additionally, the authors selected a heavy model such as ResNet-50, with five times more trainable parameters that can be loaded to an embedded device to compare the accuracy results with the ones derived from lightweight models. In this section, the authors describe their process of detecting the Varroa mite inside the beehive. Their proposition includes two steps: (a) use of SSD and Faster-RCNN Convolutional Neural Networks (CNN) including pre-trained models [46, 47] for the detection of bees inside the brood box frames and (b) use of color masking and Hough transformation for the detection of Varroa upon the previously detected bee objects. The algorithmic process used to build the neural networks and carry out the detection of bees is comprised of five steps. The first four are necessary for the CNN bees' object detection process, and the fifth step is required for the edge detection of the Varroa mite on the previously detected contours. The detection process steps are shown in Figure 2. The proposed algorithm CNN training steps and detection step used are as follows:  
* **Step 1--Initial data acquisition and data cleansing:** The initial imagery dataset acquired by the Beehive monitoring module is manually analyzed and filtered to eliminate blur images or images of low resolution and light intensity. The photos in this experimentation taken from the camera module are set of the minimum acquisition of 5 Mpx size of 800 \(\times\) 600 px 300 dpi compressed at JPEG format using a compression ratio Q = 70, of picture size 350-500 KB each. Similarly, the trained CNN network and algorithms used are the most processing light for portable devices, using a minimum trained image size input of 640 \(\times\) 640 px (lightly distorted at the image height) and Cubic interpolation.