# GBCNet: In-Field Grape Berries Counting for Yield Estimation by Dilated CNNs
## Materials and Methods
### In-Field Images  
The GBCNet models were validated on two in-field image datasets, CR1 and CR2, for a total of more than 35,000 berries, all manually annotated. The main descriptive statistics of the datasets are summarized in Table 3). The images in CR1 were collected by CAVIT s.c. agronomists during routine management operations, while CR2 was acquired by one of the authors. Both CR1 and CR2 datasets were manually annotated by the authors using the open source annotation software Sloth [54]. The CR1 dataset is composed of 128 close-up and manually labeled images belonging to 7 different varieties, taken with 8 Mpx and 2 Mpx smartphone cameras from which we extracted 17,006 single berry annotations. The CR2 dataset collected 18,622 manually labeled single berry annotations, derived from 17 images of the Teroldego variety taken with a smartphone camera at 8 Mpx resolution (2448 \(\times\) 3268 pixels) from a medium distance (1-1.5 m). Examples of the images in the two datasets are presented in Figure 3.  
The CR1 images were taken in a stage where berries are still small and well separated, therefore clusters are characterized by a low degree of occlusion. In addition, the dataset was collected trying to include only one bunch in every picture. For the evaluation of the GBCNet performance the dataset was randomly split in 102 images for train and 26 images for test, corresponding to 13,353 berries in training and 3653 berries in test. The same 80-20% split is adopted, for example, in [30; 31]. Resampling by 5-fold Cross Validation (5-CV) was applied on the training dataset. The dataset CR1 is jointly owned by FBK and CAVIT s.c. and cannot be publicly shared. In the CR2 dataset each image contains more than one cluster, with different sizes both in the foreground and in the background. The images are randomly split in 11 images for train and 6 images for validation, corresponding to an average of 12,415 berries in training and 6207 in validation, respectively. In this case 3-CV was applied. Dataset CR2 is publicly available at the web address [[https://github.com/MPBA/CR2/](https://github.com/MPBA/CR2/)]([https://github.com/MPBA/CR2/](https://github.com/MPBA/CR2/)). For both datasets, given that the environment where the pictures are taken is not controlled, there is a large variance between images under different aspects. First, the clusters are visually very different in brightness and saturation while there is little difference with the colors between grapes and the surrounding leaves. This represents a challenge given that intra-class variance (e.g., colors between bunches) is higher than inter-class variance (e.g., bunches versus leaves). For CR2 an additional challenge is given by the main cluster dimension, that ranges from 1000 px (around 40% of the total height with the landscape orientation of the image) to 70 px (0.03%). Finally, \begin{table}
\begin{tabular}{l l r r r r r} \hline \hline
**Dataset** & **Variety** & **Images** & **Max** & **Min** & **Mean** & **Total** \\ \hline \multirow{8}{*}{CR1} & Chardonnay & 7 & 172 & 51 & 104.71 & 733 \\  & Lagrein & 9 & 211 & 117 & 163.22 & 1469 \\  & Marzemino & 16 & 244 & 53 & 114.81 & 1837 \\  & Pinot Gris & 34 & 322 & 86 & 150.91 & 5131 \\  & Pinot Noir & 21 & 269 & 93 & 142.00 & 2982 \\  & Sauvignon & 21 & 167 & 42 & 110.38 & 2318 \\  & Traminer & 20 & 207 & 61 & 126.80 & 2536 \\  & Total & 128 & 322 & 42 & 132.90 & 17,006 \\ \hline CR2 & Teroldego & 17 & 1764 & 535 & 1095.41 & 18,622 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Number of annotated berries per image in the CR1 and CR2 datasets. Figure 3: Example of close-up and medium distance images present in CR1 (**a**) and CR2 (**b**) datasets respectively. the CR2 dataset is characterized by images of grapes before veraison, in a stage where berries are almost of the final size, presenting a high degree of occlusion between berries, increasing the task difficulty. Input images have different resolutions since they were collected by different devices.