Skip to content

Commit

Permalink
Merge pull request #80 from deepghs/dev/aesthetic
Browse files Browse the repository at this point in the history
dev(narugo): add aesthetic model using danbooru dataset
  • Loading branch information
narugo1992 authored Mar 25, 2024
2 parents 2f6ee1f + b42d469 commit 3441e93
Show file tree
Hide file tree
Showing 24 changed files with 4,043 additions and 0 deletions.
15 changes: 15 additions & 0 deletions docs/source/api_doc/metrics/dbaesthetic.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
imgutils.metrics.dbaesthetic
=================================

.. currentmodule:: imgutils.metrics.dbaesthetic

.. automodule:: imgutils.metrics.dbaesthetic


anime_dbaesthetic
--------------------------------------

.. autofunction:: anime_dbaesthetic



Binary file added docs/source/api_doc/metrics/dbaesthetic/best.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/metrics/dbaesthetic/good.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/metrics/dbaesthetic/great.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.
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/metrics/dbaesthetic/worst.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 38 additions & 0 deletions docs/source/api_doc/metrics/dbaesthetic_benchmark.plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import random

from benchmark import BaseBenchmark, create_plot_cli
from imgutils.metrics import anime_dbaesthetic
from imgutils.metrics.dbaesthetic import _MODEL

_MODEL_NAMES = _MODEL.classifier.model_names


class DBAestheticBenchmark(BaseBenchmark):
def __init__(self, model_name: str):
BaseBenchmark.__init__(self)
self.model_name = model_name

def load(self):
from imgutils.metrics.dbaesthetic import _MODEL
_MODEL.classifier._open_model(self.model_name)
_MODEL._get_xy_samples(self.model_name)

def unload(self):
from imgutils.metrics.dbaesthetic import _MODEL
_MODEL.clear()

def run(self):
image_file = random.choice(self.all_images)
_ = anime_dbaesthetic(image_file)


if __name__ == '__main__':
create_plot_cli(
[
(model_name, DBAestheticBenchmark(model_name))
for model_name in _MODEL_NAMES
],
title='Benchmark for Danbooru-Based Aesthetic Models',
run_times=10,
try_times=20,
)()
Loading

0 comments on commit 3441e93

Please sign in to comment.