Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev(narugo): add support for anime_teen #38

Merged
merged 4 commits into from
Aug 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/source/api_doc/validate/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ imgutils.validate
monochrome
nsfw
rating
teen
truncate
14 changes: 14 additions & 0 deletions docs/source/api_doc/validate/teen.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('teen', 'contentious', '*.jpg'))),
*natsorted(glob.glob(os.path.join('teen', 'safe_teen', '*.jpg'))),
*natsorted(glob.glob(os.path.join('teen', 'non_teen', '*.jpg'))),
columns=3, figsize=(8, 10),
)
1,043 changes: 1,043 additions & 0 deletions docs/source/api_doc/validate/teen.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/teen.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
imgutils.validate.teen
=============================================

.. currentmodule:: imgutils.validate.teen

.. automodule:: imgutils.validate.teen


anime_teen_score
-----------------------------

.. autofunction:: anime_teen_score



anime_teen
-----------------------------

.. autofunction:: anime_teen


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.
Binary file added docs/source/api_doc/validate/teen/non_teen/7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/api_doc/validate/teen/non_teen/8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/api_doc/validate/teen/non_teen/9.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/source/api_doc/validate/teen/safe_teen/4.jpg
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.
Binary file added docs/source/api_doc/validate/teen/safe_teen/6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions docs/source/api_doc/validate/teen_benchmark.plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import random

from benchmark import BaseBenchmark, create_plot_cli
from imgutils.validate import anime_teen
from imgutils.validate.teen import _MODEL_NAMES


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

def load(self):
from imgutils.validate.teen import _open_anime_teen_model
_ = _open_anime_teen_model(self.model)

def unload(self):
from imgutils.validate.teen import _open_anime_teen_model
_open_anime_teen_model.cache_clear()

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


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