Image Classification
Transformers
PyTorch
ONNX
Inference Endpoints
frgfm commited on
Commit
cc54375
·
1 Parent(s): f4ab5ac

docs: Updated README and config

Browse files
Files changed (2) hide show
  1. README.md +114 -0
  2. config.json +1 -0
README.md CHANGED
@@ -1,3 +1,117 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ pretty_name: OpenFire
4
+ tags:
5
+ - image-classification
6
+ - pytorch
7
+ - onnx
8
+ datasets:
9
+ - openfire
10
  ---
11
+
12
+
13
+ # ReXNet-1.5x model
14
+
15
+ Pretrained on a dataset for wildfire binary classification (soon to be shared). The ReXNet architecture was introduced in [this paper](https://arxiv.org/pdf/2007.00992.pdf).
16
+
17
+
18
+ ## Model description
19
+
20
+ The core idea of the author is to add a customized Squeeze-Excitation layer in the residual blocks that will prevent channel redundancy.
21
+
22
+
23
+ ## Installation
24
+
25
+ ### Prerequisites
26
+
27
+ Python 3.6 (or higher) and [pip](https://pip.pypa.io/en/stable/)/[conda](https://docs.conda.io/en/latest/miniconda.html) are required to install PyroVision.
28
+
29
+ ### Latest stable release
30
+
31
+ You can install the last stable release of the package using [pypi](https://pypi.org/project/pyrovision/) as follows:
32
+
33
+ ```shell
34
+ pip install pyrovision
35
+ ```
36
+
37
+ or using [conda](https://anaconda.org/pyronear/pyrovision):
38
+
39
+ ```shell
40
+ conda install -c pyronear pyrovision
41
+ ```
42
+
43
+ ### Developer mode
44
+
45
+ Alternatively, if you wish to use the latest features of the project that haven't made their way to a release yet, you can install the package from source *(install [Git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) first)*:
46
+
47
+ ```shell
48
+ git clone https://github.com/pyronear/pyro-vision.git
49
+ pip install -e pyro-vision/.
50
+ ```
51
+
52
+
53
+ ## Usage instructions
54
+
55
+ ```python
56
+ from PIL import Image
57
+ from torchvision.transforms import Compose, ConvertImageDtype, Normalize, PILToTensor, Resize
58
+ from torchvision.transforms.functional import InterpolationMode
59
+ from pyrovision.models import model_from_hf_hub
60
+
61
+ model = model_from_hf_hub("pyronear/rexnet1_5x").eval()
62
+
63
+ img = Image.open(path_to_an_image).convert("RGB")
64
+
65
+ # Preprocessing
66
+ config = model.default_cfg
67
+ transform = Compose([
68
+ Resize(config['input_shape'][1:], interpolation=InterpolationMode.BILINEAR),
69
+ PILToTensor(),
70
+ ConvertImageDtype(torch.float32),
71
+ Normalize(config['mean'], config['std'])
72
+ ])
73
+
74
+ input_tensor = transform(img).unsqueeze(0)
75
+
76
+ # Inference
77
+ with torch.inference_mode():
78
+ output = model(input_tensor)
79
+ probs = output.squeeze(0).softmax(dim=0)
80
+ ```
81
+
82
+
83
+ ## Citation
84
+
85
+ Original paper
86
+
87
+ ```bibtex
88
+ @article{DBLP:journals/corr/abs-2007-00992,
89
+ author = {Dongyoon Han and
90
+ Sangdoo Yun and
91
+ Byeongho Heo and
92
+ Young Joon Yoo},
93
+ title = {ReXNet: Diminishing Representational Bottleneck on Convolutional Neural
94
+ Network},
95
+ journal = {CoRR},
96
+ volume = {abs/2007.00992},
97
+ year = {2020},
98
+ url = {https://arxiv.org/abs/2007.00992},
99
+ eprinttype = {arXiv},
100
+ eprint = {2007.00992},
101
+ timestamp = {Mon, 06 Jul 2020 15:26:01 +0200},
102
+ biburl = {https://dblp.org/rec/journals/corr/abs-2007-00992.bib},
103
+ bibsource = {dblp computer science bibliography, https://dblp.org}
104
+ }
105
+ ```
106
+
107
+ Source of this implementation
108
+
109
+ ```bibtex
110
+ @software{Fernandez_Holocron_2020,
111
+ author = {Fernandez, François-Guillaume},
112
+ month = {5},
113
+ title = {{Holocron}},
114
+ url = {https://github.com/frgfm/Holocron},
115
+ year = {2020}
116
+ }
117
+ ```
config.json ADDED
@@ -0,0 +1 @@
 
 
1
+ {"mean": [0.485, 0.456, 0.406], "std": [0.229, 0.224, 0.225], "arch": "rexnet1_5x", "interpolation": "bilinear", "input_shape": [3, 224, 224], "classes": ["Wildfire"]}