Commit b2f4bbb6 authored by lucas_miranda's avatar lucas_miranda
Browse files

Added testing examples for multi animal deepof pipeline

parent 74993ad3
Pipeline #91441 passed with stage
in 22 minutes and 36 seconds
...@@ -556,7 +556,7 @@ def rule_based_tagging( ...@@ -556,7 +556,7 @@ def rule_based_tagging(
hparams["huddle_forward"], hparams["huddle_forward"],
hparams["huddle_spine"], hparams["huddle_spine"],
hparams["huddle_speed"], hparams["huddle_speed"],
animal_id=_id animal_id=_id,
) )
) )
...@@ -602,13 +602,14 @@ def tag_rulebased_frames( ...@@ -602,13 +602,14 @@ def tag_rulebased_frames(
else: else:
return 150, 255, 150 return 150, 255, 150
zipped_pos = zip( zipped_pos = list(zip(
animal_ids, animal_ids,
[corners["downleft"], corners["downright"]], [corners["downleft"], corners["downright"]],
[corners["upleft"], corners["upright"]], [corners["upleft"], corners["upright"]],
) ))
if len(animal_ids) > 1: if len(animal_ids) > 1:
if tag_dict["nose2nose"][fnum] and not tag_dict["sidebyside"][fnum]: if tag_dict["nose2nose"][fnum] and not tag_dict["sidebyside"][fnum]:
write_on_frame("Nose-Nose", conditional_pos()) write_on_frame("Nose-Nose", conditional_pos())
if ( if (
...@@ -659,7 +660,10 @@ def tag_rulebased_frames( ...@@ -659,7 +660,10 @@ def tag_rulebased_frames(
colcond = hparams["huddle_speed"] > frame_speeds colcond = hparams["huddle_speed"] > frame_speeds
write_on_frame( write_on_frame(
str(np.round(frame_speeds, 2)) + " mmpf", str(
np.round((frame_speeds if len(animal_ids) == 1 else frame_speeds[_id]), 2)
)
+ " mmpf",
up_pos, up_pos,
conditional_col(cond=colcond), conditional_col(cond=colcond),
) )
......
...@@ -385,7 +385,9 @@ def test_rule_based_tagging(multi_animal, video_output): ...@@ -385,7 +385,9 @@ def test_rule_based_tagging(multi_animal, video_output):
animal_ids=(["B", "W"] if multi_animal else [""]), animal_ids=(["B", "W"] if multi_animal else [""]),
).run(verbose=True) ).run(verbose=True)
hardcoded_tags = prun.rule_based_annotation(video_output=video_output, frame_limit=50) hardcoded_tags = prun.rule_based_annotation(
video_output=video_output, frame_limit=50
)
assert type(hardcoded_tags) == deepof.data.table_dict assert type(hardcoded_tags) == deepof.data.table_dict
assert list(hardcoded_tags.values())[0].shape[1] == (13 if multi_animal else 3) assert list(hardcoded_tags.values())[0].shape[1] == (13 if multi_animal else 3)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment