Commit de99ee09 authored by dzy7e's avatar dzy7e
Browse files

Merge remote-tracking branch 'origin/ccip' into ccip

parents 733bf5b8 76234f02
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@ name: Docs Deploy

on:
  push:
    branches: [ main, 'doc/*', 'dev/*' ]
  #    branches: [ main, 'doc/*', 'dev/*' ]
  release:
    types: [ published ]

@@ -19,7 +19,7 @@ jobs:

    services:
      plantuml:
        image: plantuml/plantuml-server
        image: plantuml/plantuml-server:jetty-v1.2023.6
        ports:
          - 18080:8080

@@ -93,7 +93,7 @@ jobs:

    services:
      plantuml:
        image: plantuml/plantuml-server
        image: plantuml/plantuml-server:jetty-v1.2023.6
        ports:
          - 18080:8080

+4 −4
Original line number Diff line number Diff line
@@ -69,17 +69,17 @@ print(lpips_clustering(images)) # -1 means noises, the same as that in sklearn

### Object Detection

Currently, object detection is supported for anime faces and person, as shown below
Currently, object detection is supported for anime heads and person, as shown below

* Face Detection
* Head Detection

![face detection](https://github.com/deepghs/imgutils/blob/gh-pages/main/_images/face_detect.dat.svg)
![head detection](https://github.com/deepghs/imgutils/blob/gh-pages/main/_images/head_detect.dat.svg)

* Person Detection

![person detection](https://github.com/deepghs/imgutils/blob/gh-pages/main/_images/person_detect.dat.svg)

Based on practical tests, face detection currently has a very stable performance and can be used for automation tasks.
Based on practical tests, head detection currently has a very stable performance and can be used for automation tasks.
However, person detection is still being further iterated and will focus on enhancing detection capabilities for
artistic illustrations in the future.

+14 −0
Original line number Diff line number Diff line
imgutils.detect.face
imgutils.detect.head
==========================

.. currentmodule:: imgutils.detect.face
.. currentmodule:: imgutils.detect.head

.. automodule:: imgutils.detect.face
.. automodule:: imgutils.detect.head


detect_faces
detect_heads
------------------------------

.. autofunction:: detect_faces
.. autofunction:: detect_heads

+34 −0
Original line number Diff line number Diff line
import random

from benchmark import BaseBenchmark, create_plot_cli
from imgutils.detect import detect_faces
from imgutils.detect import detect_heads


class FaceDetectBenchmark(BaseBenchmark):
class HeadDetectBenchmark(BaseBenchmark):
    def __init__(self, level):
        BaseBenchmark.__init__(self)
        self.level = level

    def load(self):
        from imgutils.detect.face import _open_face_detect_model
        _ = _open_face_detect_model(level=self.level)
        from imgutils.detect.head import _open_head_detect_model
        _ = _open_head_detect_model(level=self.level)

    def unload(self):
        from imgutils.detect.face import _open_face_detect_model
        _open_face_detect_model.cache_clear()
        from imgutils.detect.head import _open_head_detect_model
        _open_head_detect_model.cache_clear()

    def run(self):
        image_file = random.choice(self.all_images)
        _ = detect_faces(image_file, level=self.level)
        _ = detect_heads(image_file, level=self.level)


if __name__ == '__main__':
    create_plot_cli(
        [
            ('face (yolov8s)', FaceDetectBenchmark('s')),
            ('face (yolov8n)', FaceDetectBenchmark('n')),
            ('head (yolov8s)', HeadDetectBenchmark('s')),
            ('head (yolov8n)', HeadDetectBenchmark('n')),
        ],
        title='Benchmark for Anime Face Detections',
        title='Benchmark for Anime Head Detections',
        run_times=10,
        try_times=20,
        try_times=5,
    )()
Loading