--- title: CarClassifierModel emoji: πŸš— colorFrom: blue colorTo: purple sdk: gradio sdk_version: "5.49.1" app_file: app.py pinned: false --- # AiModelCarClassifier Creating and Running a Car Classifier Model... ## Car Detector(YOLO + Custom Model) This project uses **YOLOv5** for car detection and a **custom-trained classifier** for car model recognition and color identification. It takes in any image (JPEG/PNG), detects cars, classifies the car make & model, and outputs color and confidence scores. Example output: - **Cars detected: 1** - **Car 1: Gray/Silver Dodge Dakota Crew Cab 2010 (98.7% confident)** --- ## Overview This project combines **object detection** and **image classification** in one simple pipeline: 1. **YOLOv5** detects cars in the image. 2. The detected car regions are cropped and passed into a **PyTorch classifier** (`car_classifier.pth`). 3. A small color recognition helper determines the car’s dominant color. 4. Results are displayed through a simple **Gradio UI** (or any frontend, e.g. HTML + Flask). --- ## Project Structure β”‚ β”œβ”€β”€ YOLO.ipynb # Main notebook for YOLO + classification logic β”œβ”€β”€ car_classifier.pth # Trained PyTorch model for car model recognition β”œβ”€β”€ app.py # Gradio (or Flask) app for running the interface β”œβ”€β”€ class_names.json # (Optional) Human-readable class labels β”œβ”€β”€ requirements.txt # Python dependencies └── README.md # Project description --- --- ## Works steps 1. **Image Upload** β†’ User uploads an image. 2. **YOLOv5 Detection** β†’ Detects car bounding boxes. 3. **Classification** β†’ Each car crop is classified using `car_classifier.pth`. 4. **Color Recognition** β†’ Extracts car color from the cropped region. 5. **Output** β†’ Displays model name, color, and confidence percentage. --- ## Model Details - **YOLOv5**: Handles object detection (pretrained on COCO dataset). - **Car Classifier (`car_classifier.pth`)**: Fine-tuned model trained on [Stanford Cars Dataset](https://www.kaggle.com/datasets/jessicali9530/stanford-cars). - **Color Extractor**: Uses average RGB values to estimate color. --- ## install depencies ``` pip install -r requirements.txt ``` Then open the Gradio or local web interface that appears in your console. --- ## Setup & Run Clone the repo: Then open the Gradio or local web interface that appears in your console. ```bash https://github.com//AiModelCarClassifier.git cd car-detector-classifier ``` ## run the app ``` python app.py ```