# An IoT Transfer Learning-Based Service for the Health Status Monitoring of Grapevine
## 2 Materials and Methods
### Model Integration to the Raspberry Pi 4 for Online Disease Assessment
#### 2.3.3 Semantic Segmentation Using Mobile-UNet  
Eden Library's data include photos of grapevine plants with little or no background noise. During the online survey at the Chatzivariti winery, there were instances where the pictures had significant background information from the soil or the grapevine row behind  
Figure 5: Raspberry Pi 4 model B. The barebone configuration (**left**) and RPi in the steel case, mounted with Camera and GPS modules (**right**).  
the one of the measurements. Thus, in order to reduce the background noise from the raw incoming video stream and increase the chances of a successful implementation of the deep learning models, a semantic segmentation algorithm was also developed. Mobile-UNet was chosen as the algorithm that would perform the task in this paper.  
U-Net, proposed by [PERSON] et al. (2015), is a semantic segmentation convolutional network that exhibits a symmetric distribution, utilising shallow high-resolution feature maps to address pixel localization and deep low-resolution feature maps to handle pixel classification [69]. The network incorporates skip connections, allowing for the preservation of both location and feature information, making it suitable for pixel-level semantic segmentation tasks. The architecture follows a U-shaped encoding and decoding structure (Figure 6), leveraging the VGG network (Simonyan and Zisserman) in the encoding stage and using up-sampling modules in the decoding stage.  
Despite the attention that the U-Net had gained, especially in medical applications, due to the excellent performance in the segmentation task, it exhibits adaptability in small datasets in particular due to its low number of weight parameters [70]. Additionally, due to its VGG approach in the encoding stage, its detection approach is very time consuming. For this reason, [PERSON] et al. (2022) proposed replacing the encoding part of the original U-Net with MobileNet's depthwise separable convolutions [71]. By leveraging these building blocks in the encoding stage and skip connections, Mobile-UNet reduces the number of parameters and operations (almost 3% of the respective VGG network), enabling faster inference and better resource utilisation on mobile devices.  
The architecture is summarised in Figure 6, from which it can be seen that the feature extraction layers of the pre-trained MobileNetV2 are employed to replace the down-sampling stage of the original U-Net. As for the up-sampling part, it consists of five deconvolution layers and four inverted residual blocks. This configuration ensures that the input and output dimensions of Mobile-Unet remain consistent.  
U-Net has proven its value in semantic segmentation tasks in the field of agriculture as it can successfully segment images with a high level of details, such as navigation paths [72] and weed detection [73]. Likewise, Mobile-UNet has proven that it has comparable results with the original U-Net, and thus is expected to have a satisfactory segmentation performance in this study [71]. The loss function that was used for the training was the categorical cross entropy. Given its efficacy in the task of semantic segmentation, it is worth noting that, in this paper, the Mobile-UNet algorithm was used solely as a tool to assist  
Figure 6: High-level architecture of the Mobile-UNet segmentation model.  
the validation results of the models, and for this reason, even though its performance is reported in the results section, it is of no further scientific interest.