File size: 3,928 Bytes
03c20c3
 
 
 
0939b5d
03c20c3
 
 
 
 
a8f36cc
03c20c3
a8f36cc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
03c20c3
802903e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
03c20c3
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
97
98
99
100
101
102
103
---
license: agpl-3.0
base_model:
- Ultralytics/YOLOv8
library_name: ultralytics
pipeline_tag: object-detection
tags:
- anime
- face
- yolov8
- face detection
model-index:
- name: Fuyucchi/yolov8_animeface
  results:
  - task:
      type: object-detection
    metrics:
    - type: precision
      value: 0.953
      name: mAP50(box)
    - type: precision
      value: 0.956
      name: Precision
    - type: recall
      value: 0.919
      name: Recall
    - type: precision
      value: 0.532
      name: mAP50-95(box)
---
# yolov8_animeface
Anime Face Detection using YOLOv8

## Dataset
Dataset was made created with 10 000 images manually annotated from safebooru. Split was train 70, val 20, test 10.

## Performance

This model is based on yolov8x6. It has been trained on the said dataset for 300 epoch at 1280px*1280px. It took ~110 hours to train on a RTX A4000.

On my dataset, the model performs particularly well with the default parameters.

```
Images  Instances    Box(P        R      mAP50     mAP50-95):
1002       1562      0.957      0.924      0.955      0.534
Speed: 1.3ms preprocess, 81.9ms inference, 0.0ms loss, 0.8ms postprocess per image
```

While it doesn't provide a huge mAP50-95, its predictions are always correct on the files I've tested. Confidence could be higher, but the model is very precise.

![](./demo/val/confusion_matrix.png "Confusion Matrix")
*Confusion matrix of the model, generated on the test set*

![](./demo/val/PR_curve.png "PR curve")
*PR curve of the model, generated on the test set*

Other metrics are available in the `./demo/val` subfolder.

## Demo

Manual annotation             |  yolov8_animeface
:-------------------------:|:-------------------------:
![](./demo/val/val_batch1_labels.jpg "1st batch labels")  |  ![](./demo/val/val_batch1_pred.jpg "Prediction made by yolov8_animeface")
![](./demo/val/val_batch2_labels.jpg "2nd batch labels")  |  ![](./demo/val/val_batch2_pred.jpg "Prediction made by yolov8_animeface")


## Comparison with an existing model

While we can argue about the comparison between two models from different generations, I believe it is interesting to compare this model with [zymk9's model](https://github.com/zymk9/yolov5_anime), based on yolov5. They both have the same purpose and were trained in the same fashion.

On the same dataset with the same parameters (conf=0.001 & iou=0.6), yolov8x6-animeface produces better metrics than the one on yolov5x.

yolov8-animeface:
```
Images  Instances    Box(P        R      mAP50     mAP50-95):
1002       1562      0.956      0.919      0.953      0.532
Speed: 1.2ms preprocess, 81.2ms inference, 0.0ms loss, 1.0ms postprocess per image
```

yolov5-anime:

```
Images  Instances    Box(P        R      mAP50     mAP50-95):
1003       1566      0.778      0.685      0.633      0.232
Speed: 1.5ms pre-process, 85.5ms inference, 1.4ms NMS per image at shape (32, 3, 1280, 1280)
```

yolov5-anime provides better results when images are resized at 640px, but it still is inferior to yolov8-animeface with the same parameters.
Surprisingly enough, yolov5 is way more confident that yolov8. However, it also has way more false positives.


Yolov8_animeface             |  Yolov5_anime
:-------------------------:|:-------------------------:
![](./demo/comparison/yolov8_animeface/test_priconne.png "Test on Priconne with yolov8")  |  ![](./demo/comparison/yolov5_anime/test_priconne.jpg "Test on Priconne with yolov5")
![](./demo/comparison/yolov8_animeface/test_uma.png "Test on Uma with yolov8")  |  ![](./demo/comparison/yolov5_anime/test_uma.jpg "Test on Uma with yolov5")


## Conclusion

While this model performs greatly on my dataset, my metrics can differ from yours. One lighter model might be released on a later occasion.

Based on YOLOv8 by
Jocher, G., Chaurasia, A., & Qiu, J. (2023). Ultralytics YOLO (Version 8.0.0) [Computer software]. https://github.com/ultralytics/ultralytics