Skip to content

olivier-2018/XAI_YOLOv7_gradCAM

Repository files navigation

GradCAM on Yolov7

Original Yolo_v7 release by WongKinYiu. Ref: https://github.com/WongKinYiu/yolov7.git

Getting started:

  • Install poetry (manages dependances for pip):
curl -sSL https://install.python-poetry.org | python3 -
  • Configure poetry to install virtual environment inside project folders:
poetry config virtualenvs.in-project true
  • Clone the repository:
git clone git@github.com:olivier-2018/XAI_YOLOv7_gradCAM.git
# then
cd XAI_YOLOv7_gradCAM 
  • Download yolov7 pre-trained weights
mkdir weights
cd weights 
wget https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pt
  • Create a poetry virtual environment within the repository:
poetry install
  • Activate the virtual environment:
poetry shell

Inference with Yolov7 (see official site in links below)

On image:

python detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --source inference/images/horses.jpg

On video:

python detect.py --weights yolov7.pt --conf 0.25 --img-size 640 --source yourvideo.mp4

GradCAM on Yolov7

On images:

python main_gradcam.py --model-path weights/yolov7.pt --conf 0.75 --img-size 640 --img-path inference/images/horses.jpg --method gradcam --target-layers 104_act

Notes:

  • See main_gradcam.py for detailed running options (also in illustrations below)
  • Saliency maps will be saved to outputs/horses/ for each class detected.

On video:

TODO

Project presentation

Alt Text

Acknowledgements

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages