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()