KichangKim / DeepDanbooru

AI based multi-label girl image classification system, implemented by using TensorFlow.
MIT License
2.6k stars 259 forks source link

A way to speed up startup? #29

Closed red-tails closed 3 years ago

red-tails commented 3 years ago

Not an issue, but a question.

Single image: time deepdanbooru evaluate /mnt/f/deepdanbooru/sample-460c5595dcf9b07d58f951d349202d98.jpg --model-path /mnt/f/deepdanbooru/deepdanbooru-v3-20200915-sgd-e30.zip/model-resnet_custom_v3.h5 --tags-path /mnt/f/deepdanbooru/deepdanbooru-v3-20200915-sgd-e30.zip/tags.txt --verbose --threshold 0.500 --no-compile real 0m19.199s

Folder with 14 images: time deepdanbooru evaluate /mnt/f/deepdanbooru/1/ --model-path /mnt/f/deepdanbooru/deepdanbooru-v3-20200915-sgd-e30.zip/model-resnet_custom_v3.h5 --tags-path /mnt/f/deepdanbooru/deepdanbooru-v3-20200915-sgd-e30.zip/tags.txt --verbose --threshold 0.500 --no-compile --allow-folder real 0m29.276s

Seems that actual recognition only takes 1 sec/image. But startup takes 20 seconds.

Is there a way to speed this up, or keep deepdanbooru running?

KichangKim commented 3 years ago

Most of the time on startup is model (hundreds of MB) loading time. Currently, DeepDanbooru does not have built-in method for keeping model in memory. But you can make your own evaluation app by using DeepDanbooru's API.

See https://github.com/KichangKim/DeepDanbooru/blob/master/deepdanbooru/commands/evaluate.py