# A Novel Plug-in Board for Remote Insect Monitoring
## 3 Results
### Sensing Device Operation  
Obviously, one of the key components of the trapping system is the insect-counting software. Since the proposed sensing device has been designed to operate with deep-learning-based object detectors, we adopted a deep artificial neural network-based insect-counting strategy from our earlier work [22] to measure the characteristics of the circuit. The used insect-counting method consists of three phases:  
* Object proposition;
* Object classification;
* Non-maximum suppression.  
In the object propositional stage, the goal is to find all possible image regions where insects could be located. In the used insect-counting method, the Selective Search (SS) algorithm performs this task. To measure the accuracy of the SS method, we introduced the metrics in (2), where \(N\) is the number of test images, \(M_{i}\) is the number of ground truth boxes in the \(i\)-th test image, \(tb\) is the true box, \(pb\) is the proposed box (by SS), and \(IoU()\) is the intersection over union of the two boxes. SS achieved (in percentage) 82% accuracy on our test set, which indicates that this method can be used with high confidence.  
\[ACC_{SS}=\frac{1}{N}\sum_{i=1}^{N}\frac{1}{M_{i}}\sum_{j=1}^{M_{i}}\max\bigl{(} IoU\bigl{(}tb_{i,j},\ pb_{i,k}\bigr{)}\bigr{)} \tag{2}\]  
Depending on the image, SS may identify several thousands of image region proposals. In the next phase, all \"moth candidate\" image regions are passed to a binary moth classifier model. Its backbone is the MobileNetV2 deep convolutional architecture (pre-trained on the ImageNet) extended with two fully connected layers, where the number of neurons is 128 and 2, respectively. The activation function is ReLu in the hidden layer, while it is softmax in the output layer. The cost function is binary cross-entropy. Due to the softmax function, the model's output can be seen as a probability value that indicates whether a region contains a moth or not. If a probability value of a candidate region is higher than the threshold (0.5), the region will be labeled as a possible moth. The model was trained on a binary dataset that was generated from a public database [22]. As usual, the whole dataset was divided into training and validation sets. In total, 20% of all images were used for validation, while the remaining images were used for the training set. The batch size was 32 with a small learning rate (0.0001) due to continuous convergence. The stop condition was \"no improvement in 5 epochs\" (the model was trained within 30 epochs).  
After the second phase, there can be more regions that cover the same moth. Therefore, in the last phase, overlapping regions will be \"suppressed\". For this task, the Soft Non-Max Suppression (NMS) algorithm is used in the insect-counting method, which eliminates the less likely bounding boxes and tries to keep only the best ones according to the probabilities and the \(IoU\) values of overlapping boxes. A sample image of the sticky paper trap and its processed version can be seen in Figure 10. To measure the performance of the insect-counting method, we introduced the loss function in (3), where \(N\) is the number of sample images, \(c^{p}\) is the number of predicted boxes, and \(c^{r}\) is the number of real insects (ground-truth boxes). This loss value was 0.164 on our test set.  
\[l(c^{p},c^{r})=\frac{1}{N}\sum_{i=1}^{N}\frac{\left|c^{p}_{i}-c^{r}_{i}\right| }{c^{r}_{i}+1} \tag{3}\]After the implementation of the above-described software, we investigated three key characteristics of the sensing device: power consumption, time requirement, and operating temperature.