Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lucas Miranda
deepOF
Commits
aafd2ff9
Commit
aafd2ff9
authored
Apr 12, 2021
by
lucas_miranda
Browse files
Propagated rule-based labels to the training set on .preprocess()
parent
fd096b0e
Changes
2
Hide whitespace changes
Inline
Side-by-side
deepof/data.py
View file @
aafd2ff9
...
...
@@ -1092,6 +1092,11 @@ class table_dict(dict):
except
ValueError
:
X_train
,
y_train
=
X_train
[:,
:
-
n_annot
],
X_train
[:,
-
n_annot
:]
# Convert speed to a boolean value. Is the animal moving?
y_train
[:,
-
1
]
=
(
y_train
[:,
-
1
]
>
deepof
.
pose_utils
.
get_hparameters
()[
"huddle_speed"
]
)
try
:
try
:
X_test
,
y_test
=
X_test
[:,
:
-
n_annot
],
np
.
concatenate
(
...
...
@@ -1099,6 +1104,12 @@ class table_dict(dict):
)
except
ValueError
:
X_test
,
y_test
=
X_test
[:,
:
-
n_annot
],
X_test
[:,
-
n_annot
:]
# Convert speed to a boolean value. Is the animal moving?
y_test
[:,
-
1
]
=
(
y_test
[:,
-
1
]
>
deepof
.
pose_utils
.
get_hparameters
()[
"huddle_speed"
]
)
except
IndexError
:
pass
...
...
deepof/pose_utils.py
View file @
aafd2ff9
...
...
@@ -559,7 +559,7 @@ def get_hparameters(hparams: dict = {}) -> dict:
"follow_frames"
:
10
,
"follow_tol"
:
5
,
"huddle_forward"
:
15
,
"huddle_speed"
:
1
,
"huddle_speed"
:
2
,
"nose_likelihood"
:
0.85
,
"fps"
:
24
,
}
...
...
@@ -782,7 +782,6 @@ def rule_based_tagging(
animal_id
=
_id
,
)
)
tag_dict
[
_id
+
undercond
+
"speed"
]
=
overall_speed
(
speeds
,
_id
,
undercond
)
tag_dict
[
_id
+
undercond
+
"huddle"
]
=
deepof
.
utils
.
smooth_boolean_array
(
huddle
(
coords
,
...
...
@@ -810,6 +809,9 @@ def rule_based_tagging(
animal_id
=
_id
,
)
)
# NOTE: It's important that speeds remain the last columns.
# Preprocessing for weakly supervised autoencoders relies on this
tag_dict
[
_id
+
undercond
+
"speed"
]
=
overall_speed
(
speeds
,
_id
,
undercond
)
tag_df
=
pd
.
DataFrame
(
tag_dict
).
fillna
(
0
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment