Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Car Viewpoint Classifier 🚗

High-accuracy car viewpoint classification for mobile deployment

TensorFlow Accuracy Model Size License

Live Demos:


📥 Model Download

Pre-trained TFLite Model (Ready for Mobile Deployment)

  • Download: viewpoint_classifier_float32.tflite 📦
  • Size: 2.40 MB
  • Accuracy: 87.22%
  • Format: TensorFlow Lite (Float32)
  • Input: 224×224×3 RGB images
  • Output: 7 classes (6 viewpoints + unknown)

📦 Available Models

Model Size Accuracy Download Link
Float32 2.40 MB 87.22% Download
INT8 2.59 MB ~85-87% Download

Class Labels

classes = ["front", "frontleft", "frontright", "rear", "rearleft", "rearright", "unknown"]

🚀 Quick Start

import tensorflow as tf
import numpy as np
from PIL import Image

# Load model
interpreter = tf.lite.Interpreter(model_path="viewpoint_classifier_float32.tflite")
interpreter.allocate_tensors()

# Prepare image
image = Image.open("car.jpg").resize((224, 224))
image_array = np.array(image).astype(np.float32) / 255.0
image_array = np.expand_dims(image_array, axis=0)

# Run inference
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
interpreter.set_tensor(input_details[0]['index'], image_array)
interpreter.invoke()
predictions = interpreter.get_tensor(output_details[0]['index'])[0]

# Get result
classes = ["front", "frontleft", "frontright", "rear", "rearleft", "rearright", "unknown"]
predicted_class = classes[np.argmax(predictions)]
confidence = np.max(predictions)
print(f"Predicted: {predicted_class} ({confidence*100:.2f}%)")

📊 Performance

Metric Value
Overall Accuracy 87.22%
Model Size 2.40 MB
Parameters 2.27M
Architecture MobileNetV2

Per-Class Accuracy

Viewpoint Accuracy
Front 96.26% ⭐
Front Right 92.74%
Rear Left 90.45%
Rear Right 89.50%
Rear 83.04%
Unknown 82.57%
Front Left 81.67%

🎯 Project Overview

This project implements a 7-class car viewpoint classifier optimized for mobile deployment using TensorFlow Lite.

Viewpoint Classes

  1. Front - Front view of the car
  2. Front Right - Front-right diagonal view
  3. Front Left - Front-left diagonal view
  4. Rear - Rear view of the car
  5. Rear Right - Rear-right diagonal view
  6. Rear Left - Rear-left diagonal view
  7. Unknown - Invalid/unrecognized viewpoint

📁 Repository Structure

car_side_recog/
├── README.md                          # This file
├── docs/                              # Additional documentation
│   ├── TRAINING_README.md            # Training instructions
│   ├── CLASSIFICATION_RESULTS.md     # Detailed results
│   └── VISUALIZATION_GUIDE.md        # Visualization tools
├── train_viewpoint_classifier_fast.py # Main training script
├── resume_training.py                 # Resume from checkpoint
├── convert_tflite_final.py           # TFLite conversion
├── test_predict.py                    # Inference script
├── requirements.txt                   # Python dependencies
├── class_map.json                     # Class label mapping
└── .gitignore                         # Git ignore rules

📚 Documentation


🛠️ Installation

# Clone the repository
git clone https://github.com/avinash064/Car_side_recog.git
cd Car_side_recog

# Install dependencies
pip install -r requirements.txt

Requirements

  • Python 3.9+
  • TensorFlow 2.10+
  • NumPy
  • Pillow
  • scikit-learn

💻 Training

To train the model from scratch:

# Activate virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Run training
python train_viewpoint_classifier_fast.py

For detailed training instructions, see Training Guide.


🔄 TFLite Conversion

Convert your trained model to TFLite:

python convert_tflite_final.py

The converted model will be saved to tflite_models/viewpoint_classifier_float32.tflite.


🧪 Testing

Run inference on test images:

python test_predict.py --image path/to/car_image.jpg

📝 Model Specifications

  • Input Shape: [1, 224, 224, 3]
  • Input Type: float32 (normalized 0-1)
  • Output Shape: [1, 7]
  • Output Type: float32 (softmax probabilities)
  • Preprocessing: Resize to 224×224, normalize to [0, 1]

🎓 Citation

If you use this model or code in your research, please cite:

@misc{car_viewpoint_classifier_2026,
  author = {Avinash Kashyap},
  title = {Car Viewpoint Classifier},
  year = {2026},
  publisher = {GitHub},
  url = {https://github.com/avinash064/Car_side_recog}
}

📧 Contact


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🙏 Acknowledgments

  • MobileNetV2 architecture from TensorFlow
  • Training dataset from CFV (Canonical Frontal View) dataset
  • TensorFlow Lite for mobile optimization

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages