System Architecture

Comprehensive documentation of the MoonRider Car Classification System

System Overview

The MoonRider Car Classification System is a Django-based application that uses machine learning and OpenAI to classify car images by make, model, and year. The system has been designed with a hybrid approach:

Local ML Model

A TensorFlow-based model that is trained on our own dataset. The model is continuously improved through retraining after every 10 classifications.

TensorFlow MobileNetV2 Transfer Learning

OpenAI Integration

When the local model has low confidence (below 0.7), the system falls back to OpenAI's advanced vision models for accurate classification.

GPT-4o Vision API API Integration

Classification Flow

This diagram illustrates the classification process from image upload to final result:

Image Upload

User uploads a car image through the web interface or API

Image Processing

The image is saved to the media directory and prepared for classification

Local Model Classification

The image is first analyzed by our local ML model to identify the make, model, and year

Model Confidence Check

Is the model confidence above 0.7?

YES

NO

Use Model Results

The model results are used as the final classification

OpenAI Classification

The image is sent to OpenAI's API for classification

Final Classification

The final make, model, and year are stored and displayed to the user

Update Statistics

Classification counters are updated and retraining is triggered if necessary

Training Process

This diagram illustrates how the model retraining process works:

Training Trigger

After every 10 classifications, the retraining process is triggered

Data Collection

The system collects all car images with final classifications (at least 5 are required)

Class Mapping

The system creates a mapping between unique cars and class indices

Model Creation

A new MobileNetV2-based model is created

Data Splitting

Data is split into training and validation sets

Data Augmentation

Images are augmented for better training

Model Training

The model is trained using the prepared data with early stopping and learning rate reduction

Evaluation

The model is evaluated on validation data to measure accuracy

Model Storage

The model is saved to disk and registered in the database

Statistics Reset

The retraining counter is reset and training date is recorded

Technology Stack

Backend

  • Python 3.9+
  • Django 4.2
  • SQLite Database
  • Django File Storage

Machine Learning

  • TensorFlow 2.19
  • MobileNetV2 Architecture
  • Scikit-learn
  • OpenAI API (GPT-4o)

Frontend

  • HTML5 / Django Templates
  • Bootstrap 5
  • Font Awesome Icons
  • JavaScript

System Performance

Model Statistics

Current Active Model: No active model yet

Total Models Trained: 0

Training Images Required: 5 minimum

Model Confidence Threshold: 0.7

Performance Optimization

  • MobileNetV2 model architecture used for balance of accuracy and speed
  • OpenAI fallback ensures high classification accuracy
  • Image preprocessing improves classification performance
  • Data augmentation increases effective training dataset size
  • Early stopping prevents overfitting during training

Future Enhancements

Performance Improvements
  • Implement model quantization
  • Add batch processing of images
  • Optimize image preprocessing pipeline
Feature Additions
  • Add car color detection
  • Implement damage assessment
  • Add car price estimation
  • Support video input
Deployment Options
  • Containerize with Docker
  • Deploy to cloud platforms
  • Create mobile application
  • Implement REST API expansion