File size: 1,965 Bytes
2517f3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cf70ad1
2517f3d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57e80a8
cf70ad1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
language: en
tags:
- image-classification
- vision-transformer
- protovit
- pins
license: mit
---

# ProtoViT Model - deit_small_patch16_224 (PINS)

This is a fine-tuned deit_small_patch16_224 model trained on Pinterest Face Recognition Dataset from the paper ["Interpretable Image Classification with Adaptive Prototype-based Vision Transformers"](https://arxiv.org/abs/2410.20722).

## Model Details

- Base architecture: deit_small_patch16_224
- Dataset: Pinterest Face Recognition Dataset
- Number of classes: 155
- Fine-tuned checkpoint: `14finetuned0.8042`
- Accuracy: 80.42%

## Training Details

- Number of prototypes: 1550
- Prototype size: 1×1
- Training process: Warm up → Joint training → Push → Last layer fine-tuning
- Weight coefficients:
  - Cross entropy: 1.0
  - Clustering: -0.8
  - Separation: 0.1
  - L1: 0.01
  - Orthogonal: 0.001
  - Coherence: 0.003
- Batch size: 128

## Dataset Description

A face recognition dataset collected from Pinterest containing 155 different identity classes
Dataset link: https://www.kaggle.com/datasets/hereisburak/pins-face-recognition

## Usage

```python
from transformers import AutoImageProcessor, AutoModelForImageClassification
from PIL import Image

# Load model and processor
model = AutoModelForImageClassification.from_pretrained("Ayushnangia/protovit-deit_small_patch16_224-pins")
processor = AutoImageProcessor.from_pretrained("Ayushnangia/protovit-deit_small_patch16_224-pins")

# Prepare image
image = Image.open("path_to_your_image.jpg")
inputs = processor(images=image, return_tensors="pt")

# Make prediction
outputs = model(**inputs)
predicted_label = outputs.logits.argmax(-1).item()
```

## Additional Information

Github repo by authors of the paper ![GitHub repository][https://github.com/Henrymachiyu/ProtoViT]

For more details about the implementation and training process, please visit the my fork of ProtoVit [GitHub repository](https://github.com/ayushnangia/ProtoViT).