Skip to content

Commit

Permalink
Merge branch 'main' into dev/waifu2x
Browse files Browse the repository at this point in the history
  • Loading branch information
narugo1992 committed Oct 8, 2023
2 parents d9d3e5b + 8c20473 commit cec7627
Show file tree
Hide file tree
Showing 40 changed files with 7,013 additions and 24 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ jobs:
if: ${{ github.event_name == 'push' }}
env:
CI: 'true'
HF_NARUGO_USERNAME: ${{ secrets.HF_NARUGO_USERNAME }}
HF_NARUGO_PASSWORD: ${{ secrets.HF_NARUGO_PASSWORD }}
with:
shell: bash
timeout_minutes: 20
Expand Down Expand Up @@ -122,8 +120,6 @@ jobs:
uses: nick-fields/retry@v2
env:
CI: 'true'
HF_NARUGO_USERNAME: ${{ secrets.HF_NARUGO_USERNAME }}
HF_NARUGO_PASSWORD: ${{ secrets.HF_NARUGO_PASSWORD }}
with:
shell: bash
timeout_minutes: 20
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/export.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ jobs:
uses: nick-fields/retry@v2
env:
CI: 'true'
HF_NARUGO_USERNAME: ${{ secrets.HF_NARUGO_USERNAME }}
HF_NARUGO_PASSWORD: ${{ secrets.HF_NARUGO_PASSWORD }}
with:
shell: bash
timeout_minutes: 20
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,6 @@ jobs:
uses: nick-fields/retry@v2
env:
CI: 'true'
HF_NARUGO_USERNAME: ${{ secrets.HF_NARUGO_USERNAME }}
HF_NARUGO_PASSWORD: ${{ secrets.HF_NARUGO_PASSWORD }}
with:
shell: bash
timeout_minutes: 20
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ pdocs:
dataset:
mkdir -p ${DATASET_DIR}
if [ ! -d ${DATASET_DIR}/chafen_arknights ]; then \
git clone https://${HF_NARUGO_USERNAME}:${HF_NARUGO_PASSWORD}@huggingface.co/datasets/deepghs/chafen_arknights.git ${DATASET_DIR}/chafen_arknights; \
git clone https://huggingface.co/datasets/deepghs/chafen_arknights.git ${DATASET_DIR}/chafen_arknights; \
fi
if [ ! -d ${DATASET_DIR}/monochrome_danbooru ]; then \
git clone https://${HF_NARUGO_USERNAME}:${HF_NARUGO_PASSWORD}@huggingface.co/datasets/deepghs/monochrome_danbooru.git ${DATASET_DIR}/monochrome_danbooru; \
git clone https://huggingface.co/datasets/deepghs/monochrome_danbooru.git ${DATASET_DIR}/monochrome_danbooru; \
fi
if [ ! -d ${DATASET_DIR}/images_test_v1 ]; then \
mkdir -p ${DATASET_DIR}/images_test_v1 && \
Expand Down
9 changes: 9 additions & 0 deletions docs/source/_libs/plot.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import Tuple, List

import matplotlib.pyplot as plt
import numpy as np
from PIL import Image

from cli import _wrap_func_as_cli
Expand Down Expand Up @@ -44,6 +45,14 @@ def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsiz
n = len(images)
rows = (n + columns - 1) // columns
fig, axs = plt.subplots(rows, columns, figsize=figsize)
if rows == 1 and columns == 1:
axs = np.array([[axs]])
elif rows == 1:
axs = axs[None, ...]
elif columns == 1:
axs = axs[..., None]
else:
pass
plt.subplots_adjust(wspace=0.2, hspace=0.15)
for i, img in enumerate(images, start=0):
xi, yi = i // columns, i % columns
Expand Down
14 changes: 14 additions & 0 deletions docs/source/api_doc/detect/eye.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
imgutils.detect.eye
==========================

.. currentmodule:: imgutils.detect.eye

.. automodule:: imgutils.detect.eye


detect_eyes
------------------------------

.. autofunction:: detect_eyes


37 changes: 37 additions & 0 deletions docs/source/api_doc/detect/eye_detect_benchmark.plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import random

from benchmark import BaseBenchmark, create_plot_cli
from imgutils.detect import detect_eyes


class EyeDetectBenchmark(BaseBenchmark):
def __init__(self, level, version):
BaseBenchmark.__init__(self)
self.level = level
self.version = version

def load(self):
from imgutils.detect.eye import _open_eye_detect_model
_ = _open_eye_detect_model(level=self.level, version=self.version)

def unload(self):
from imgutils.detect.eye import _open_eye_detect_model
_open_eye_detect_model.cache_clear()

def run(self):
image_file = random.choice(self.all_images)
_ = detect_eyes(image_file, level=self.level, version=self.version)


if __name__ == '__main__':
create_plot_cli(
[
('eye v1.0 (yolov8s)', EyeDetectBenchmark('s', 'v1.0')),
('eye v1.0 (yolov8n)', EyeDetectBenchmark('n', 'v1.0')),
('eye v0.8 (yolov8s)', EyeDetectBenchmark('s', 'v0.8')),
('eye v0.7 (yolov8s)', EyeDetectBenchmark('s', 'v0.7')),
],
title='Benchmark for Anime Eyes Detections',
run_times=10,
try_times=20,
)()
Loading

0 comments on commit cec7627

Please sign in to comment.