docs: Updated README
Browse files
README.md
CHANGED
@@ -1,112 +1,112 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
tags:
|
4 |
-
- image-classification
|
5 |
-
- pytorch
|
6 |
-
datasets:
|
7 |
-
- imagenette
|
8 |
-
---
|
9 |
-
|
10 |
-
|
11 |
-
# Darknet-19 model
|
12 |
-
|
13 |
-
Pretrained on [ImageNette](https://github.com/fastai/imagenette). The Darknet-19 architecture was introduced in [this paper](https://pjreddie.com/media/files/papers/YOLO9000.pdf).
|
14 |
-
|
15 |
-
|
16 |
-
## Model description
|
17 |
-
|
18 |
-
The core idea of the author is to combine high throughput of a highway net with performance gains using better activations (Leaky ReLU) and batch normalization. This architecture is used as a backbone for YOLOv2.
|
19 |
-
|
20 |
-
|
21 |
-
## Installation
|
22 |
-
|
23 |
-
### Prerequisites
|
24 |
-
|
25 |
-
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 Holocron.
|
26 |
-
|
27 |
-
### Latest stable release
|
28 |
-
|
29 |
-
You can install the last stable release of the package using [pypi](https://pypi.org/project/pylocron/) as follows:
|
30 |
-
|
31 |
-
```shell
|
32 |
-
pip install pylocron
|
33 |
-
```
|
34 |
-
|
35 |
-
or using [conda](https://anaconda.org/frgfm/pylocron):
|
36 |
-
|
37 |
-
```shell
|
38 |
-
conda install -c frgfm pylocron
|
39 |
-
```
|
40 |
-
|
41 |
-
### Developer mode
|
42 |
-
|
43 |
-
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)*:
|
44 |
-
|
45 |
-
```shell
|
46 |
-
git clone https://github.com/frgfm/Holocron.git
|
47 |
-
pip install -e Holocron/.
|
48 |
-
```
|
49 |
-
|
50 |
-
|
51 |
-
## Usage instructions
|
52 |
-
|
53 |
-
```python
|
54 |
-
from PIL import Image
|
55 |
-
from torchvision.transforms import Compose, ConvertImageDtype, Normalize, PILToTensor, Resize
|
56 |
-
from torchvision.transforms.functional import InterpolationMode
|
57 |
-
from holocron.models import model_from_hf_hub
|
58 |
-
|
59 |
-
model = model_from_hf_hub("frgfm/darknet19").eval()
|
60 |
-
|
61 |
-
img = Image.open(path_to_an_image).convert("RGB")
|
62 |
-
|
63 |
-
# Preprocessing
|
64 |
-
config = model.default_cfg
|
65 |
-
transform = Compose([
|
66 |
-
Resize(config['input_shape'][1:], interpolation=InterpolationMode.BILINEAR),
|
67 |
-
PILToTensor(),
|
68 |
-
ConvertImageDtype(torch.float32),
|
69 |
-
Normalize(config['mean'], config['std'])
|
70 |
-
])
|
71 |
-
|
72 |
-
input_tensor = transform(img).unsqueeze(0)
|
73 |
-
|
74 |
-
# Inference
|
75 |
-
with torch.inference_mode():
|
76 |
-
output = model(input_tensor)
|
77 |
-
probs = output.squeeze(0).softmax(dim=0)
|
78 |
-
```
|
79 |
-
|
80 |
-
|
81 |
-
## Citation
|
82 |
-
|
83 |
-
Original paper
|
84 |
-
|
85 |
-
```bibtex
|
86 |
-
@article{DBLP:journals/corr/RedmonF16,
|
87 |
-
author = {Joseph Redmon and
|
88 |
-
Ali Farhadi},
|
89 |
-
title = {{YOLO9000:} Better, Faster, Stronger},
|
90 |
-
journal = {CoRR},
|
91 |
-
volume = {abs/1612.08242},
|
92 |
-
year = {2016},
|
93 |
-
url = {http://arxiv.org/abs/1612.08242},
|
94 |
-
eprinttype = {arXiv},
|
95 |
-
eprint = {1612.08242},
|
96 |
-
timestamp = {Mon, 13 Aug 2018 16:48:25 +0200},
|
97 |
-
biburl = {https://dblp.org/rec/journals/corr/RedmonF16.bib},
|
98 |
-
bibsource = {dblp computer science bibliography, https://dblp.org}
|
99 |
-
}
|
100 |
-
```
|
101 |
-
|
102 |
-
Source of this implementation
|
103 |
-
|
104 |
-
```bibtex
|
105 |
-
@software{Fernandez_Holocron_2020,
|
106 |
-
author = {Fernandez, François-Guillaume},
|
107 |
-
month = {5},
|
108 |
-
title = {{Holocron}},
|
109 |
-
url = {https://github.com/frgfm/Holocron},
|
110 |
-
year = {2020}
|
111 |
-
}
|
112 |
-
```
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- image-classification
|
5 |
+
- pytorch
|
6 |
+
datasets:
|
7 |
+
- frgfm/imagenette
|
8 |
+
---
|
9 |
+
|
10 |
+
|
11 |
+
# Darknet-19 model
|
12 |
+
|
13 |
+
Pretrained on [ImageNette](https://github.com/fastai/imagenette). The Darknet-19 architecture was introduced in [this paper](https://pjreddie.com/media/files/papers/YOLO9000.pdf).
|
14 |
+
|
15 |
+
|
16 |
+
## Model description
|
17 |
+
|
18 |
+
The core idea of the author is to combine high throughput of a highway net with performance gains using better activations (Leaky ReLU) and batch normalization. This architecture is used as a backbone for YOLOv2.
|
19 |
+
|
20 |
+
|
21 |
+
## Installation
|
22 |
+
|
23 |
+
### Prerequisites
|
24 |
+
|
25 |
+
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 Holocron.
|
26 |
+
|
27 |
+
### Latest stable release
|
28 |
+
|
29 |
+
You can install the last stable release of the package using [pypi](https://pypi.org/project/pylocron/) as follows:
|
30 |
+
|
31 |
+
```shell
|
32 |
+
pip install pylocron
|
33 |
+
```
|
34 |
+
|
35 |
+
or using [conda](https://anaconda.org/frgfm/pylocron):
|
36 |
+
|
37 |
+
```shell
|
38 |
+
conda install -c frgfm pylocron
|
39 |
+
```
|
40 |
+
|
41 |
+
### Developer mode
|
42 |
+
|
43 |
+
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)*:
|
44 |
+
|
45 |
+
```shell
|
46 |
+
git clone https://github.com/frgfm/Holocron.git
|
47 |
+
pip install -e Holocron/.
|
48 |
+
```
|
49 |
+
|
50 |
+
|
51 |
+
## Usage instructions
|
52 |
+
|
53 |
+
```python
|
54 |
+
from PIL import Image
|
55 |
+
from torchvision.transforms import Compose, ConvertImageDtype, Normalize, PILToTensor, Resize
|
56 |
+
from torchvision.transforms.functional import InterpolationMode
|
57 |
+
from holocron.models import model_from_hf_hub
|
58 |
+
|
59 |
+
model = model_from_hf_hub("frgfm/darknet19").eval()
|
60 |
+
|
61 |
+
img = Image.open(path_to_an_image).convert("RGB")
|
62 |
+
|
63 |
+
# Preprocessing
|
64 |
+
config = model.default_cfg
|
65 |
+
transform = Compose([
|
66 |
+
Resize(config['input_shape'][1:], interpolation=InterpolationMode.BILINEAR),
|
67 |
+
PILToTensor(),
|
68 |
+
ConvertImageDtype(torch.float32),
|
69 |
+
Normalize(config['mean'], config['std'])
|
70 |
+
])
|
71 |
+
|
72 |
+
input_tensor = transform(img).unsqueeze(0)
|
73 |
+
|
74 |
+
# Inference
|
75 |
+
with torch.inference_mode():
|
76 |
+
output = model(input_tensor)
|
77 |
+
probs = output.squeeze(0).softmax(dim=0)
|
78 |
+
```
|
79 |
+
|
80 |
+
|
81 |
+
## Citation
|
82 |
+
|
83 |
+
Original paper
|
84 |
+
|
85 |
+
```bibtex
|
86 |
+
@article{DBLP:journals/corr/RedmonF16,
|
87 |
+
author = {Joseph Redmon and
|
88 |
+
Ali Farhadi},
|
89 |
+
title = {{YOLO9000:} Better, Faster, Stronger},
|
90 |
+
journal = {CoRR},
|
91 |
+
volume = {abs/1612.08242},
|
92 |
+
year = {2016},
|
93 |
+
url = {http://arxiv.org/abs/1612.08242},
|
94 |
+
eprinttype = {arXiv},
|
95 |
+
eprint = {1612.08242},
|
96 |
+
timestamp = {Mon, 13 Aug 2018 16:48:25 +0200},
|
97 |
+
biburl = {https://dblp.org/rec/journals/corr/RedmonF16.bib},
|
98 |
+
bibsource = {dblp computer science bibliography, https://dblp.org}
|
99 |
+
}
|
100 |
+
```
|
101 |
+
|
102 |
+
Source of this implementation
|
103 |
+
|
104 |
+
```bibtex
|
105 |
+
@software{Fernandez_Holocron_2020,
|
106 |
+
author = {Fernandez, François-Guillaume},
|
107 |
+
month = {5},
|
108 |
+
title = {{Holocron}},
|
109 |
+
url = {https://github.com/frgfm/Holocron},
|
110 |
+
year = {2020}
|
111 |
+
}
|
112 |
+
```
|