patrickramos
commited on
Commit
•
a2473ac
1
Parent(s):
2cf74cc
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
tags:
|
3 |
+
- vicreg
|
4 |
+
- vision
|
5 |
+
|
6 |
+
datasets:
|
7 |
+
- imagenet-1k
|
8 |
+
---
|
9 |
+
|
10 |
+
# DINO ResNet-50
|
11 |
+
|
12 |
+
ResNet-50 pretrained with VICReg. VICReg was introduced in [VICReg: Variance-Invariance-Covariance Regularization for Self-Supervised Learning](https://arxiv.org/abs/2104.14294), while ResNet was introduced in [Deep Residual Learning for Image Recognition](https://arxiv.org/abs/1512.03385). The official implementation of a VICReg Resnet-50 can be found [here](https://github.com/facebookresearch/dino).
|
13 |
+
|
14 |
+
Weights converted from the official [VICReg ResNet](https://github.com/facebookresearch/vicreg#pretrained-models-on-pytorch-hub) using [this script](https://colab.research.google.com/drive/1G2Y3JVWSzOh-kX8xKJUg5m4nc7dNkzNc?usp=sharing).
|
15 |
+
|
16 |
+
For up-to-date model card information, please see the [original repo](https://github.com/facebookresearch/vicreg
|
17 |
+
### How to use
|
18 |
+
|
19 |
+
**Warning: The feature extractor in this repo is a copy of the one from [`microsoft/resnet-50`](https://huggingface.co/microsoft/resnet-50). We never verified if this image prerprocessing is the one used with DINO ResNet-50.**
|
20 |
+
|
21 |
+
```python
|
22 |
+
from transformers import AutoFeatureExtractor, ResNetModel
|
23 |
+
from PIL import Image
|
24 |
+
import requests
|
25 |
+
|
26 |
+
url = 'http://images.cocodataset.org/val2017/000000039769.jpg'
|
27 |
+
image = Image.open(requests.get(url, stream=True).raw)
|
28 |
+
|
29 |
+
feature_extractor = AutoFeatureExtractor.from_pretrained('Ramos-Ramos/vicreg-resnet-50')
|
30 |
+
model = ResNetModel.from_pretrained('Ramos-Ramos/vicreg-resnet-50')
|
31 |
+
inputs = feature_extractor(images=image, return_tensors="pt")
|
32 |
+
outputs = model(**inputs)
|
33 |
+
last_hidden_states = outputs.last_hidden_state
|
34 |
+
```
|
35 |
+
|
36 |
+
### BibTeX entry and citation info
|
37 |
+
|
38 |
+
```bibtex
|
39 |
+
@article{bardes2021vicreg,
|
40 |
+
title={Vicreg: Variance-invariance-covariance regularization for self-supervised learning},
|
41 |
+
author={Bardes, Adrien and Ponce, Jean and LeCun, Yann},
|
42 |
+
journal={arXiv preprint arXiv:2105.04906},
|
43 |
+
year={2021}
|
44 |
+
}
|
45 |
+
```
|
46 |
+
|
47 |
+
```bibtex
|
48 |
+
@inproceedings{he2016deep,
|
49 |
+
title={Deep residual learning for image recognition},
|
50 |
+
author={He, Kaiming and Zhang, Xiangyu and Ren, Shaoqing and Sun, Jian},
|
51 |
+
booktitle={Proceedings of the IEEE conference on computer vision and pattern recognition},
|
52 |
+
pages={770--778},
|
53 |
+
year={2016}
|
54 |
+
}
|
55 |
+
```
|