-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dev(narugo): add many diff benchmarks
- Loading branch information
1 parent
1fc3912
commit 3caa469
Showing
6 changed files
with
234 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,39 @@ | ||
import random | ||
|
||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
|
||
from benchmark import BaseBenchmark, create_plot_cli | ||
from realutils.detect.yolo import detect_by_yolo, _REPO_ID | ||
|
||
_MODELS = _open_models_for_repo_id(_REPO_ID).model_names | ||
|
||
|
||
class YOLOBenchmark(BaseBenchmark): | ||
def __init__(self, model_name: str): | ||
BaseBenchmark.__init__(self) | ||
self.model_name = model_name | ||
|
||
def load(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_ = _open_models_for_repo_id(_REPO_ID)._open_model(self.model_name) | ||
|
||
def unload(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_open_models_for_repo_id.cache_clear() | ||
|
||
def run(self): | ||
image_file = random.choice(self.all_images) | ||
_ = detect_by_yolo(image_file, model_name=self.model_name) | ||
|
||
|
||
if __name__ == '__main__': | ||
create_plot_cli( | ||
[ | ||
(model_name, YOLOBenchmark(model_name)) | ||
for model_name in _MODELS | ||
if model_name.startswith('rtdetr') | ||
], | ||
title='Benchmark for RT-DETR Models', | ||
run_times=10, | ||
try_times=20, | ||
)() |
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,39 @@ | ||
import random | ||
|
||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
|
||
from benchmark import BaseBenchmark, create_plot_cli | ||
from realutils.detect.yolo import detect_by_yolo, _REPO_ID | ||
|
||
_MODELS = _open_models_for_repo_id(_REPO_ID).model_names | ||
|
||
|
||
class YOLOBenchmark(BaseBenchmark): | ||
def __init__(self, model_name: str): | ||
BaseBenchmark.__init__(self) | ||
self.model_name = model_name | ||
|
||
def load(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_ = _open_models_for_repo_id(_REPO_ID)._open_model(self.model_name) | ||
|
||
def unload(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_open_models_for_repo_id.cache_clear() | ||
|
||
def run(self): | ||
image_file = random.choice(self.all_images) | ||
_ = detect_by_yolo(image_file, model_name=self.model_name) | ||
|
||
|
||
if __name__ == '__main__': | ||
create_plot_cli( | ||
[ | ||
(model_name, YOLOBenchmark(model_name)) | ||
for model_name in _MODELS | ||
if model_name.startswith('yolo11') | ||
], | ||
title='Benchmark for YOLO11 Models', | ||
run_times=10, | ||
try_times=20, | ||
)() |
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,39 @@ | ||
import random | ||
|
||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
|
||
from benchmark import BaseBenchmark, create_plot_cli | ||
from realutils.detect.yolo import detect_by_yolo, _REPO_ID | ||
|
||
_MODELS = _open_models_for_repo_id(_REPO_ID).model_names | ||
|
||
|
||
class YOLOBenchmark(BaseBenchmark): | ||
def __init__(self, model_name: str): | ||
BaseBenchmark.__init__(self) | ||
self.model_name = model_name | ||
|
||
def load(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_ = _open_models_for_repo_id(_REPO_ID)._open_model(self.model_name) | ||
|
||
def unload(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_open_models_for_repo_id.cache_clear() | ||
|
||
def run(self): | ||
image_file = random.choice(self.all_images) | ||
_ = detect_by_yolo(image_file, model_name=self.model_name) | ||
|
||
|
||
if __name__ == '__main__': | ||
create_plot_cli( | ||
[ | ||
(model_name, YOLOBenchmark(model_name)) | ||
for model_name in _MODELS | ||
if model_name.startswith('yolov10') | ||
], | ||
title='Benchmark for YOLOv10 Models', | ||
run_times=10, | ||
try_times=20, | ||
)() |
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,39 @@ | ||
import random | ||
|
||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
|
||
from benchmark import BaseBenchmark, create_plot_cli | ||
from realutils.detect.yolo import detect_by_yolo, _REPO_ID | ||
|
||
_MODELS = _open_models_for_repo_id(_REPO_ID).model_names | ||
|
||
|
||
class YOLOBenchmark(BaseBenchmark): | ||
def __init__(self, model_name: str): | ||
BaseBenchmark.__init__(self) | ||
self.model_name = model_name | ||
|
||
def load(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_ = _open_models_for_repo_id(_REPO_ID)._open_model(self.model_name) | ||
|
||
def unload(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_open_models_for_repo_id.cache_clear() | ||
|
||
def run(self): | ||
image_file = random.choice(self.all_images) | ||
_ = detect_by_yolo(image_file, model_name=self.model_name) | ||
|
||
|
||
if __name__ == '__main__': | ||
create_plot_cli( | ||
[ | ||
(model_name, YOLOBenchmark(model_name)) | ||
for model_name in _MODELS | ||
if model_name.startswith('yolov5') | ||
], | ||
title='Benchmark for YOLOv5 Models', | ||
run_times=10, | ||
try_times=20, | ||
)() |
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,39 @@ | ||
import random | ||
|
||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
|
||
from benchmark import BaseBenchmark, create_plot_cli | ||
from realutils.detect.yolo import detect_by_yolo, _REPO_ID | ||
|
||
_MODELS = _open_models_for_repo_id(_REPO_ID).model_names | ||
|
||
|
||
class YOLOBenchmark(BaseBenchmark): | ||
def __init__(self, model_name: str): | ||
BaseBenchmark.__init__(self) | ||
self.model_name = model_name | ||
|
||
def load(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_ = _open_models_for_repo_id(_REPO_ID)._open_model(self.model_name) | ||
|
||
def unload(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_open_models_for_repo_id.cache_clear() | ||
|
||
def run(self): | ||
image_file = random.choice(self.all_images) | ||
_ = detect_by_yolo(image_file, model_name=self.model_name) | ||
|
||
|
||
if __name__ == '__main__': | ||
create_plot_cli( | ||
[ | ||
(model_name, YOLOBenchmark(model_name)) | ||
for model_name in _MODELS | ||
if model_name.startswith('yolov8') | ||
], | ||
title='Benchmark for YOLOv8 Models', | ||
run_times=10, | ||
try_times=20, | ||
)() |
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,39 @@ | ||
import random | ||
|
||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
|
||
from benchmark import BaseBenchmark, create_plot_cli | ||
from realutils.detect.yolo import detect_by_yolo, _REPO_ID | ||
|
||
_MODELS = _open_models_for_repo_id(_REPO_ID).model_names | ||
|
||
|
||
class YOLOBenchmark(BaseBenchmark): | ||
def __init__(self, model_name: str): | ||
BaseBenchmark.__init__(self) | ||
self.model_name = model_name | ||
|
||
def load(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_ = _open_models_for_repo_id(_REPO_ID)._open_model(self.model_name) | ||
|
||
def unload(self): | ||
from imgutils.generic.yolo import _open_models_for_repo_id | ||
_open_models_for_repo_id.cache_clear() | ||
|
||
def run(self): | ||
image_file = random.choice(self.all_images) | ||
_ = detect_by_yolo(image_file, model_name=self.model_name) | ||
|
||
|
||
if __name__ == '__main__': | ||
create_plot_cli( | ||
[ | ||
(model_name, YOLOBenchmark(model_name)) | ||
for model_name in _MODELS | ||
if model_name.startswith('yolov9') | ||
], | ||
title='Benchmark for YOLOv9 Models', | ||
run_times=10, | ||
try_times=20, | ||
)() |