## 3 Results  
### Image Segmentation Result  
In this paper, the initial tomato leaf images were resized to the size of 224 \(\times\) 224 as shown in Figure 3. Therefore, the segmentation method of the tomato leaf images with the same size was proposed for extracting the leaf regions and the same black backgrounds before being used for training the VGG-19. In particular, the HSV color space and histogram thresholds were applied for creating binary images before segmentation to produce the leaf regions and the same background. Figure 4 shows the RGB image and the image in the HSV color space, in which the HSV image has three images with the H, S, and V components. The images with the HSV components were transformed to produce the corresponding histograms, called sub-images. Before plotting these histograms, we normalized the values of the components in the range from 0 to 1. The threshold values for H, S, and V were calculated based on the gray levels of the histograms as shown in Figure 5. From the histograms, we observed that the lower and upper threshold values for H are 0.18 and 0.5, due to the green colors of tomato leaves, and similarly, the values are 0.1 and 1.0 for S, and 0.0 and 0.8 for V.  
The morphological reconstruction of one image was performed based on the mask image convoluted to the RGB input image (Figure 6a) to produce the binary image (Figure 6b). In addition, to produce the image with the leaf region and the black background as shown in Figure 6c, the binary image was multiplied with the RGB image. Figure 7 shows the images after segmentation with the original leaf regions and the same black backgrounds, in which the leaves can retain the disease areas. Therefore, the dataset can speed up the training time, reduce many computations inside the neural network, and increase the accuracy. Figure 3: Ten samples of tomato leaf disease and healthy images: (**a**) Bacterial spot disease; (**b**) Early blight disease; (**c**) Late blight disease; (**d**) Leaf mold disease; (**e**) Septoria leaf spot disease; (**f**) Two-spotted spider mites; (**g**) Target spot disease; (**h**) Yellow leaf curl virus disease; (**i**) Mosaic virus disease; (**j**) Healthy. Figure 4: Representation of the processed image: (**a**) the RGB image; (**b**) the HSV image converted from the RGB image. Figure 5: Input image in the HSV color space and the histograms of its components: (**a**) Hue component image; (**b**) Saturation component image; (**c**) Value component image; (**d**) Histogram of Hue component image; (**e**) Histogram of Saturation component image; (**f**) Histogram of Value component image. Figure 8 describes five field tomato leaf images with the different diseases which have the different backgrounds (Figure 8a-e) and the segmented images to produce the leaf regions and the black backgrounds (Figure 8f-j). With the segmented field images using the HSV color space, the obtained results are similar to those of the images from the Plant Village database. In this research, we performed the segmentation of images based on the histogram thresholding values of the leaf regions, while the different backgrounds of the images are not relative to the segmentation results. Figure 6: The results of the segmented image: (**a**) the RGB input image; (**b**) the binary image processed using one mask; (**c**) the image with the leaf region and the black background. Figure 7: Ten segmented leaf images including nine leaf disease images and one healthy image: (**a**) Bacterial spot disease; (**b**) Early blight disease; (**c**) Late blight disease; (**d**) Leaf mold disease; (**e**) Septoria leaf spot disease; (**f**) Two-spotted spider mites; (**g**) Target spot disease; (**h**) Yellow leaf curl virus dis-ease; (**i**) Mosaic virus disease; (**j**) Healthy leaf. To evaluate the performance of the HSV technique, we calculated a metric or structural similarity index (SSIM) between the HSV-segmented images and the manually segmented images [52]. The SSIM range was installed to be from 0 to 1.