This project implements EfficientNet-B0 for terrain classification, achieving high accuracy in distinguishing between different terrain types.
- Validation Accuracy: 91.93%
- Test Accuracy: 92.40%
EfficientNet is a convolutional neural network architecture that uses compound scaling to balance network depth, width, and resolution for optimal performance.
- Compound Scaling: Uniformly scales depth/width/resolution using a compound coefficient.
- Mobile Inverted Bottleneck Convolution (MBConv): Efficient building block that reduces parameters while maintaining performance.
- Squeeze-and-Excitation (SE) blocks: Improves channel interdependencies at minimal computational cost.
Input Image
│
▼
Stem Conv3x3
│
▼
MBConv1, 3x3
│
▼
MBConv6, 3x3
│
▼
MBConv6, 5x5
│
▼
MBConv6, 3x3
│
▼
MBConv6, 5x5
│
▼
MBConv6, 5x5
│
▼
MBConv6, 3x3
│
▼
Conv1x1 & Pooling
│
▼
Fully Connected
│
▼
Output (5 classes)
Each MBConv block includes Squeeze-and-Excitation optimization.
Metric | Value |
---|---|
Parameters | ~4 million |
Model Size | ~15.6 MB |
Memory Usage | ~34.7 MB |
CPU Inference Speed | ~30-60ms per image |
GPU Inference Speed | ~10-15ms per image |
Note: Actual speed may vary based on hardware and image size.
- Input Processing: Images are resized to 224x224 and normalized.
- Feature Extraction: EfficientNet backbone extracts hierarchical features.
- Global Pooling: Features are pooled to create a fixed-size representation.
- Classification: Fully connected layer maps features to 5 terrain classes.
- Output: Softmax activation provides class probabilities.
- Optimizer: Adam
- Learning Rate: 1e-4
- Batch Size: 32
- Loss Function: Cross-entropy loss
- Number of Epochs: 25
- Early Stopping: Based on validation accuracy
- Data Augmentation: Horizontal flip, random crop, rotation
We use transfer learning with a pre-trained EfficientNet-B0 model:
- Transfer Learning: Pre-trained weights are loaded and initially frozen.
- Fine-tuning: Top layers are unfrozen after the first few epochs.
- Batch Normalization: Layers remain in training mode during fine-tuning.
- Accuracy
- Confusion Matrix
- Precision, Recall, F1 Score
- Loss
To use the model for terrain classification:
- Update relevant paths in
transfer_learning.ipynb
- Run
transfer_learning.ipynb
To load and use the pretrained model:
- Run
load_model.ipynb
To check inference rates of the model:
- Run
cal_inference.ipynb
For ways to improve model further please refer Improvement.md