Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
3
3DPose
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sensing
3DPose
Commits
67a0c7b1
Commit
67a0c7b1
authored
May 15, 2021
by
Sensing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wifi group commit
parent
9ffcfd30
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
454 additions
and
0 deletions
+454
-0
ResNet_v2.py
ResNet_v2.py
+412
-0
p-mpjpe.py
p-mpjpe.py
+42
-0
No files found.
ResNet_v2.py
0 → 100644
View file @
67a0c7b1
This diff is collapsed.
Click to expand it.
p-mpjpe.py
0 → 100644
View file @
67a0c7b1
def
p_mpjpe
(
predicted
,
target
):
"""
Pose error: MPJPE after rigid alignment (scale, rotation, and translation),
often referred to as "Protocol #2" in many papers.
"""
assert
predicted
.
shape
==
target
.
shape
muX
=
np
.
mean
(
target
,
axis
=
1
,
keepdims
=
True
)
# print(muX.shape)
muY
=
np
.
mean
(
predicted
,
axis
=
1
,
keepdims
=
True
)
X0
=
target
-
muX
Y0
=
predicted
-
muY
normX
=
np
.
sqrt
(
np
.
sum
(
X0
**
2
,
axis
=
(
1
,
2
),
keepdims
=
True
))
normY
=
np
.
sqrt
(
np
.
sum
(
Y0
**
2
,
axis
=
(
1
,
2
),
keepdims
=
True
))
X0
/=
normX
Y0
/=
normY
H
=
np
.
matmul
(
X0
.
transpose
(
0
,
2
,
1
),
Y0
)
U
,
s
,
Vt
=
np
.
linalg
.
svd
(
H
)
V
=
Vt
.
transpose
(
0
,
2
,
1
)
R
=
np
.
matmul
(
V
,
U
.
transpose
(
0
,
2
,
1
))
# Avoid improper rotations (reflections), i.e. rotations with det(R) = -1
sign_detR
=
np
.
sign
(
np
.
expand_dims
(
np
.
linalg
.
det
(
R
),
axis
=
1
))
V
[:,
:,
-
1
]
*=
sign_detR
s
[:,
-
1
]
*=
sign_detR
.
flatten
()
R
=
np
.
matmul
(
V
,
U
.
transpose
(
0
,
2
,
1
))
# Rotation
tr
=
np
.
expand_dims
(
np
.
sum
(
s
,
axis
=
1
,
keepdims
=
True
),
axis
=
2
)
a
=
tr
*
normX
/
normY
# Scale
t
=
muX
-
a
*
np
.
matmul
(
muY
,
R
)
# Translation
# Perform rigid transformation on the input
predicted_aligned
=
a
*
np
.
matmul
(
predicted
,
R
)
+
t
# print('11111'+ str(np.shape(predicted_aligned)))
mean_17
=
np
.
mean
(
np
.
linalg
.
norm
(
predicted_aligned
-
target
,
axis
=
len
(
target
.
shape
)
-
1
),
axis
=
0
)
all
=
np
.
mean
(
np
.
linalg
.
norm
(
predicted_aligned
-
target
,
axis
=
len
(
target
.
shape
)
-
1
))
# Return MPJPE
return
all
,
mean_17
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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