Image Feature Extraction
timm
PyTorch
Safetensors
Transformers
rwightman HF Staff commited on
Commit
d57be7a
·
verified ·
1 Parent(s): ddd7fe2
Files changed (4) hide show
  1. README.md +149 -0
  2. config.json +36 -0
  3. model.safetensors +3 -0
  4. pytorch_model.bin +3 -0
README.md ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ tags:
3
+ - image-classification
4
+ - timm
5
+ - transformers
6
+ pipeline_tag: image-classification
7
+ library_name: timm
8
+ license: other
9
+ license_name: dinov3-license
10
+ license_link: https://ai.meta.com/resources/models-and-libraries/dinov3-license
11
+ ---
12
+ # Model card for convnext_small.dinov3_lvd1689m
13
+
14
+ A DINOv3 ConvNeXt image feature model. Pretrained on LVD-1689M with self-supervised DINOv3 method, distilled from DINOv3 ViT-7B.
15
+
16
+
17
+ ## Model Details
18
+ - **Model Type:** Image classification / feature backbone
19
+ - **Model Stats:**
20
+ - Params (M): 49.5
21
+ - GMACs: 8.7
22
+ - Activations (M): 21.6
23
+ - Image size: 224 x 224
24
+ - **Papers:**
25
+ - DINOv3: https://arxiv.org/abs/2508.10104
26
+ - A ConvNet for the 2020s: https://arxiv.org/abs/2201.03545
27
+ - PyTorch Image Models: https://github.com/huggingface/pytorch-image-models
28
+ - **Original:** https://github.com/facebookresearch/dinov3
29
+ - **Pretrain Dataset:** LVD-1689M
30
+ - **License:** [DINOv3](https://ai.meta.com/resources/models-and-libraries/dinov3-license)
31
+
32
+ ## Model Usage
33
+ ### Image Classification
34
+ ```python
35
+ from urllib.request import urlopen
36
+ from PIL import Image
37
+ import timm
38
+
39
+ img = Image.open(urlopen(
40
+ 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
41
+ ))
42
+
43
+ model = timm.create_model('convnext_small.dinov3_lvd1689m', pretrained=True)
44
+ model = model.eval()
45
+
46
+ # get model specific transforms (normalization, resize)
47
+ data_config = timm.data.resolve_model_data_config(model)
48
+ transforms = timm.data.create_transform(**data_config, is_training=False)
49
+
50
+ output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
51
+
52
+ top5_probabilities, top5_class_indices = torch.topk(output.softmax(dim=1) * 100, k=5)
53
+ ```
54
+
55
+ ### Feature Map Extraction
56
+ ```python
57
+ from urllib.request import urlopen
58
+ from PIL import Image
59
+ import timm
60
+
61
+ img = Image.open(urlopen(
62
+ 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
63
+ ))
64
+
65
+ model = timm.create_model(
66
+ 'convnext_small.dinov3_lvd1689m',
67
+ pretrained=True,
68
+ features_only=True,
69
+ )
70
+ model = model.eval()
71
+
72
+ # get model specific transforms (normalization, resize)
73
+ data_config = timm.data.resolve_model_data_config(model)
74
+ transforms = timm.data.create_transform(**data_config, is_training=False)
75
+
76
+ output = model(transforms(img).unsqueeze(0)) # unsqueeze single image into batch of 1
77
+
78
+ for o in output:
79
+ # print shape of each feature map in output
80
+ # e.g.:
81
+ # torch.Size([1, 96, 56, 56])
82
+ # torch.Size([1, 192, 28, 28])
83
+ # torch.Size([1, 384, 14, 14])
84
+ # torch.Size([1, 768, 7, 7])
85
+
86
+ print(o.shape)
87
+ ```
88
+
89
+ ### Image Embeddings
90
+ ```python
91
+ from urllib.request import urlopen
92
+ from PIL import Image
93
+ import timm
94
+
95
+ img = Image.open(urlopen(
96
+ 'https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/beignets-task-guide.png'
97
+ ))
98
+
99
+ model = timm.create_model(
100
+ 'convnext_small.dinov3_lvd1689m',
101
+ pretrained=True,
102
+ num_classes=0, # remove classifier nn.Linear
103
+ )
104
+ model = model.eval()
105
+
106
+ # get model specific transforms (normalization, resize)
107
+ data_config = timm.data.resolve_model_data_config(model)
108
+ transforms = timm.data.create_transform(**data_config, is_training=False)
109
+
110
+ output = model(transforms(img).unsqueeze(0)) # output is (batch_size, num_features) shaped tensor
111
+
112
+ # or equivalently (without needing to set num_classes=0)
113
+
114
+ output = model.forward_features(transforms(img).unsqueeze(0))
115
+ # output is unpooled, a (1, 768, 7, 7) shaped tensor
116
+
117
+ output = model.forward_head(output, pre_logits=True)
118
+ # output is a (1, num_features) shaped tensor
119
+ ```
120
+
121
+ ## Citation
122
+ ```bibtex
123
+ @article{simeoni2025dinov3,
124
+ title={DINOv3},
125
+ author={Sim{'e}oni, Oriane and Vo, Huy V and Seitzer, Maximilian and Baldassarre, Federico and Oquab, Maxime and Jose, Cijo and Khalidov, Vasil and Szafraniec, Marc and Yi, Seungeun and Ramamonjisoa, Micha{"e}l and others},
126
+ journal={arXiv preprint arXiv:2508.10104},
127
+ year={2025}
128
+ }
129
+ }
130
+ ```
131
+ ```bibtex
132
+ @article{liu2022convnet,
133
+ author = {Zhuang Liu and Hanzi Mao and Chao-Yuan Wu and Christoph Feichtenhofer and Trevor Darrell and Saining Xie},
134
+ title = {A ConvNet for the 2020s},
135
+ journal = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
136
+ year = {2022},
137
+ }
138
+ ```
139
+ ```bibtex
140
+ @misc{rw2019timm,
141
+ author = {Ross Wightman},
142
+ title = {PyTorch Image Models},
143
+ year = {2019},
144
+ publisher = {GitHub},
145
+ journal = {GitHub repository},
146
+ doi = {10.5281/zenodo.4414861},
147
+ howpublished = {\url{https://github.com/huggingface/pytorch-image-models}}
148
+ }
149
+ ```
config.json ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architecture": "convnext_small",
3
+ "num_classes": 0,
4
+ "num_features": 768,
5
+ "pretrained_cfg": {
6
+ "tag": "dinov3_lvd1689m",
7
+ "custom_load": false,
8
+ "input_size": [
9
+ 3,
10
+ 224,
11
+ 224
12
+ ],
13
+ "fixed_input_size": false,
14
+ "interpolation": "bicubic",
15
+ "crop_pct": 1.0,
16
+ "crop_mode": "center",
17
+ "mean": [
18
+ 0.485,
19
+ 0.456,
20
+ 0.406
21
+ ],
22
+ "std": [
23
+ 0.229,
24
+ 0.224,
25
+ 0.225
26
+ ],
27
+ "num_classes": 0,
28
+ "pool_size": [
29
+ 7,
30
+ 7
31
+ ],
32
+ "first_conv": "stem.0",
33
+ "classifier": "head.fc",
34
+ "license": "dinov3"
35
+ }
36
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d6888643d396f63c881f8658418609d6f8b98cc37653ee074b3b6769e4059ef5
3
+ size 197852680
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:587d3fd7f07b9a2dc5a27276b45444826898c94dd2bdaeebf7d901c89dc96ce5
3
+ size 197948066