# Federated Learning for Clients' Data Privacy Assurance in Food Service Industry
## 5 Results and Discussion
### Federated Learning Semantic Segmentation Model Performance  
We employed DeepLabv3+ to perform FL semantic segmentation to precisely identify contamination areas on various surfaces. We used 12,000 annotated _contamination_ frames from eight clients to train and validate the model and 5859 (3770 and 2089) annotated frames from two clients for testing to evaluate how effectively the FL model could generalize when confronted with a new client's data. We randomly split the data from the eight clients to train (70%) and validate (30%) the FL model. Similar to the frame classification, we trained the model on four randomly chosen clients in each round and validated it on all eight clients after model aggregation and before moving on to the next round.  
We trained and validated the FL semantic segmentation model over 150 rounds. For each round, after downloading the global model, each client trains it on its local data for over 100 epochs with a local batch size of 16. For each client, we used categorical cross-entropy as the model loss function and Adam as the model optimizer with a learning rate of \(1\times 10^{-5}\). The locally trained models are sent to the server and aggregated using the FedAvg method, and a new global model is sent back to all clients to validate the model on the validation set and then start the next round.  
To evaluate the FL semantic segmentation model performance, we used five metrics: intersection over union (IoU), precision, recall, specificity, and F-score. IoU is a common metric in semantic segmentation problems that measures the overlap between the ground truth (regions annotated by a human expert) and the model prediction. The following equation shows the IoU definition.  
\[\text{IoU}=\frac{\text{TP}}{(\text{TP}+\text{FP}+\text{FN})} \tag{13}\]  
The reason for not using accuracy as a semantic segmentation evaluation metric is that contamination usually affects a tiny fraction of the frames, and accuracy would always be more than 99%, making it inappropriate for evaluating the model's performance. The FL semantic segmentation model achieved a mean IoU of 91.23% and 89.45% for segmenting frames into the background, green fluorescence, and red fluorescence classes for clients 9 and 10, respectively.  
In Figure 6, we show six image frames from a range of kitchen surfaces in the two new client datasets and the corresponding ground truth and model outputs to show how accurately the FL semantic segmentation algorithm was able to segment the red and green fluorescence contamination. The first row is the raw image captured via CSI-D, the second row depicts the FL model segmentation results, and the last row shows the human expert annotation (ground truth). When comparing FL model output to ground truth, it can be shown that the model successfully distinguishes and segments green and red fluorescence on various surfaces, including (Figure 6, left to right) under-sink plumbing, kitchen wall, kitchen countertop, a microwave door inner side, toaster, and refrigerator door handle.  
Figure 5: FL model confusion matrix when applied to two new client data sets.  
This comparison shows the model's ability to recognize either red fluorescence or green fluorescence contamination, or a mixture of these two types of contamination, that takes the shape of minute drops, sprays, and splashes and larger regions such as spills or stains.