BootsofLagrangian
commited on
Commit
•
2e15393
1
Parent(s):
86ea1fb
Update README.md
Browse files
README.md
CHANGED
@@ -4,18 +4,69 @@ license_name: umamusume-derivativework-guidelines
|
|
4 |
license_link: https://umamusume.jp/derivativework_guidelines/
|
5 |
---
|
6 |
|
7 |
-
|
|
|
8 |
|
9 |
-
|
10 |
|
11 |
-
|
12 |
|
13 |
-
|
14 |
|
|
|
15 |
|
16 |
|
|
|
17 |
|
|
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
|
21 |
|
|
|
4 |
license_link: https://umamusume.jp/derivativework_guidelines/
|
5 |
---
|
6 |
|
7 |
+
This is the model repository for ULTIMA-YOLOv9, containing the following checkpoints:
|
8 |
+
- YOLO9-E
|
9 |
|
10 |
+
# About **ULTIMA-YOLO** models
|
11 |
|
12 |
+
This is a part of [ULTIMA](https://huggingface.co/datasets/UmaDiffusion/ULTIMA) project.
|
13 |
|
14 |
+
ULTIMA-YOLOv9 model is a facial detection model for Uma Musumes in illustrations and based on [yolov9-e](https://arxiv.org/abs/2402.13616) and [ULTIMA-YOLO dataset](https://huggingface.co/datasets/UmaDiffusion/ULTIMA-YOLO)
|
15 |
|
16 |
+
[ULTIMA Dataset](https://huggingface.co/datasets/UmaDiffusion/ULTIMA) is **U**ma Musume **L**abeled **T**ext-**I**mage **M**ultimodal **A**lignment Dataset.
|
17 |
|
18 |
|
19 |
+
### How to Use
|
20 |
|
21 |
+
Clone YOLOv9 repository.
|
22 |
|
23 |
+
```
|
24 |
+
git clone https://github.com/WongKinYiu/yolov9.git
|
25 |
+
cd yolov9
|
26 |
+
```
|
27 |
+
|
28 |
+
Download the weights using `hf_hub_download` and use the loading function in helpers of YOLOv9.
|
29 |
+
|
30 |
+
```python
|
31 |
+
from huggingface_hub import hf_hub_download
|
32 |
+
hf_hub_download("UmaDiffusion/ULTIMA-YOLOv9", filename="ultima_yolov9-e.pt", local_dir="./")
|
33 |
+
```
|
34 |
+
|
35 |
+
Load the model.
|
36 |
+
|
37 |
+
```python
|
38 |
+
# make sure you have the following dependencies
|
39 |
+
import torch
|
40 |
+
import numpy as np
|
41 |
+
from models.common import DetectMultiBackend
|
42 |
+
from utils.general import non_max_suppression, scale_boxes
|
43 |
+
from utils.torch_utils import select_device, smart_inference_mode
|
44 |
+
from utils.augmentations import letterbox
|
45 |
+
import PIL.Image
|
46 |
+
|
47 |
+
@smart_inference_mode()
|
48 |
+
def predict(image_path, weights='ultima_yolov9-e.pt', imgsz=640, conf_thres=0.1, iou_thres=0.45):
|
49 |
+
# Initialize
|
50 |
+
device = select_device('0')
|
51 |
+
model = DetectMultiBackend(weights='yolov9-e.pt', device="0", fp16=False, data='data/coco.yaml')
|
52 |
+
stride, names, pt = model.stride, model.names, model.pt
|
53 |
+
|
54 |
+
# Load image
|
55 |
+
image = np.array(PIL.Image.open(image_path))
|
56 |
+
img = letterbox(img0, imgsz, stride=stride, auto=True)[0]
|
57 |
+
img = img[:, :, ::-1].transpose(2, 0, 1)
|
58 |
+
img = np.ascontiguousarray(img)
|
59 |
+
img = torch.from_numpy(img).to(device).float()
|
60 |
+
img /= 255.0
|
61 |
+
if img.ndimension() == 3:
|
62 |
+
img = img.unsqueeze(0)
|
63 |
+
|
64 |
+
# Inference
|
65 |
+
pred = model(img, augment=False, visualize=False)
|
66 |
+
|
67 |
+
# Apply NMS
|
68 |
+
pred = non_max_suppression(pred[0][0], conf_thres, iou_thres, classes=None, max_det=1000)
|
69 |
+
```
|
70 |
|
71 |
|
72 |
|