Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
deepOF
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lucas Miranda
deepOF
Commits
617966ac
Commit
617966ac
authored
4 years ago
by
Lucas Miranda
Browse files
Options
Downloads
Patches
Plain Diff
Fixed a bug on simple data projectors
parent
521ff2b9
No related branches found
No related tags found
No related merge requests found
Pipeline
#92774
passed
4 years ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
deepof/data.py
+4
-0
4 additions, 0 deletions
deepof/data.py
examples/main.ipynb
+444
-159
444 additions, 159 deletions
examples/main.ipynb
tests/test_pose_utils.py
+3
-14
3 additions, 14 deletions
tests/test_pose_utils.py
with
451 additions
and
173 deletions
deepof/data.py
+
4
−
0
View file @
617966ac
...
@@ -20,6 +20,7 @@ from typing import Dict, List, Tuple, Union
...
@@ -20,6 +20,7 @@ from typing import Dict, List, Tuple, Union
from
multiprocessing
import
cpu_count
from
multiprocessing
import
cpu_count
from
sklearn
import
random_projection
from
sklearn
import
random_projection
from
sklearn.decomposition
import
KernelPCA
from
sklearn.decomposition
import
KernelPCA
from
sklearn.impute
import
SimpleImputer
from
sklearn.manifold
import
TSNE
from
sklearn.manifold
import
TSNE
from
sklearn.preprocessing
import
MinMaxScaler
,
StandardScaler
,
LabelEncoder
from
sklearn.preprocessing
import
MinMaxScaler
,
StandardScaler
,
LabelEncoder
from
tqdm
import
tqdm
from
tqdm
import
tqdm
...
@@ -1049,6 +1050,7 @@ class table_dict(dict):
...
@@ -1049,6 +1050,7 @@ class table_dict(dict):
# noinspection PyUnresolvedReferences
# noinspection PyUnresolvedReferences
X
=
X
[
np
.
random
.
choice
(
X
.
shape
[
0
],
sample
,
replace
=
False
),
:]
X
=
X
[
np
.
random
.
choice
(
X
.
shape
[
0
],
sample
,
replace
=
False
),
:]
X
=
SimpleImputer
(
strategy
=
"
median
"
).
fit_transform
(
X
)
rproj
=
random_projection
.
GaussianRandomProjection
(
n_components
=
n_components
)
rproj
=
random_projection
.
GaussianRandomProjection
(
n_components
=
n_components
)
X
=
rproj
.
fit_transform
(
X
)
X
=
rproj
.
fit_transform
(
X
)
...
@@ -1063,6 +1065,7 @@ class table_dict(dict):
...
@@ -1063,6 +1065,7 @@ class table_dict(dict):
performance or visualization reasons
"""
performance or visualization reasons
"""
X
=
self
.
get_training_set
()[
0
]
X
=
self
.
get_training_set
()[
0
]
X
=
SimpleImputer
(
strategy
=
"
median
"
).
fit_transform
(
X
)
# Takes care of propagated labels if present
# Takes care of propagated labels if present
if
self
.
_propagate_labels
:
if
self
.
_propagate_labels
:
...
@@ -1084,6 +1087,7 @@ class table_dict(dict):
...
@@ -1084,6 +1087,7 @@ class table_dict(dict):
performance or visualization reasons
"""
performance or visualization reasons
"""
X
=
self
.
get_training_set
()[
0
]
X
=
self
.
get_training_set
()[
0
]
X
=
SimpleImputer
(
strategy
=
"
median
"
).
fit_transform
(
X
)
# Takes care of propagated labels if present
# Takes care of propagated labels if present
if
self
.
_propagate_labels
:
if
self
.
_propagate_labels
:
...
...
This diff is collapsed.
Click to expand it.
examples/main.ipynb
+
444
−
159
View file @
617966ac
Source diff could not be displayed: it is too large. Options to address this:
view the blob
.
This diff is collapsed.
Click to expand it.
tests/test_pose_utils.py
+
3
−
14
View file @
617966ac
...
@@ -137,23 +137,16 @@ def test_climb_wall(center, axes, angle, tol):
...
@@ -137,23 +137,16 @@ def test_climb_wall(center, axes, angle, tol):
"
y4
"
,
"
y4
"
,
"
X5
"
,
"
X5
"
,
"
y5
"
,
"
y5
"
,
"
X6
"
,
"
y6
"
,
"
X7
"
,
"
y7
"
,
"
X8
"
,
"
y8
"
,
],
],
dtype
=
float
,
dtype
=
float
,
elements
=
st
.
floats
(
min_value
=-
20
,
max_value
=
20
),
elements
=
st
.
floats
(
min_value
=-
20
,
max_value
=
20
),
),
),
),
),
tol_forward
=
st
.
floats
(
min_value
=
0.01
,
max_value
=
4.98
),
tol_forward
=
st
.
floats
(
min_value
=
0.01
,
max_value
=
4.98
),
tol_spine
=
st
.
floats
(
min_value
=
0.01
,
max_value
=
4.98
),
tol_speed
=
st
.
floats
(
min_value
=
0.01
,
max_value
=
4.98
),
tol_speed
=
st
.
floats
(
min_value
=
0.01
,
max_value
=
4.98
),
animal_id
=
st
.
text
(
min_size
=
0
,
max_size
=
15
,
alphabet
=
string
.
ascii_lowercase
),
animal_id
=
st
.
text
(
min_size
=
0
,
max_size
=
15
,
alphabet
=
string
.
ascii_lowercase
),
)
)
def
test_huddle
(
pos_dframe
,
tol_forward
,
tol_spine
,
tol_speed
,
animal_id
):
def
test_huddle
(
pos_dframe
,
tol_forward
,
tol_speed
,
animal_id
):
_id
=
animal_id
_id
=
animal_id
if
animal_id
!=
""
:
if
animal_id
!=
""
:
...
@@ -162,14 +155,11 @@ def test_huddle(pos_dframe, tol_forward, tol_spine, tol_speed, animal_id):
...
@@ -162,14 +155,11 @@ def test_huddle(pos_dframe, tol_forward, tol_spine, tol_speed, animal_id):
idx
=
pd
.
MultiIndex
.
from_product
(
idx
=
pd
.
MultiIndex
.
from_product
(
[
[
[
[
_id
+
"
Left_
ear
"
,
_id
+
"
Left_
bhip
"
,
_id
+
"
Right_
ear
"
,
_id
+
"
Right_
bhip
"
,
_id
+
"
Left_fhip
"
,
_id
+
"
Left_fhip
"
,
_id
+
"
Right_fhip
"
,
_id
+
"
Right_fhip
"
,
_id
+
"
Spine_1
"
,
_id
+
"
Center
"
,
_id
+
"
Center
"
,
_id
+
"
Spine_2
"
,
_id
+
"
Tail_base
"
,
],
],
[
"
X
"
,
"
y
"
],
[
"
X
"
,
"
y
"
],
],
],
...
@@ -180,7 +170,6 @@ def test_huddle(pos_dframe, tol_forward, tol_spine, tol_speed, animal_id):
...
@@ -180,7 +170,6 @@ def test_huddle(pos_dframe, tol_forward, tol_spine, tol_speed, animal_id):
pos_dframe
,
pos_dframe
,
pos_dframe
.
xs
(
"
X
"
,
level
=
"
coords
"
,
axis
=
1
,
drop_level
=
True
),
pos_dframe
.
xs
(
"
X
"
,
level
=
"
coords
"
,
axis
=
1
,
drop_level
=
True
),
tol_forward
,
tol_forward
,
tol_spine
,
tol_speed
,
tol_speed
,
animal_id
,
animal_id
,
)
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment