File size: 2,207 Bytes
7388f4b
 
 
 
 
 
 
 
2a555bd
 
7388f4b
 
 
 
 
 
 
 
 
 
 
 
 
e8ce238
 
f65c793
0fc3727
 
 
 
 
 
 
7388f4b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2a555bd
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
---
datasets:
- DamarJati/face-hands-YOLOv5
language:
- en
tags:
- yolov5
- anime
- Face detection
pipeline_tag: object-detection
---

# YOLOv5 Model for Face and Hands Detection

## Overview

This repository contains a YOLOv5 model trained for detecting faces and hands. The model is based on the YOLOv5 architecture and has been fine-tuned on a custom dataset.

## Model Information

- **Model Name:** yolov5-face-hands
- **Framework:** PyTorch
- **Version:** 1.0.0
- **Model List** ["face", "null1", "null2", "hands"]
- **The list model used is 0 and 3** ["0", "1", "2", "3"]

![results](results.png)

![labels](labels.jpg) | ![confusion_matrix](confusion_matrix.png)
:-------------------------------------:|:-------------------------------------:



## Usage

### Installation
```bash
pip install torch torchvision
pip install yolov5
```

### Load Model
```bash
import torch

# Load the YOLOv5 model
model = torch.hub.load('ultralytics/yolov5', 'custom', path='path/to/your/model.pt', force_reload=True)

# Set device (GPU or CPU)
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
model.to(device)

# Set model to evaluation mode
model.eval()

```

### Inference
```bash
import cv2

# Load and preprocess an image
image_path = 'path/to/your/image.jpg'
image = cv2.imread(image_path)
results = model(image)

# Display results (customize based on your needs)
results.show()

# Extract bounding box information
bboxes = results.xyxy[0].cpu().numpy()
for bbox in bboxes:
    label_index = int(bbox[5])
    label_mapping = ["face", "null1", "null2", "hands"]
    label = label_mapping[label_index]
    confidence = bbox[4]
    print(f"Detected {label} with confidence {confidence:.2f}")

```

## License
This model is released under the MIT License. See LICENSE for more details.

## Citation
If you find this model useful, please consider citing the YOLOv5 repository:

```bibtex
@misc{jati2023customyolov5,
  author = {Damar Jati},
  title = {Custom YOLOv5 Model for Face and Hands Detection},
  year = {2023},
  orcid: {\url{https://orcid.org/0009-0002-0758-2712}}
  publisher = {Hugging Face Model Hub},
  howpublished = {\url{https://huggingface.co/DamarJati/face-hand-YOLOv5}}
}
```