Image Classification
timm
PyTorch
dpn
julien-c HF staff commited on
Commit
5411e03
1 Parent(s): 6f52a79

Basic README.md

Browse files
Files changed (1) hide show
  1. README.md +127 -0
README.md ADDED
@@ -0,0 +1,127 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - image-classification
4
+ - timm
5
+ - dpn
6
+ license: apache-2.0
7
+ datasets:
8
+ - imagenet
9
+ ---
10
+
11
+ # `dpn92` from `rwightman/pytorch-image-models`
12
+
13
+ From [`rwightman/pytorch-image-models`](https://github.com/rwightman/pytorch-image-models):
14
+
15
+ ```
16
+ """ PyTorch implementation of DualPathNetworks
17
+ Based on original MXNet implementation https://github.com/cypw/DPNs with
18
+ many ideas from another PyTorch implementation https://github.com/oyam/pytorch-DPNs.
19
+
20
+ This implementation is compatible with the pretrained weights from cypw's MXNet implementation.
21
+
22
+ Hacked together by / Copyright 2020 Ross Wightman
23
+ """
24
+ ```
25
+
26
+ ## Model description
27
+
28
+ [Dual Path Networks](https://arxiv.org/abs/1707.01629)
29
+
30
+ ## Intended uses & limitations
31
+
32
+ You can use the raw model to classify images along the 1,000 ImageNet labels, but you can also change its head
33
+ to fine-tune it on a downstream task (another classification task with different labels, image segmentation or
34
+ object detection, to name a few).
35
+
36
+ ### How to use
37
+
38
+ You can use this model with the usual factory method in `timm`:
39
+
40
+ ```python
41
+ import PIL
42
+ import timm
43
+ import torch
44
+
45
+ model = timm.create_model("julien-c/timm-dpn92")
46
+ img = PIL.Image.open(path_to_an_image)
47
+ img = img.convert("RGB")
48
+
49
+ config = model.default_cfg
50
+
51
+ if isinstance(config["input_size"], tuple):
52
+ img_size = config["input_size"][-2:]
53
+ else:
54
+ img_size = config["input_size"]
55
+
56
+ transform = timm.data.transforms_factory.transforms_imagenet_eval(
57
+ img_size=img_size,
58
+ interpolation=config["interpolation"],
59
+ mean=config["mean"],
60
+ std=config["std"],
61
+ )
62
+
63
+ input_tensor = transform(cat_img)
64
+ input_tensor = input_tensor.unsqueeze(0)
65
+ # ^ batch size = 1
66
+ with torch.no_grad():
67
+ output = model(input_tensor)
68
+
69
+ probs = output.squeeze(0).softmax(dim=0)
70
+ ```
71
+
72
+ ### Limitations and bias
73
+
74
+ The training images in the dataset are usually photos clearly representing one of the 1,000 labels. The model will
75
+ probably not generalize well on drawings or images containing multiple objects with different labels.
76
+
77
+ The training images in the dataset come mostly from the US (45.4%) and Great Britain (7.6%). As such the model or
78
+ models created by fine-tuning this model will work better on images picturing scenes from these countries (see
79
+ [this paper](https://arxiv.org/abs/1906.02659) for examples).
80
+
81
+ More generally, [recent research](https://arxiv.org/abs/2010.15052) has shown that even models trained in an
82
+ unsupervised fashion on ImageNet (i.e. without using the labels) will pick up racial and gender bias represented in
83
+ the training images.
84
+
85
+ ## Training data
86
+
87
+ This model was pretrained on [ImageNet](http://www.image-net.org/), a dataset consisting of 14 millions of
88
+ hand-annotated images with 1,000 categories.
89
+
90
+ ## Training procedure
91
+
92
+ To be completed
93
+
94
+ ### Preprocessing
95
+
96
+ To be completed
97
+
98
+ ## Evaluation results
99
+
100
+ To be completed
101
+
102
+ ### BibTeX entry and citation info
103
+
104
+ ```bibtex
105
+ @misc{rw2019timm,
106
+ author = {Ross Wightman},
107
+ title = {PyTorch Image Models},
108
+ year = {2019},
109
+ publisher = {GitHub},
110
+ journal = {GitHub repository},
111
+ doi = {10.5281/zenodo.4414861},
112
+ howpublished = {\url{https://github.com/rwightman/pytorch-image-models}}
113
+ }
114
+ ```
115
+
116
+ and
117
+
118
+ ```bibtex
119
+ @misc{chen2017dual,
120
+ title={Dual Path Networks},
121
+ author={Yunpeng Chen and Jianan Li and Huaxin Xiao and Xiaojie Jin and Shuicheng Yan and Jiashi Feng},
122
+ year={2017},
123
+ eprint={1707.01629},
124
+ archivePrefix={arXiv},
125
+ primaryClass={cs.CV}
126
+ }
127
+ ```