This project is focused on classifying images into five terrain classes: Coast, Forest, Glacier, Mountain, and Desert. We used transfer learning with ConvNeXT Tiny and MobileNetV2 architectures to leverage pre-trained models for effective terrain classification. This README provides an overview of the models, transformation parameters, accuracy results, and detailed model parameters.
- Project Overview
- Dataset and Classes
- Model Architecture
- Image Preprocessing and Transforms
- Model Parameters and Sizes
- Results and Evaluation
- Conclusion
The primary goal of this project is to perform accurate terrain classification using transfer learning. Two models—ConvNeXT Tiny and MobileNetV2—were chosen for their balance of accuracy and efficiency, and each model was fine-tuned to classify images into five terrain types.
The dataset consists of images belonging to the following classes:
- Coast
- Forest
- Glacier
- Mountain
- Desert
Each image is preprocessed and transformed to ensure compatibility with the models and maximize classification accuracy.
ConvNeXT Tiny is a convolutional model inspired by the Swin Transformer, optimized for image classification tasks. It provides high accuracy with minimal computational cost.
Model Summary:
- Architecture: ConvNeXT Tiny
- Number of Parameters: 27,823,973
- Input Image Size: 224x224
- Layer Configuration: Standard ConvNeXT Tiny layers
- Pre-trained Weights: ImageNet
MobileNetV2 is a lightweight model designed for efficient use on mobile devices while maintaining high accuracy for tasks like image classification.
Model Summary:
- Architecture: MobileNetV2
- Number of Parameters: 2,230,277
- Input Image Size: 224x224
- Layer Configuration: Standard MobileNetV2 layers
- Pre-trained Weights: ImageNet
For each model, specific image transformations were applied to prepare the images for the classification task.
test_transforms = transforms.Compose([
transforms.Resize((224,224 )),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
test_transforms = transforms.Compose([
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
])
Both models use the same normalization parameters, consistent with ImageNet pre-trained weights.
Here is a comparison of the parameters and model sizes:
Model | Number of Parameters | Model Size (MB) |
---|---|---|
ConvNeXT Tiny | 27.8 million | 106 MB |
MobileNetV2 | 2.2 million | 9.71 MB |
- Size may vary
- Accuracy: 92.11%
- Loss: .2168
- Accuracy: 91.33%
- Loss: .2798
This project demonstrates the effective use of transfer learning for terrain classification. While ConvNeXT Tiny offered higher accuracy, MobileNetV2 showed competitive results with a lighter model size, making it suitable for mobile applications. Both models effectively classified the terrains, with each model offering unique advantages depending on the deployment context.
-
Clone the repository.
git clone https://github.com/Akasxh/terrain-recognition.git cd terrain-recognition
-
Run the notebooks
-
Enjoy the predictions
Feel free to explore, contribute, and leave feedback!