-
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 #35 from deepghs/dev/hand
dev(narugo): add benchmark for hand detection
- Loading branch information
Showing
9 changed files
with
2,915 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 @@ | ||
imgutils.detect.hand | ||
========================== | ||
|
||
.. currentmodule:: imgutils.detect.hand | ||
|
||
.. automodule:: imgutils.detect.hand | ||
|
||
|
||
detect_hands | ||
------------------------------ | ||
|
||
.. autofunction:: detect_hands | ||
|
||
|
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.detect import detect_hands | ||
|
||
|
||
class HandDetectBenchmark(BaseBenchmark): | ||
def __init__(self, version, level): | ||
BaseBenchmark.__init__(self) | ||
self.version = version | ||
self.level = level | ||
|
||
def load(self): | ||
from imgutils.detect.hand import _open_hand_detect_model | ||
_ = _open_hand_detect_model(version=self.version, level=self.level) | ||
|
||
def unload(self): | ||
from imgutils.detect.hand import _open_hand_detect_model | ||
_open_hand_detect_model.cache_clear() | ||
|
||
def run(self): | ||
image_file = random.choice(self.all_images) | ||
_ = detect_hands(image_file, version=self.version, level=self.level) | ||
|
||
|
||
if __name__ == '__main__': | ||
create_plot_cli( | ||
[ | ||
('hand v0.8 (yolov8s)', HandDetectBenchmark('v0.8', 's')), | ||
('hand v1.0 (yolov8s)', HandDetectBenchmark('v1.0', 's')), | ||
('hand v1.0 (yolov8n)', HandDetectBenchmark('v1.0', 'n')), | ||
], | ||
title='Benchmark for Anime Hand Detections', | ||
run_times=10, | ||
try_times=20, | ||
)() |
Oops, something went wrong.