-
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 #70 from deepghs/dev/completeness
dev(narugo): add completeness model
- Loading branch information
Showing
36 changed files
with
4,296 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 |
---|---|---|
@@ -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
1,007
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.
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.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
36
docs/source/api_doc/validate/completeness_benchmark.plot.py
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,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, | ||
)() |
Oops, something went wrong.