File size: 1,197 Bytes
b796ff0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
tags:
- image-classification
- pytorch
---

### Description

This model with transfer learning is trained to recognise Sign Language. 
The model was trained on the basis of ResNet50. 
The dataset was used for training https://huggingface.co/datasets/aliciiavs/sign_language_image_dataset

In `model.py` file you can find class of custom model.
For using model you need download `model.py`, import from it class `CustomResNetModel`, 
create an example of this class and load and apply model weight from file 
`sign_language_resnet50.pth`
Model's metrics:  `loss: 0.5739429252889922` `accuracy: 0.901717`

#### Example of code

```
import torch
from huggingface_hub import hf_hub_download

from model import CustomResNetModel

device = "cuda" if torch.cuda.is_available() else "cpu"
model = CustomResNetModel(num_classes=24)
weight_path = hf_hub_download(
    repo_id="Irgenija/sign_language_resnet50", 
    filename="sign_language_resnet50.pth",
)
if cls.device == "cpu":
    checkpoint = torch.load(
        weight_path, map_location=torch.device("cpu")
    )
else:
    checkpoint = torch.load(weight_path)
model.load_state_dict(checkpoint)
model = model.to(device) # Optional
model.eval()
```