Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
datasets:
|
3 |
+
- DamarJati/face-hands-YOLOv5
|
4 |
+
language:
|
5 |
+
- en
|
6 |
+
tags:
|
7 |
+
- yolov5
|
8 |
+
- anime
|
9 |
+
---
|
10 |
+
|
11 |
+
# YOLOv5 Model for Face and Hands Detection
|
12 |
+
|
13 |
+
## Overview
|
14 |
+
|
15 |
+
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.
|
16 |
+
|
17 |
+
## Model Information
|
18 |
+
|
19 |
+
- **Model Name:** yolov5-face-hands
|
20 |
+
- **Framework:** PyTorch
|
21 |
+
- **Version:** 1.0.0
|
22 |
+
|
23 |
+
## Usage
|
24 |
+
|
25 |
+
### Installation
|
26 |
+
```bash
|
27 |
+
pip install torch torchvision
|
28 |
+
pip install yolov5
|
29 |
+
```
|
30 |
+
|
31 |
+
### Load Model
|
32 |
+
```bash
|
33 |
+
import torch
|
34 |
+
|
35 |
+
# Load the YOLOv5 model
|
36 |
+
model = torch.hub.load('ultralytics/yolov5', 'custom', path='path/to/your/model.pt', force_reload=True)
|
37 |
+
|
38 |
+
# Set device (GPU or CPU)
|
39 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
40 |
+
model.to(device)
|
41 |
+
|
42 |
+
# Set model to evaluation mode
|
43 |
+
model.eval()
|
44 |
+
|
45 |
+
```
|
46 |
+
|
47 |
+
### Inference
|
48 |
+
```bash
|
49 |
+
import cv2
|
50 |
+
|
51 |
+
# Load and preprocess an image
|
52 |
+
image_path = 'path/to/your/image.jpg'
|
53 |
+
image = cv2.imread(image_path)
|
54 |
+
results = model(image)
|
55 |
+
|
56 |
+
# Display results (customize based on your needs)
|
57 |
+
results.show()
|
58 |
+
|
59 |
+
# Extract bounding box information
|
60 |
+
bboxes = results.xyxy[0].cpu().numpy()
|
61 |
+
for bbox in bboxes:
|
62 |
+
label_index = int(bbox[5])
|
63 |
+
label_mapping = ["face", "null1", "null2", "hands"]
|
64 |
+
label = label_mapping[label_index]
|
65 |
+
confidence = bbox[4]
|
66 |
+
print(f"Detected {label} with confidence {confidence:.2f}")
|
67 |
+
|
68 |
+
```
|
69 |
+
|
70 |
+
## License
|
71 |
+
This model is released under the MIT License. See LICENSE for more details.
|
72 |
+
|
73 |
+
## Citation
|
74 |
+
If you find this model useful, please consider citing the YOLOv5 repository:
|
75 |
+
|
76 |
+
```bibtex
|
77 |
+
@misc{jati2023customyolov5,
|
78 |
+
author = {Damar Jati},
|
79 |
+
title = {Custom YOLOv5 Model for Face and Hands Detection},
|
80 |
+
year = {2023},
|
81 |
+
orcid: {\url{https://orcid.org/0009-0002-0758-2712}}
|
82 |
+
publisher = {Hugging Face Model Hub},
|
83 |
+
howpublished = {\url{https://huggingface.co/DamarJati/face-hand-YOLOv5}}
|
84 |
+
}
|
85 |
+
```
|