forked from mergeos-bounties/PlantGuide
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_identify.py
More file actions
26 lines (19 loc) · 815 Bytes
/
Copy pathtest_identify.py
File metadata and controls
26 lines (19 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
from __future__ import annotations
from plantguide.data.loader import list_sample_files, list_species_files
from plantguide.identify.pipeline import identify_from_sample, identify_from_tags
def test_catalog_size() -> None:
assert len(list_species_files()) >= 8
def test_identify_tags_monstera() -> None:
result = identify_from_tags("tropical,fenestrated leaves,climbing,large leaves", top_k=3)
assert result["matches"]
assert result["matches"][0]["species_id"] == "monstera_deliciosa"
assert "top_care" in result
def test_samples_top1_hits() -> None:
files = list_sample_files()
assert len(files) >= 5
hits = 0
for path in files:
result = identify_from_sample(path)
if result.get("hit_top1"):
hits += 1
assert hits >= int(0.7 * len(files))