deepghs / imgutils

A convenient and user-friendly anime-style image data processing library that integrates various advanced anime-style image processing models
https://dghs-imgutils.deepghs.org/
MIT License
218 stars 16 forks source link

dev(narugo): optimize the preprocessing of wd14 tagger #113

Closed narugo1992 closed 1 month ago

narugo1992 commented 1 month ago
import time

from PIL import Image

from imgutils.generic.classify import _img_encode
from imgutils.tagging.wd14 import _prepare_image_for_tagging

image = Image.new('RGBA', (6300, 6650), 'black')
print('Loaded', image)

start_time = time.time()
# for wd14 taggers
# optimize from 4.0s+ to 0.3s
_ = _prepare_image_for_tagging(image, 448)
print('ff', time.time() - start_time)

start_time = time.time()
_ = _img_encode(image, size=(384, 384))
print('ff', time.time() - start_time)
codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 96.88%. Comparing base (5f14d6a) to head (bb62aad). Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #113 +/- ## ======================================= Coverage 96.87% 96.88% ======================================= Files 103 103 Lines 3394 3398 +4 ======================================= + Hits 3288 3292 +4 Misses 106 106 ``` | [Flag](https://app.codecov.io/gh/deepghs/imgutils/pull/113/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepghs) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/deepghs/imgutils/pull/113/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepghs) | `96.88% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=deepghs#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.