Skip to content

Commit

Permalink
Merge pull request #70 from deepghs/dev/completeness
Browse files Browse the repository at this point in the history
dev(narugo): add completeness model
  • Loading branch information
narugo1992 authored Feb 26, 2024
2 parents d6d9210 + 8f0e2d6 commit 452934c
Show file tree
Hide file tree
Showing 36 changed files with 4,296 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/source/api_doc/validate/completeness.plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import glob
import os.path

from natsort import natsorted

from plot import image_plot

if __name__ == '__main__':
image_plot(
*natsorted(glob.glob(os.path.join('completeness', 'monochrome', '*.jpg'))),
*natsorted(glob.glob(os.path.join('completeness', 'rough', '*.jpg'))),
*natsorted(glob.glob(os.path.join('completeness', 'polished', '*.jpg'))),
columns=3, figsize=(8, 9),
)
1,007 changes: 1,007 additions & 0 deletions docs/source/api_doc/validate/completeness.plot.py.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions docs/source/api_doc/validate/completeness.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
imgutils.validate.completeness
=============================================

.. currentmodule:: imgutils.validate.completeness

.. automodule:: imgutils.validate.completeness


anime_completeness_score
-----------------------------

.. autofunction:: anime_completeness_score



anime_completeness
-----------------------------

.. autofunction:: anime_completeness


Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions docs/source/api_doc/validate/completeness_benchmark.plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import random

from benchmark import BaseBenchmark, create_plot_cli
from imgutils.generic.classify import _open_models_for_repo_id
from imgutils.validate import anime_completeness
from imgutils.validate.completeness import _REPO_ID

_MODEL_NAMES = _open_models_for_repo_id(_REPO_ID).model_names


class AnimeCompletenessBenchmark(BaseBenchmark):
def __init__(self, model):
BaseBenchmark.__init__(self)
self.model = model

def load(self):
_open_models_for_repo_id(_REPO_ID)._open_model(self.model)

def unload(self):
_open_models_for_repo_id(_REPO_ID).clear()

def run(self):
image_file = random.choice(self.all_images)
_ = anime_completeness(image_file, self.model)


if __name__ == '__main__':
create_plot_cli(
[
(name, AnimeCompletenessBenchmark(name))
for name in _MODEL_NAMES
],
title='Benchmark for Anime Completeness Models',
run_times=10,
try_times=20,
)()
Loading

0 comments on commit 452934c

Please sign in to comment.