Skip to content

Commit

Permalink
Merge pull request #3 from dev-rajk/main
Browse files Browse the repository at this point in the history
updated documentation
  • Loading branch information
Spritan authored Mar 1, 2024
2 parents 446a214 + cff738b commit c2c0e54
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,4 @@ cython_debug/
.vscode
YOLOv8_Explainer.egg-info/*
.code-workspace/
/Items
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,28 +84,28 @@ https://arxiv.org/abs/1710.11063 <br>
Aditya Chattopadhyay, Anirban Sarkar, Prantik Howlader, Vineeth N Balasubramanian`

https://arxiv.org/abs/1910.01279 <br>
`Score-CAM: Score-Weighted Visual Explanations for Convolutional Neural Networks
`Score-CAM: Score-Weighted Visual Explanations for Convolutional Neural Networks
Haofan Wang, Zifan Wang, Mengnan Du, Fan Yang, Zijian Zhang, Sirui Ding, Piotr Mardziel, Xia Hu`

https://ieeexplore.ieee.org/abstract/document/9093360/ <br>
`Ablation-cam: Visual explanations for deep convolutional network via gradient-free localization.
`Ablation-cam: Visual explanations for deep convolutional network via gradient-free localization.
Saurabh Desai and Harish G Ramaswamy. In WACV, pages 972–980, 2020`

https://arxiv.org/abs/2008.02312 <br>
`Axiom-based Grad-CAM: Towards Accurate Visualization and Explanation of CNNs
`Axiom-based Grad-CAM: Towards Accurate Visualization and Explanation of CNNs
Ruigang Fu, Qingyong Hu, Xiaohu Dong, Yulan Guo, Yinghui Gao, Biao Li`

https://arxiv.org/abs/2008.00299 <br>
`Eigen-CAM: Class Activation Map using Principal Components
Mohammed Bany Muhammad, Mohammed Yeasin`

http://mftp.mmcheng.net/Papers/21TIP_LayerCAM.pdf <br>
`LayerCAM: Exploring Hierarchical Class Activation Maps for Localization
`LayerCAM: Exploring Hierarchical Class Activation Maps for Localization
Peng-Tao Jiang; Chang-Bin Zhang; Qibin Hou; Ming-Ming Cheng; Yunchao Wei`

https://arxiv.org/abs/1905.00780 <br>
`Full-Gradient Representation for Neural Network Visualization
Suraj Srinivas, Francois Fleuret`
`Full-Gradient Representation for Neural Network Visualization
\n Suraj Srinivas, Francois Fleuret`

https://arxiv.org/abs/1806.10206 <br>
`Deep Feature Factorization For Concept Discovery
Expand Down
6 changes: 5 additions & 1 deletion docs/functions.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Functions

this module contains the funtions that can help generate the heatmaps for
##Main Functions
The core functions that can be used to visualise the different Class Activated Mapping(CAM) are given below.
::: YOLOv8_Explainer.core

##Helper Functions
The functions that can be used to display images and provide various other functionalities can be found here.

::: YOLOv8_Explainer.utils
18 changes: 12 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Welcome to YOLOv8 Explainer

## Simplify your understanding of YOLOv8 Results
This is a package with state of the art methods for Explainable AI for computer vision using YOLOv8. This can be used for diagnosing model predictions, either in production or while developing models. The aim is also to serve as a benchmark of algorithms and metrics for research of new explainability methods.
This is a package with state of the art Class Activated Mapping(CAM) methods for Explainable AI for computer vision using YOLOv8. This can be used for diagnosing model predictions, either in production or while developing models. The aim is also to serve as a benchmark of algorithms and metrics for research of new explainability methods.

### Install Environment & Dependencies

Expand Down Expand Up @@ -37,24 +37,30 @@ model = yolov8_heatmap(
conf_threshold=0.4,
device = "cpu",
method = "EigenCAM",
layer=[10, 12, 14, 16, 18, -3],
backward_type="all",
layer=[12, 17, 21],
ratio=0.02,
show_box=True,
renormalize=False,
)

imagelist = model(
images = model(
img_path="/location/image.jpg",
)

display_images(imagelist)
display_images(images)

```
- Here the `from YOLOv8_Explainer import yolov8_heatmap, display_images` allows you to import the required functionalities.

You can choose between the following CAM Models for version 0.0.2:
- The line `model = yolov8_heatmap( weight="/location/model.pt", conf_threshold=0.4, device = "cpu", method = "EigenCAM", layer=[12, 17, 21], ratio=0.02, show_box=True, renormalize=False)` allows the user to pass a pertrained YOLO weight which the CAM is expected to evaluate, along with additional parameters like the desired CAM method target layers, and the confidence threshold.

You can choose between the following CAM Models for version 0.0.5:

`GradCAM` , `HiResCAM`, `GradCAMPlusPlus`, `XGradCAM` , `LayerCAM`, `EigenGradCAM` and `EigenCAM`.

- The line `images = model( img_path="/location/image.jpg" )` passes the images the model will process

- The line `display_images(images)` displays the output of the model, along with the CAM model's output.

You can add a single image or a directory images to be used by the `Module`. The output will be a corresponding list of images (list containing one PIL Image for a single image input and list containing as many PIL images as Images in the input directory).

24 changes: 14 additions & 10 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ site_name: YOLOv8 Explainer
theme:
name: material
features:
- search.suggest
- search.highlight
- navigation.tabs
- navigation.sections
- navigation.top
Expand All @@ -12,25 +14,26 @@ theme:
- navigation.indexes
- toc.integrate
- navigation.top
- search.suggest
- search.highlight
- content.tabs.link
- content.code.annotation
- content.code.copy

language: en
palette:
- scheme: slate
- media: '(prefers-color-scheme: light)'
scheme: slate
primary: teal
accent: amber
toggle:
icon: material/toggle-switch-off-outline
icon: material/lightbulb
name: Switch to light mode
- media: '(prefers-color-scheme: dark)'
scheme: default
primary: teal
accent: purple
- scheme: default
accent: amber
toggle:
icon: material/toggle-switch
name: Switch to dark mode
primary: teal
accent: lime
icon: material/lightbulb-outline
name: Switch to dark mode


extra:
Expand Down Expand Up @@ -64,6 +67,7 @@ copyright: |
&copy 2024 Proyash Paban Sarma Borah and Devraj Kashyap
plugins:
- search: null
- mkdocstrings:
default_handler: python
handlers:
Expand Down

0 comments on commit c2c0e54

Please sign in to comment.