Practical overview
When it fits
Use it when you have YOLOv5 weights and want image-level visual heatmaps to inspect model attention.
Who it is for
- Researchers investigating which image regions a YOLOv5 detector attends to.
- Developers reviewing YOLOv5 outputs or generating heatmaps for images and datasets.
Documented uses
- Generate a Grad-CAM heatmap for an input image using YOLOv5 weights.
- Run the tool with custom model weights and class names.
- Inspect visual outputs as part of object-detection model review.
Requirements & limits
The public GitHub repository identifies an MIT license.
- The README documents dependency installation through a requirements file and command-line inference through
main.py. - The example uses YOLOv5s weights, which the README says are downloaded automatically when absent.
- Custom model weights can be paired with comma-separated class names.
- Grad-CAM++ and ScoreCAM are listed as planned work rather than current documented features.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Generate a heatmap for an image
Run the documented inference command with YOLOv5s weights and save output files.
Before you start
- A Python environment with the repository requirements installed.
- An input image and an output directory.
Steps
Install dependencies with the command below.
pip install -r requirements.txtRun the command below.
python main.py --model-path yolov5s.pt --img-path images/cat-dog.jpg --output-dir outputsIf the weights are not present, leave the model path unchanged; the README says YOLOv5 downloads them automatically.
Expected outcome
The command is configured to write visual heatmap results to the specified output directory.
Guide limitations
- The README identifies compatibility with YOLOv5 v6.1.
- The documented command uses a local image path; it does not describe a hosted workflow.
Run inference with custom weights and class names
Pass a custom model path and comma-separated class names to the inference command.
Before you start
- Custom model weights.
- An input image and an output directory.
- Class names corresponding to the custom model.
Steps
Install dependencies with the command below.
pip install -r requirements.txtRun the command below.
python main.py --model-path custom-model-path.pt --img-path img-path.jpg --output-dir outputs --names obj1,obj2,obj3
Expected outcome
The command supplies custom weights and class names while directing results to the named output directory.
Guide limitations
- The README provides the command form but does not detail custom-model preparation.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 20 November 2026
- Original website title
- pooya-mohammadi/yolov5-gradcam · Official homepage title · retained in its source language

