Loading .gitignore +1 −1 Original line number Diff line number Diff line Loading @@ -1205,7 +1205,7 @@ fabric.properties /docs/source/**/*.sh.err /docs/source/**/*.sh.exitcode /docs/source/**/*.dat.* !/docs/source/**/*.benchmark.py.* !/docs/source/**/*.plot.py.svg !/docs/source/_static/**/* /docs/source/**/*.result.ipynb /cartpole_dqn_* Loading README.md +7 −7 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ to [Installation](https://deepghs.github.io/imgutils/main/tutorials/installation For the dataset, we need to filter the differences between the tachie(差分). As shown in the following picture   We can use `lpips_clustering` to cluster such situations as shown below Loading @@ -73,11 +73,11 @@ Currently, object detection is supported for anime heads and person, as shown be * Head Detection   * Person Detection   Based on practical tests, head detection currently has a very stable performance and can be used for automation tasks. However, person detection is still being further iterated and will focus on enhancing detection capabilities for Loading @@ -88,7 +88,7 @@ artistic illustrations in the future. Anime images can be converted to line drawings using the model provided by [patrickvonplaten/controlnet_aux](https://github.com/patrickvonplaten/controlnet_aux), as shown below.   It is worth noting that the `lineart` model may consume more computational resources, while `canny` is the fastest but has average effect. Therefore, `lineart_anime` may be the most balanced choice in most cases. Loading @@ -99,7 +99,7 @@ When filtering the crawled images, we need to remove monochrome images. However, composed of grayscale colors and may still contain colors, as shown by the first two rows of six images in the figure below   We can use `is_monochrome` to determine whether an image is monochrome, as shown below: Loading Loading @@ -159,7 +159,7 @@ if __name__ == '__main__': The `imgutils` library integrates various anime-style image tagging models, allowing for results similar to the following:   The ratings, features, and characters in the image can be detected, like this: Loading Loading @@ -246,7 +246,7 @@ the [`segment-rgba-with-isnetis`](https://deepghs.github.io/imgutils/main/api_do function for extraction and obtain an RGBA format image (with the background part being transparent), just like the example shown below.   ```python from imgutils.segment import segment_rgba_with_isnetis Loading docs/Makefile +2 −2 Original line number Diff line number Diff line Loading @@ -45,5 +45,5 @@ sourcedir: builddir: @echo $(shell readlink -f ${BUILDDIR}/html) cleanbm: $(ALL) cleanbm cleanplt: $(ALL) cleanplt docs/source/_libs/cli.py 0 → 100644 +17 −0 Original line number Diff line number Diff line from functools import wraps import click def _wrap_func_as_cli(func): @wraps(func) def _new_func(*args, **kwargs): @click.command() @click.option('--output', '-o', 'save_as', type=click.Path(dir_okay=False), required=True, help='Output path of image file.', show_default=True) def _execute(save_as): func(*args, save_as=save_as, **kwargs) _execute() return _new_func docs/source/_libs/plot.py +3 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ from typing import Tuple, List import matplotlib.pyplot as plt from PIL import Image from cli import _wrap_func_as_cli from imgutils.data import load_image, grid_transparent, ImageTyping from imgutils.validate.truncate import _mock_load_truncated_images Loading @@ -22,6 +23,7 @@ def _image_input_process(img) -> Tuple[Image.Image, str]: return grid_transparent(image), label @_wrap_func_as_cli @_mock_load_truncated_images(True) def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsize=(6, 6)): plt.cla() Loading Loading @@ -54,6 +56,7 @@ def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsiz plt.savefig(save_as, bbox_inches='tight', pad_inches=0.1, dpi=300, transparent=True) @_wrap_func_as_cli @_mock_load_truncated_images(True) def image_table(images: List[List[ImageTyping]], columns: List[str], rows: List[str], save_as: str, keep_axis: bool = False, figsize=(720, 600), dpi: int = 300, fontsize: int = 18, padsize: int = 5): Loading Loading
.gitignore +1 −1 Original line number Diff line number Diff line Loading @@ -1205,7 +1205,7 @@ fabric.properties /docs/source/**/*.sh.err /docs/source/**/*.sh.exitcode /docs/source/**/*.dat.* !/docs/source/**/*.benchmark.py.* !/docs/source/**/*.plot.py.svg !/docs/source/_static/**/* /docs/source/**/*.result.ipynb /cartpole_dqn_* Loading
README.md +7 −7 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ to [Installation](https://deepghs.github.io/imgutils/main/tutorials/installation For the dataset, we need to filter the differences between the tachie(差分). As shown in the following picture   We can use `lpips_clustering` to cluster such situations as shown below Loading @@ -73,11 +73,11 @@ Currently, object detection is supported for anime heads and person, as shown be * Head Detection   * Person Detection   Based on practical tests, head detection currently has a very stable performance and can be used for automation tasks. However, person detection is still being further iterated and will focus on enhancing detection capabilities for Loading @@ -88,7 +88,7 @@ artistic illustrations in the future. Anime images can be converted to line drawings using the model provided by [patrickvonplaten/controlnet_aux](https://github.com/patrickvonplaten/controlnet_aux), as shown below.   It is worth noting that the `lineart` model may consume more computational resources, while `canny` is the fastest but has average effect. Therefore, `lineart_anime` may be the most balanced choice in most cases. Loading @@ -99,7 +99,7 @@ When filtering the crawled images, we need to remove monochrome images. However, composed of grayscale colors and may still contain colors, as shown by the first two rows of six images in the figure below   We can use `is_monochrome` to determine whether an image is monochrome, as shown below: Loading Loading @@ -159,7 +159,7 @@ if __name__ == '__main__': The `imgutils` library integrates various anime-style image tagging models, allowing for results similar to the following:   The ratings, features, and characters in the image can be detected, like this: Loading Loading @@ -246,7 +246,7 @@ the [`segment-rgba-with-isnetis`](https://deepghs.github.io/imgutils/main/api_do function for extraction and obtain an RGBA format image (with the background part being transparent), just like the example shown below.   ```python from imgutils.segment import segment_rgba_with_isnetis Loading
docs/Makefile +2 −2 Original line number Diff line number Diff line Loading @@ -45,5 +45,5 @@ sourcedir: builddir: @echo $(shell readlink -f ${BUILDDIR}/html) cleanbm: $(ALL) cleanbm cleanplt: $(ALL) cleanplt
docs/source/_libs/cli.py 0 → 100644 +17 −0 Original line number Diff line number Diff line from functools import wraps import click def _wrap_func_as_cli(func): @wraps(func) def _new_func(*args, **kwargs): @click.command() @click.option('--output', '-o', 'save_as', type=click.Path(dir_okay=False), required=True, help='Output path of image file.', show_default=True) def _execute(save_as): func(*args, save_as=save_as, **kwargs) _execute() return _new_func
docs/source/_libs/plot.py +3 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ from typing import Tuple, List import matplotlib.pyplot as plt from PIL import Image from cli import _wrap_func_as_cli from imgutils.data import load_image, grid_transparent, ImageTyping from imgutils.validate.truncate import _mock_load_truncated_images Loading @@ -22,6 +23,7 @@ def _image_input_process(img) -> Tuple[Image.Image, str]: return grid_transparent(image), label @_wrap_func_as_cli @_mock_load_truncated_images(True) def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsize=(6, 6)): plt.cla() Loading Loading @@ -54,6 +56,7 @@ def image_plot(*images, save_as: str, columns=2, keep_axis: bool = False, figsiz plt.savefig(save_as, bbox_inches='tight', pad_inches=0.1, dpi=300, transparent=True) @_wrap_func_as_cli @_mock_load_truncated_images(True) def image_table(images: List[List[ImageTyping]], columns: List[str], rows: List[str], save_as: str, keep_axis: bool = False, figsize=(720, 600), dpi: int = 300, fontsize: int = 18, padsize: int = 5): Loading