Unverified Commit 24cb18e7 authored by narugo1992's avatar narugo1992 Committed by GitHub
Browse files

Merge pull request #7 from deepghs/detection

dev(narugo): object detection utils
parents 4a934390 3e89216d
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -18,7 +18,9 @@ jobs:
        model-name:
          #          - 'lpips'
          #          - 'monochrome'
          - 'lineart'
          #          - 'person_detect'
          #          - 'face_detect'
          - 'manbits_detect'

    steps:
      - name: Checkout code
+4 −1
Original line number Diff line number Diff line
@@ -1218,3 +1218,6 @@ fabric.properties
/test/testfile/dataset
/zoo/testfile/dataset
/.train
*.pt
/runs
/YOLOv8
+6 −1
Original line number Diff line number Diff line
@@ -35,7 +35,12 @@ def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsiz
    for i, img in enumerate(images, start=0):
        xi, yi = i // columns, i % columns
        image, label = _image_input_process(img)
        ax = axs[yi] if rows == 1 else axs[xi, yi]
        if rows == 1 and columns == 1:
            ax = axs
        elif rows == 1:
            ax = axs[yi]
        else:
            ax = axs[xi, yi]
        ax.imshow(image)
        ax.set_title(label)
        if not keep_axis:
+14 −0
Original line number Diff line number Diff line
imgutils.detect.face
==========================

.. currentmodule:: imgutils.detect.face

.. automodule:: imgutils.detect.face


detect_faces
------------------------------

.. autofunction:: detect_faces

+19 −0
Original line number Diff line number Diff line
from imgutils.detect import detect_faces
from imgutils.detect.visual import detection_visualize
from plot import image_plot


def _detect(img, **kwargs):
    return detection_visualize(img, detect_faces(img, **kwargs))


if __name__ == '__main__':
    image_plot(
        (_detect('nian.png'), 'large scale'),
        (_detect('two_bikini_girls.png'), 'closed faces'),
        (_detect('genshin_post.jpg'), 'multiple'),
        (_detect('mostima_post.jpg'), 'anime style'),
        save_as='face_detect.dat.svg',
        columns=2,
        figsize=(12, 9),
    )
Loading