# Simplified Deep Learning for Accessible Fruit Quality Assessment in Small Agricultural Operations
## 2 Materials and Methods
The model was pre-trained on the ImageNet dataset, encompassing over a million images belonging to 1000 different classes. Transfer learning is highly beneficial for relatively small datasets similar to that used in our study, as it facilitates leveraging the knowledge acquired by the model from a much larger dataset, thus enhancing performance. In the MobileNetV2 model, the top of the network, which typically contains fully connected layers, was not included. Instead, a custom head was added to tailor the model to the specific task of classifying five different types of fruits. This custom head contained a global average pooling layer followed by a dense layer with 1024 units and a ReLU activation function. The final layer comprised another dense layer with 5 units corresponding to the five classes and a Softmax activation function. Global average pooling reduces the spatial dimensions of the feature maps and helps in reducing the number of parameters, which is essential for preventing overfitting. MobileNetV2 was chosen as the base model for transfer learning primarily due to its compact size and efficiency. For small-scale producers who may not have access to high-end computational resources, the model size is a critical factor. MobileNetV2 is known for its balance between accuracy and computational cost, making it an ideal candidate for applications where resource constraints are a significant consideration. Using a model that is both lightweight and effective ensures that the proposed method can be utilized in practical settings with hardware limitations. For the control group, another model with approximately the same number of parameters was trained. However, it was trained from scratch without using transfer learning. In Appendix A Figure A1, the custom model and the head of the transfer model are compared (the entirety of the MobileNetV2 model is not shown due to its size). Data augmentation techniques, including horizontal flipping, shearing, and zooming, were applied to the training dataset to prevent overfitting and enhance the model's generalizability. Data augmentation artificially increases the size of the training dataset by creating modified versions of images in the dataset and helps in training the model using different data variations, which is particularly useful in improving generalization. Figure 4 illustrates these data augmentation operations. The main idea behind data augmentation is to synthetically increase the size and diversity of the dataset, which helps in preventing overfitting and obtaining the volume of data needed to achieve high performance. The image data generator used for data augmentation also employed a pre-processing function specific to MobileNetV2, which involved scaling pixel values appropriately and was applied to the images using the ImageDataGenerator in TensorFlow. This process ensured that the data that was input into the network would have the same characteristics as the images used for training. The model was compiled using the Adam optimizer with a learning rate of 0.0001 and a categorical cross-entropy loss function, which was minimized during training by updating the model parameters. Accuracy and loss were used as evaluation metrics. The model was trained for 50 epochs, with each epoch being an iteration over the entire training dataset. During each epoch, the model learned to make better predictions by adjusting its weights based on the training data and the loss function. Freezing the weights of the pre-trained model was essential to retain the knowledge gained from the ImageNet dataset, and fine-tuning the custom head ensured that the model  
Figure 4: Multiple instances of the same image using different data augmentation operations. was tailored to the specifics of the new dataset. A batch size of 32 was used for both training and validation datasets. The validation dataset was utilized to monitor the model's performance on unseen data, which is crucial for proper generalization and validation.