A fine-grained image classifier that identifies the make, model, and production generation of cars from a single photo. Trained on 1211 distinct car generations, with a price-mapping companion dataset of cars commonly sold in the Egyptian market.
Model Overview
Architecture
EfficientNetV2-S (PyTorch, torchvision)
Parameters
21.7M
Input size
300×300 RGB
Output
1211-class softmax (one class per car generation)
Pretrained on
ImageNet-1K
Fine-tuned on
Custom 1211-class car dataset (~257K images)
Performance
Evaluated on a held-out test set of 26,818 images (10% stratified split):
Metric
Score
Test Top-1 Accuracy
59.85%
Test Top-5 Accuracy
92.02%
Validation Top-1
59.72%
Validation Top-5
91.88%
For context: random guessing on 1211 classes yields 0.083% accuracy. The model performs ~720× better than random on top-1, and finds the correct generation in its top-5 guesses 92% of the time.
Intended Use
Suitable for:
✅ Identifying car make, model, and generation from photos
✅ Visual search and tagging in automotive catalogs
✅ Price estimation (when paired with the companion price dataset)
✅ Educational and research applications in fine-grained classification
✅ Demonstrating transfer learning on imbalanced, large-class problems
Not suitable for (without further validation):
❌ Insurance / forensic identification (accuracy too low for high-stakes decisions)
❌ Commercial deployment without further fine-tuning on your specific data distribution
❌ Distinguishing fine variants within a generation (trim levels, individual model years within the same generation)
Class Labels
Classes are named in the format: Company_Model_BeginYear_EndYear
Examples:
Toyota_Camry_2018_2024
Honda_Civic_2016_2021
BMW_3-Series_2012_2018
The full list is available in class_names.json. Each class represents a generation (typically 5-8 years of production with the same overall design), not individual model years.
Preprocessing: All images pre-resized to 320×320 to optimize training I/O
Training Configuration
Hyperparameter
Value
Optimizer
AdamW
Learning rate
1e-3 (peak)
Weight decay
1e-4
Loss
CrossEntropyLoss with class weights + label smoothing (0.1)
Sampler
WeightedRandomSampler (class-balanced)
Batch size
32
Epochs
20
LR schedule
1-epoch linear warmup + cosine decay
Augmentation
RandomCrop, HorizontalFlip, ColorJitter
Training hardware
Apple M5 (MPS backend)
Training time
~44 hours (~2.17 hours/epoch)
Handling Class Imbalance
Two techniques were combined to address the 23.5× class imbalance:
Class-weighted loss — Inverse-frequency weighting, normalized so the mean weight is 1.0
Weighted random sampling — Each sample is drawn with probability inversely proportional to its class size
Together these ensure rare classes receive sufficient training signal despite their small population.
Price Mapping
This model can be paired with a companion CSV (combined_cars.csv) containing average prices in Egyptian Pounds (EGP) for cars commonly sold in the Egyptian market. The CSV uses the same combined_title format as the model's class labels, enabling direct lookup of an estimated price from a predicted class.
See the inference script for an example of how to combine classification output with price lookup.
Limitations and Biases
Known Limitations
Performance varies significantly by class. Common cars (e.g., Toyota Camry, Hyundai Elantra) likely perform well above the 60% average. Rare classes with fewer than 50 training images may perform substantially worse.
Confusion between visually similar generations. Mid-cycle facelifts and platform-shared vehicles across brands are common error patterns.
Limited to generations in training data. New cars released after dataset compilation may not be recognized.
Geographic bias toward Egyptian/regional market. The companion price dataset focuses on cars common in Egypt. Predictions are still valid globally but price mapping is regional.
Data Quality Notes
Images are web-scraped and not professionally curated. Some label noise is expected.