Skip to content

Commit 6036d04

Browse files
Fixed paths (#5)
1 parent edd1396 commit 6036d04

9 files changed

+47
-19
lines changed

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Easy Explain
44

5-
[![Python Version](https://img.shields.io/badge/python-3.8%20%7C%203.9%20%7C%203.10-green.svg)](#supported-python-versions)
5+
[![Python Version](https://img.shields.io/badge/python-3.9%20%7C%203.10%20%7C%203.11-green.svg)](#supported-python-versions)
66
[![GitHub][github_badge]][github_link]
77
[![PyPI][pypi_badge]][pypi_link]
88
[![Download][download_badge]][download_link]
@@ -22,8 +22,8 @@ Unlock the "why" behind your AI models' decisions with `easy-explain`, a Python
2222
## Requirements
2323

2424
### Python Versions Supported
25-
- **Primary**: `3.10`
26-
- **Also Supported**: `3.8`, `3.9`
25+
- **Primary**: `3.11`
26+
- **Also Supported**: `3.9`, `3.10`
2727

2828
Ensure one of these Python versions is installed on your system to use `easy-explain`.
2929

@@ -58,13 +58,29 @@ Currently, `easy-explain` specializes in two cutting-edge XAI methodologies for
5858
To begin unraveling the intricacies of your model's decisions, import and utilize the corresponding classes as follows:
5959

6060
```python
61-
from easy_explain.methods.occlusion.occlusion import OcclusionExplain
61+
from easy_explain import OcclusionExplain
62+
63+
model = 'your-model'
64+
65+
occlusion_explain = OcclusionExplain(model=model)
66+
vis_types=[["blended_heat_map", "original_image"]]
67+
vis_signs = [["positive","all"]]
68+
69+
occlusion_explain.generate_explanation(image_url="your-image",total_preds=5,vis_types = vis_types, vis_signs = vis_signs, labels_path="your-labels-path")
6270

6371
```
6472

6573
```python
66-
from easy_explain.methods.lrp.yolov8.yolo import YOLOv8LRP
74+
from easy_explain import YOLOv8LRP
75+
76+
model = 'your-model'
77+
image = 'your-image'
78+
79+
lrp = YOLOv8LRP(model, power=2, eps=1, device='cpu')
80+
81+
explanation_lrp = lrp.explain(image, cls='your-class', contrastive=False).cpu()
6782

83+
lrp.plot_explanation(frame=image, explanation = explanation_lrp, contrastive=True, cmap='seismic', title='Explanation for your class"')
6884
```
6985

7086
For more information about how to begin have a look at the [examples notebooks](https://github.com/stavrostheocharis/easy_explain/tree/main/examples).

easy_explain/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# from easy_explain.easy_explain import run_easy_explain
2-
from easy_explain import methods
1+
from .methods import YOLOv8LRP, OcclusionExplain
2+
3+
__all__ = ["YOLOv8LRP", "OcclusionExplain"]

easy_explain/methods/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .lrp.yolov8 import YOLOv8LRP
2+
from .occlusion import OcclusionExplain
3+
4+
__all__ = ["YOLOv8LRP", "OcclusionExplain"]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .yolo import YOLOv8LRP
2+
3+
__all__ = ["YOLOv8LRP"]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from .occlusion import OcclusionExplain
2+
3+
__all__ = ["OcclusionExplain"]

examples/lrp/easy_explain_lrp_for_Yolov8_use_as_package_pipeline.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
"if module_path not in sys.path:\n",
4646
" sys.path.append(module_path)\n",
4747
"\n",
48-
"from easy_explain.methods.lrp.yolov8.yolo import YOLOv8LRP"
48+
"from easy_explain import YOLOv8LRP"
4949
]
5050
},
5151
{
@@ -58,7 +58,7 @@
5858
},
5959
{
6060
"cell_type": "code",
61-
"execution_count": 3,
61+
"execution_count": 4,
6262
"metadata": {},
6363
"outputs": [],
6464
"source": [
@@ -74,7 +74,7 @@
7474
},
7575
{
7676
"cell_type": "code",
77-
"execution_count": 4,
77+
"execution_count": 5,
7878
"metadata": {},
7979
"outputs": [],
8080
"source": [
@@ -91,7 +91,7 @@
9191
},
9292
{
9393
"cell_type": "code",
94-
"execution_count": 5,
94+
"execution_count": 6,
9595
"metadata": {},
9696
"outputs": [],
9797
"source": [
@@ -119,7 +119,7 @@
119119
},
120120
{
121121
"cell_type": "code",
122-
"execution_count": 6,
122+
"execution_count": 7,
123123
"metadata": {},
124124
"outputs": [],
125125
"source": [
@@ -136,7 +136,7 @@
136136
},
137137
{
138138
"cell_type": "code",
139-
"execution_count": 7,
139+
"execution_count": 8,
140140
"metadata": {},
141141
"outputs": [
142142
{

examples/occlusion/easy_explain_occlusion_use_as_package_for_multiple_targets.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
},
2929
{
3030
"cell_type": "code",
31-
"execution_count": 2,
31+
"execution_count": 3,
3232
"metadata": {},
3333
"outputs": [],
3434
"source": [
@@ -41,7 +41,7 @@
4141
"if module_path not in sys.path:\n",
4242
" sys.path.append(module_path)\n",
4343
"\n",
44-
"from easy_explain.methods.occlusion.occlusion import OcclusionExplain"
44+
"from easy_explain import OcclusionExplain\n"
4545
]
4646
},
4747
{

examples/occlusion/easy_explain_occlusion_use_as_package_pipeline.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"if module_path not in sys.path:\n",
4242
" sys.path.append(module_path)\n",
4343
"\n",
44-
"from easy_explain.methods.occlusion.occlusion import OcclusionExplain"
44+
"from easy_explain import OcclusionExplain"
4545
]
4646
},
4747
{
@@ -58,7 +58,7 @@
5858
"metadata": {},
5959
"outputs": [],
6060
"source": [
61-
"model = torchvision.models.resnet50(pretrained=True).eval()\n"
61+
"model = torchvision.models.resnet50(pretrained=True).eval()"
6262
]
6363
},
6464
{

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
setup(
66
name="easy_explain",
77
packages=["easy_explain"],
8-
version="0.4.0",
8+
version="0.4.1",
99
license="MIT",
1010
description="A library that helps to explain AI models in a really quick & easy way",
1111
long_description=long_description,
1212
long_description_content_type="text/markdown",
1313
author="Stavros Theocharis",
1414
author_email="stavrostheocharis@yahoo.gr",
1515
url="https://github.com/stavrostheocharis/stavrostheocharis",
16-
download_url="https://github.com/stavrostheocharis/easy_explain/archive/refs/tags/v0.4.0.tar.gz",
16+
download_url="https://github.com/stavrostheocharis/easy_explain/archive/refs/tags/v0.4.1.tar.gz",
1717
keywords=[
1818
"explainable ai",
1919
"xai",
@@ -38,5 +38,6 @@
3838
"License :: OSI Approved :: MIT License",
3939
"Programming Language :: Python :: 3.9",
4040
"Programming Language :: Python :: 3.10",
41+
"Programming Language :: Python :: 3.11",
4142
],
4243
)

0 commit comments

Comments
 (0)