## 6 Case Study  
### Experimental Settings and Performance Metrics  
We deployed the proposed labor-efficient GAN-based model generation scheme, including all five main modules presented in Section 3, on both the edge-device-controlled robotic system and the GPU-based server for training deep learning networks used in our scheme. On the robotic system, a Raspberry Pi equipped with an Intel Movidius Neural Compute Stick and an 800M-dpi camera (OV5647) inspects beans with the DIDN plus the founded optimal model \(M^{DS*}\) and guides the robotic arm to pick off detected defects [20]. The end effector of the arm is an air valve with a 90 Kpa pump. Our proposed scheme is implemented with mixture of Tensorflow, Python, and related tools, for generating the optimal DIDN model \(M^{DS*}\) on a desktop computer with Intel Core i5-8500 3.0 GHz, 24 GB RAM, and a NVIDIA GTX 2080 Ti GPU card. For comparison, we also implemented two defect inspection schemes with the HCADIS [36] and the YOLOv3 [24; 37]. Figure 11 shows experimental equipment, which is a robotic arm with a camera on the end effector for removing defective coffee beans used in this case study (Authors from seven Taiwan universities share system development load and accomplish experiments in the case study). The arm device is uArm Swift Pro 3-axes robotic arm. The camera is the Raspberry Pi camera OV5647 with maximal 1080p resolution. The arm controller device is a single-chip computer of Raspberry Pi 3 with 1.2 GHz processor, 1 GB RAM, and 16 GB disk. The software modules mentioned in Section 3 are developed with Python, and some image processing functions are achieved with the OpenCV library [40]. The size of the inspection area is \(17.5\times 12.5\) cm\({}^{2}\), which is limited by the camera capacity. The height of the robotic operational space is 25 cm, which can contain around 100 beans in the inspection area. Certain data sets captured by the camera OV5647 for training and testing in YOLOv3 are shown in Figure 12. Defective and normal beans are randomly placed. In this case study, 30 bean images are used for training, and 10 bean images for testing. Beans are labeled by experts with the 14 classes shown in Figure 1.  
Figure 11: Illustration of experimental equipment. A robotic arm with a camera on the end effector for removing defective coffee beans is used in this work. For evaluating the effectiveness of different methods, three performance metrics are used in this paper. The first metric is Defect Inspection Precision (DIP), which is to measure the number of inspected defective beans under the used bounding boxes. The DIP equals the percentage of the true-positive predictions over all positive ones weighted by the percentage of true-positive bounding boxes over all bounding boxes and is expressed as the following formula:  
\[\text{DIP}=\ \ \left( \begin{array}{c}\sum[BBT_{i}(\hat{\epsilon})\
eq 0\&label (BBT_{i})\
eq 0]\\ \hline\sum[BBT_{i}(\hat{\epsilon})\
eq 0\&label(BBT_{i})\
eq 0]+\\ \sum[BBT_{i}(\hat{\epsilon})\
eq 0\&label(BBT_{i})=0]\end{array} \right) \times\left(\frac{\sum[BBT_{i}(\hat{\epsilon})\
eq 0\&label(BBT_{i})\
eq 0]}{\sum[BBT_{i}( \hat{\epsilon})\
eq 0]}\right)\, \tag{9}\]  
where \(BBT_{i}(\hat{\epsilon})\) denotes result of defect inspection algorithm, \(label(BBT_{i})\) denotes ground truth of bean, and \([\hat{x}]\) is a Boolean operator which equals 1 if condition \(x\) holds, otherwise 0. The second metric is Defect Inspection Recall (DIR), which is to measure the number of defective beans that are not inspected yet under the used bounding boxes. The DIR is equal to the percentage of the true-positive predictions over all defective beans weighted by the percentage of true-positive bounding boxes over all bounding boxes and is expressed as the following formula:  
\[\text{DIR}=\ \ \left( \begin{array}{c}\sum[BBT_{i}(\hat{\epsilon})\
eq 0\&label (BBT_{i})\
eq 0]\\ \hline\sum[BBT_{i}(\hat{\epsilon})\
eq 0\&label(BBT_{i})\
eq 0]+\\ \sum[BBT_{i}(\hat{\epsilon})=0\&label(BBT_{i})\
eq 0]\end{array}