Skip to content

Commit

Permalink
dev(narugo): add similarity
Browse files Browse the repository at this point in the history
  • Loading branch information
narugo1992 committed Oct 6, 2024
1 parent ed1665a commit 490a653
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/detect/test_head.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest

from imgutils.detect import detection_similarity
from imgutils.detect.head import detect_heads
from imgutils.generic.yolo import _open_models_for_repo_id
from test.testings import get_testfile
Expand Down Expand Up @@ -37,3 +38,16 @@ def test_detect_heads_none(self):
def test_detect_heads_not_found(self):
with pytest.raises(ValueError):
_ = detect_heads(get_testfile('genshin_post.png'), model_name='not_found')

@pytest.mark.parametrize(['model_name'], [
('head_detect_v1.6_n_yv10',),
])
def test_detect_with_yolov10(self, model_name: str):
detections = detect_heads(get_testfile('genshin_post.jpg'), model_name=model_name)
similarity = detection_similarity(detections, [
((202, 156, 356, 293), 'head', 0.876),
((936, 86, 1134, 267), 'head', 0.834),
((650, 444, 720, 518), 'head', 0.778),
((461, 247, 536, 330), 'head', 0.434),
])
assert similarity >= 0.85

0 comments on commit 490a653

Please sign in to comment.