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
65376047
Commit
65376047
authored
Feb 09, 2021
by
lucas_miranda
Browse files
Implemented outlier interpolation
parent
23168afd
Pipeline
#93120
failed with stage
in 37 minutes and 52 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
deepof/data.py
View file @
65376047
...
...
@@ -63,7 +63,7 @@ class project:
interpolate_outliers
:
bool
=
True
,
interpolation_limit
:
int
=
5
,
interpolation_std
:
int
=
5
,
likelihood_tol
:
float
=
0.
7
5
,
likelihood_tol
:
float
=
0.
2
5
,
model
:
str
=
"mouse_topview"
,
path
:
str
=
deepof
.
utils
.
os
.
path
.
join
(
"."
),
smooth_alpha
:
float
=
0.99
,
...
...
@@ -296,7 +296,9 @@ class project:
print
(
"Iterative imputation of ocluded bodyparts..."
)
for
k
,
value
in
tab_dict
.
items
():
imputed
=
IterativeImputer
(
max_iter
=
250
,
skip_complete
=
True
).
fit_transform
(
value
)
imputed
=
IterativeImputer
(
max_iter
=
250
,
skip_complete
=
True
).
fit_transform
(
value
)
tab_dict
[
k
]
=
pd
.
DataFrame
(
imputed
,
index
=
value
.
index
,
columns
=
value
.
columns
)
...
...
deepof/pose_utils.py
View file @
65376047
...
...
@@ -652,27 +652,25 @@ def tag_rulebased_frames(
)
)
if
len
(
animal_ids
)
>
1
:
if
debug
:
# Print arena for debugging
cv2
.
ellipse
(
frame
,
arena
[
0
],
arena
[
1
],
arena
[
2
],
0
,
360
,
(
0
,
255
,
0
),
3
)
# Print body parts for debuging
for
bpart
in
coords
.
columns
.
levels
[
0
]:
if
not
np
.
isnan
(
coords
[
bpart
][
"x"
][
fnum
]):
cv2
.
circle
(
frame
,
(
int
(
coords
[
bpart
][
"x"
][
fnum
]),
int
(
coords
[
bpart
][
"y"
][
fnum
])),
radius
=
3
,
color
=
(
(
255
,
0
,
0
)
if
bpart
.
startswith
(
animal_ids
[
0
])
else
(
0
,
0
,
255
)
),
thickness
=-
1
,
)
# Print frame number
write_on_frame
(
"Frame "
+
str
(
fnum
),
(
int
(
w
*
0.3
/
10
),
int
(
h
/
1.15
)))
if
debug
:
# Print arena for debugging
cv2
.
ellipse
(
frame
,
arena
[
0
],
arena
[
1
],
arena
[
2
],
0
,
360
,
(
0
,
255
,
0
),
3
)
# Print body parts for debuging
for
bpart
in
coords
.
columns
.
levels
[
0
]:
if
not
np
.
isnan
(
coords
[
bpart
][
"x"
][
fnum
]):
cv2
.
circle
(
frame
,
(
int
(
coords
[
bpart
][
"x"
][
fnum
]),
int
(
coords
[
bpart
][
"y"
][
fnum
])),
radius
=
3
,
color
=
(
(
255
,
0
,
0
)
if
bpart
.
startswith
(
animal_ids
[
0
])
else
(
0
,
0
,
255
)
),
thickness
=-
1
,
)
# Print frame number
write_on_frame
(
"Frame "
+
str
(
fnum
),
(
int
(
w
*
0.3
/
10
),
int
(
h
/
1.15
)))
if
len
(
animal_ids
)
>
1
:
if
tag_dict
[
"nose2nose"
][
fnum
]
and
not
tag_dict
[
"sidebyside"
][
fnum
]:
write_on_frame
(
"Nose-Nose"
,
conditional_pos
())
...
...
@@ -721,7 +719,7 @@ def tag_rulebased_frames(
if
len
(
animal_ids
)
>
1
:
colcond
=
frame_speeds
[
_id
]
==
max
(
list
(
frame_speeds
.
values
()))
else
:
colcond
=
hparams
[
"huddle_speed"
]
>
frame_speeds
colcond
=
hparams
[
"huddle_speed"
]
<
frame_speeds
write_on_frame
(
str
(
...
...
deepof/utils.py
View file @
65376047
...
...
@@ -460,7 +460,7 @@ def interpolate_outliers(
lag
:
int
=
5
,
n_std
:
int
=
3
,
mode
:
str
=
"or"
,
limit
:
int
=
1
5
,
limit
:
int
=
1
0
,
):
"""Marks all outliers in experiment and replaces them using a univariate linear interpolation approach.
Note that this approach only works for equally spaced data (constant camera acquisition rates).
...
...
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