Skip to content

imaddde867/GAN-CNN

Repository files navigation

GAN-CNN: Stylized Vehicle Intelligence

Python TensorFlow PyTorch Ultralytics YOLO Core ML

car_classification_cnn.ipynb compresses all four project milestones into a single reproducible workflow: dataset curation, CNN bias/variance diagnosis, YOLOv5 fine-tuning, and VividNeonTexture stylization. The repo delivers both production-grade detectors (best_model.h5, best.pt, best.mlpackage) and a neon-ink rendering stage powered by YOLO crops.


Pipeline

[Milestone 1] Curate + annotate dataset (YOLO TXT format)
        ↓
[Milestone 2] Binary CNN (car vs. other)  → best_model.h5
        ↓
[Milestone 3] YOLOv5 fine-tuning          → runs/detect/train_optimized/weights/best.pt
        ↓
[Milestone 4] VividNeonTexture stylization → results/milestone4/

YOLO validation batches Training curves


Repository Map

Path Purpose
car_classification_cnn.ipynb End-to-end notebook for Milestones 1–4 (data prep, CNN, YOLO, stylization).
data/ Train/validation images + YOLO labels (class_id x_center y_center width height).
best_model.h5 Optimized binary classifier checkpoint restored via EarlyStopping.
runs/detect/train_optimized/ Ultralytics logs, plots, and weights/{best.pt,last.pt,best.mlpackage}.
results/milestone4/ Composite images from the VividNeonTexture pipeline.
data.yaml Auto-generated YOLO config pointing to this dataset.

Milestones at a Glance

  • M1 – Data Preparation
    2,100 train + 900 validation images across six vehicle classes, all labeled in YOLO TXT format with ≥10% negative examples to encourage generalization.

  • M2 – CNN Optimization
    Baseline: 82.7% accuracy but only 41% recall on cars.
    Remedy: class weights (4.96× car penalty), Dropout 0.4, L2=0.01, EarlyStopping, ModelCheckpoint, ReduceLROnPlateau.
    Result: 91.1% accuracy, 88.9% precision, 56.4% recall on cars; weights saved to best_model.h5.

  • M3 – YOLO Object Detection
    Ultralytics YOLOv5s on Apple M4 (device='mps', AMP, disk cache). Best checkpoint reaches mAP50-95 = 0.907 and ships with Core ML export. Confusion matrices and metrics live under runs/detect/train_optimized/.

  • M4 – YOLO → VividNeonTexture
    YOLO crops feed a lightweight generator/discriminator that layers neon glows and chrome textures, creating vivid composites saved to results/milestone4/.

VividNeonTexture samples


Why It Matters

  • Traceable milestones – All stages, metrics, and artifacts are captured in one notebook tied directly to the rubric.
  • Apple Silicon readiness – YOLO training uses M-series acceleration and exports to Core ML for on-device deployment.
  • Creative enhancement – VividNeonTexture showcases how YOLO outputs can be reused for expressive storytelling, yielding assets that complement quantitative evaluation.

Notebook → PDF (no LaTeX toolchain)

The lab image of TeX Live is missing the texmf-dist tree, so xelatex/pdflatex cannot build xelatex.fmt and nbconvert throws the 500 error shown above. Use the repo-supplied helper to export PDF without LaTeX:

python tools/export_notebook_pdf.py car_classification_cnn.ipynb

This runs jupyter nbconvert --to html --template lab and pipes the HTML through prince to emit car_classification_cnn.pdf next to the notebook. You can override the target via -o path/to/output.pdf and keep the intermediate HTML with --keep-html.

About

A vehicle AI pipeline where a VividNeonTexture GAN re-draws YOLOv5-detected cars from scratch with learned neon and chrome-like details for high-impact stylized renders.

Resources

Stars

Watchers

Forks

Contributors