-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from deepghs/dev/ages
dev(narugo): init version for anime style ages
- Loading branch information
Showing
65 changed files
with
4,110 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,5 +16,6 @@ imgutils.validate | |
nsfw | ||
portrait | ||
rating | ||
style_age | ||
teen | ||
truncate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
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('style_age', '1970s-', '*.jpg'))), | ||
*natsorted(glob.glob(os.path.join('style_age', '1980s', '*.jpg'))), | ||
*natsorted(glob.glob(os.path.join('style_age', '1990s', '*.jpg'))), | ||
*natsorted(glob.glob(os.path.join('style_age', '2000s', '*.jpg'))), | ||
*natsorted(glob.glob(os.path.join('style_age', '2010s', '*.jpg'))), | ||
*natsorted(glob.glob(os.path.join('style_age', '2015s', '*.jpg'))), | ||
*natsorted(glob.glob(os.path.join('style_age', '2020s', '*.jpg'))), | ||
columns=4, figsize=(10, 26), | ||
) |
1,535 changes: 1,535 additions & 0 deletions
1,535
docs/source/api_doc/validate/style_age.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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
imgutils.validate.style_age | ||
============================================= | ||
|
||
.. currentmodule:: imgutils.validate.style_age | ||
|
||
.. automodule:: imgutils.validate.style_age | ||
|
||
|
||
anime_style_age_score | ||
----------------------------- | ||
|
||
.. autofunction:: anime_style_age_score | ||
|
||
|
||
|
||
anime_style_age | ||
----------------------------- | ||
|
||
.. autofunction:: anime_style_age | ||
|
||
|
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.
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.
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.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import os | ||
import random | ||
|
||
from huggingface_hub import HfFileSystem | ||
|
||
from benchmark import BaseBenchmark, create_plot_cli | ||
from imgutils.validate import anime_style_age | ||
|
||
hf_fs = HfFileSystem() | ||
|
||
_REPOSITORY = 'deepghs/anime_style_ages' | ||
_MODEL_NAMES = [ | ||
os.path.relpath(file, _REPOSITORY).split('/')[0] for file in | ||
hf_fs.glob(f'{_REPOSITORY}/*/model.onnx') | ||
] | ||
|
||
|
||
class AnimeStyleAgeBenchmark(BaseBenchmark): | ||
def __init__(self, model): | ||
BaseBenchmark.__init__(self) | ||
self.model = model | ||
|
||
def load(self): | ||
from imgutils.validate.style_age import _open_anime_style_age_model | ||
_ = _open_anime_style_age_model(self.model) | ||
|
||
def unload(self): | ||
from imgutils.validate.style_age import _open_anime_style_age_model | ||
_open_anime_style_age_model.cache_clear() | ||
|
||
def run(self): | ||
image_file = random.choice(self.all_images) | ||
_ = anime_style_age(image_file, self.model) | ||
|
||
|
||
if __name__ == '__main__': | ||
create_plot_cli( | ||
[ | ||
(name, AnimeStyleAgeBenchmark(name)) | ||
for name in _MODEL_NAMES | ||
], | ||
title='Benchmark for Anime Style Age Models', | ||
run_times=10, | ||
try_times=20, | ||
)() |
Oops, something went wrong.