# Machine Learning-Based Smartphone Grip Posture Image Recognition and Classification
## 3 Methods
### Training/Test Setup  
Models were trained using TensorFlow 2.16 ([[https://www.tensorflow.org/](https://www.tensorflow.org/)]([https://www.tensorflow.org/](https://www.tensorflow.org/)) (accessed on 30 October 2024)) with the Keras API in the Python 3.6 programming language (Python Software Foundation, Wilmington, DE, USA, [[https://www.python.org/](https://www.python.org/)]([https://www.python.org/](https://www.python.org/)) (accessed on 30 October 2024)) on an NVIDIA GeForce RTX 2060 GPU. Additionally, hyperparameters for each model were configured for training and testing. For MobileNetV2, the learning rate was set to 0.001, the batch size to 32, and the number of epochs to 8. Adam (Adaptive Moment Estimation), based on the gradient descent algorithm, was used as the optimizer, which adjusts the learning rate independently for each parameter to enhance training efficiency. The loss function used was categorical cross-entropy. Dropout was set to 0.5, randomly deactivating 50% of the nodes to prevent overfitting and enhance generalization. For ResNet-50, the batch size was set to 32 with the number of epochs to 8. Similar to MobileNetV2, Adam was used as the optimizer, and categorical cross-entropy was utilized as the loss function. Dropout was set to 0.5 for ResNet-50 as well to prevent overfitting. For Inception V3, the batch size was set to 32 and the number of epochs to 15. Adam was again used as the optimizer, and categorical cross-entropy as the loss function. Dropout was set to 0.5, and a learning rate scheduler was implemented to enhance training efficiency and optimize the model. The learning rate factor of the scheduler was set to 0.2 with patience set to 5, meaning the learning rate was reduced if the monitored value did not improve for 5 epochs. The minimum learning rate was set to 0.0001 to prevent excessive overfitting. The data training process was divided into training set, validation set, and test set, with adjustments made to image size, epoch, batch size, dense layers, and dropout. The number of epochs was determined to balance between insufficient learning and potential overfitting. When the epoch count was reduced below the selected value, the model showed higher loss and lower accuracy, indicating underfitting. Conversely, increasing the number of epochs beyond the chosen value led to a rise in training accuracy but a decline in validation accuracy, suggesting a risk of overfitting. The batch size was set to 32 to balance training stability and generalization performance. When smaller batch sizes, such as 16, were used, training became slower and more unstable, while larger batch sizes, such as 64 or 128, led to faster convergence but a decline in generalization performance. The dropout rate was set to 0.5 to prevent overfitting while maintaining sufficient model capacity. Lower dropout rates, such as 0.2, resulted in increased risk of overfitting, whereas higher rates, such as 0.7, led to underutilization of the model's learning capacity and unstable performance. The preprocessed set of 3278 images was divided into 2551 images for the training set, 309 images for the validation set, and 418 images for the test set.