ZeroDefect โ€” YOLOv5 Nano (v2.0 Class-Balanced)

Aircraft Skin & Automotive Component Defect Detection (Edge-Deployable)

Python PyTorch ONNX License

A YOLOv5 Nano object detection model trained on a class-balanced merged dataset of aircraft skin and automotive component defects. This is version 2.0 of the ZeroDefect model, trained with:

  • AdamW optimizer + Cosine LR decay for stable convergence
  • Class-balanced sampling across 7 defect categories
  • Multi-scale training (random image size between 0.5xโ€“1.5x)
  • Label smoothing (0.05) for better generalization
  • 150 epochs fine-tuning from a high-quality pretrained base

Detected Defect Categories (7 Classes)

ID Class Description
0 crack Structural cracks, fatigue lines, stress fractures
1 dent Impact dents, surface deformations
2 corrosion Rust, chemical wear, oxidation spots
3 scratch Superficial scrapes, paint scratches
4 paint-peel Flaking paint, coating degradation
5 missing-head Missing rivet heads or fasteners
6 defect Generic surface anomalies

Training & Validation Metrics

Run Epochs mAP@0.5 mAP@0.5:0.95 Precision Recall
Balanced v2.0 (this repo, best epoch=101) 150 0.30994 0.22613 0.37777 0.34799
Nano v1.0 (baseline, epoch 149) 150 0.31962 0.23492 0.42944 0.35807

Note: The class-balanced v2.0 run achieves comparable mAP scores to the nano v1.0 baseline while training on a harder, class-balanced dataset. The lower absolute mAP reflects that the dataset had its class distribution enforced (harder to overfit to the dominant "defect" class), resulting in more balanced per-class detection capability.

Training Configuration

  • Model Architecture: YOLOv5 Nano backbone (~1.76M parameters, 4.2 GFLOPs)
  • Dataset: Merged aircraft skin defect + corrosion dataset (~30k images, 7 classes)
  • Optimizer: AdamW | Cosine LR decay
  • Label Smoothing: 0.05
  • Early Stopping: patience=30 (best epoch: 101/150)
  • Hardware: NVIDIA RTX 3050 Laptop GPU (6 GB VRAM)

Repository Contents

File Description Size
best.pt PyTorch model weights (YOLOv5 format) ~3.8 MB
best_balanced.onnx ONNX export (opset 18, simplified) ~7.5 MB
best.rknn RKNN binary for RV1106 NPU (INT8, prior run) ~2.6 MB
data.yaml Dataset configuration <1 KB
infer_onnx.py Python ONNX inference helper ~8 KB
evaluation/ Training curves, confusion matrix, PR/F1 plots โ€”

Quick Start: ONNX Inference (Python)

pip install onnxruntime opencv-python numpy
python infer_onnx.py --model best_balanced.onnx --image test.jpg --conf 0.25

Hardware Deployment (Luckfox Pico Max / RV1106 NPU)

The best.rknn model is compiled for the RV1106 NPU (INT8 quantized):

# Push model to the board
adb push best.rknn /userdata/

# Build C++ inference runner from rknn_model_zoo
./build-linux.sh -t rv1106 -a armv7l -d yolov5

# Run inference on board
./rknn_yolov5_demo /userdata/best.rknn test.jpg

License

Released under the MIT License. See LICENSE for details.

Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
1.78M params
Tensor type
F32
ยท
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Evaluation results

  • Precision on Merged Aircraft Skin Defect & Corrosion Dataset (Class-Balanced)
    self-reported
    0.378
  • Recall on Merged Aircraft Skin Defect & Corrosion Dataset (Class-Balanced)
    self-reported
    0.348
  • mAP@0.5 on Merged Aircraft Skin Defect & Corrosion Dataset (Class-Balanced)
    self-reported
    0.310
  • mAP@0.5:0.95 on Merged Aircraft Skin Defect & Corrosion Dataset (Class-Balanced)
    self-reported
    0.226