YOLOv5-GradCAM
using YOLOv5 & Grad-CAM (Pytorch)
SKKU S-HERO Capstone Project with PCB Defects detection YOLOv5 Source: https://github.com/ultralytics/yolov5
Grad-CAM Source: https://github.com/jacobgil/pytorch-grad-cam
Usage
1. Object Detection using YOLOv5
- Check 'yolov5' folder, read usage first
- Structure your files as yolov5's input
- Run train.py for training
- and detect.py to save detection results (if you're not interesting at interpreting results, you can skip from here.)
2. Interpret classification results using grad-CAM
2-1. Train YOLOv5_classifier
- We're interpreting classification results only, not including detection
- Run train.py for training yolo_classifier: submodel of yolov5 with detecting architecture removed
- Make sure you use the same structure as yolov5.
- Classification results will be SAME between original yolo and yolo_classifier
2-2. Run cam.py
- In 'pytorch-grad-cam' folder
- Modify 'model' to the same model as you used before
- Modify 'ckpt' to your own trained weight
- Run script(check pytorch-grad-cam usage)