# Deep Learning Methods for Bug Bite Classification: An End-to-End System
## 2 Materials and Methods
### Dataset Description  
There are limited sources of publicly available datasets with images of bug bites. The dataset discussed in [21] contains 61 images in total, divided into two classes--mosquitoes and ticks. It was collected for the purpose of differentiating between a mosquito bite and a tick bite, and the same purpose was also used in [22]. Another dataset consists of a total of 1300 web-scraped Google images [24] collected with the Selenium Python library [28]. The images in this dataset are divided into 8 categories: ants, bed bugs, chiggers, fleas, mosquitoes, spiders, ticks, and skin without any bites. For our research, we merged these two datasets, aiming to provide a greater number of images and a variety of bug bite types. Additionally, we enriched the dataset with images of bee stings collected with the aforementioned method used in [24]. The final dataset includes images of bites from eight different bugs: ants, bed bugs, chiggers, fleas, mosquitoes, spiders, bees, and ticks, each representing a separate class, and an additional ninth class, representing unaffected skin.  
Although the aim was to collect only images containing skin with bites or rashes, there were also images showing parts of the human body, such as a legs, arms or fingers, containing the bites. This could contribute to the weaker performance of the classification models because they might try to additionally learn the representation of the body part. Since our objective is to perform classification based on the bite itself, the images were manually cropped to show only the affected skin area.  
Considering the final dataset, there were 1168 images in the training set and 258 images in the test set. The images in each class were split between the training and test set with a train-test ratio of 18%. Table 1 summarizes the total number of images per class and the number of images in both the training and test sets per class. The ratio between these sets for each class is depicted in Figure 1.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Class** & **Training Set** & **Test Set** & **Total** \\ \hline Ant bites & 141 & 30 & 171 \\ Bed bug bites & 149 & 40 & 189 \\ Bee stings & 125 & 24 & 149 \\ Chigger bites & 133 & 31 & 164 \\ Flea bites & 124 & 21 & 145 \\ Mosquito bites & 106 & 19 & 125 \\ No Bites & 121 & 33 & 154 \\ Spider bites & 127 & 28 & 155 \\ Tick bites & 142 & 32 & 174 \\ \hline Total & 1168 & 258 & 1426 \\ \hline \hline \end{tabular}
\end{table}
Table 1: Number of images per class in the final dataset for bug bites classification.  
Figure 2 shows a sample image from each class in the final dataset for bug bite classification.  
Regarding the skin classification task, all the images from the bug bite dataset (with and without bites) were used as skin-labeled images. On the other hand, randomly collected images from various categories such as nature, objects, etc. from ImageNet were used as non-skin images. The training set contains 1168 images with skin and 1200 without, while the test set consists of 258 images with skin and 400 without (Table 2).  
Figure 1: Ratio between the number of training and test samples per class.  
Figure 2: Sample images from each class in the final dataset for bug bite classification.