Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Gdrnpp Bop2022
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Guillaume Duret
Gdrnpp Bop2022
Commits
ec064e37
Commit
ec064e37
authored
2 years ago
by
liuxingyu
Browse files
Options
Downloads
Patches
Plain Diff
add algorithm for computing keypoints
parent
a70764f6
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/gdrn_modeling/tools/lmo/lmo_1_compute_keypoints_3d.py
+46
-0
46 additions, 0 deletions
core/gdrn_modeling/tools/lmo/lmo_1_compute_keypoints_3d.py
with
46 additions
and
0 deletions
core/gdrn_modeling/tools/lmo/lmo_1_compute_keypoints_3d.py
0 → 100644
+
46
−
0
View file @
ec064e37
# compute bbox3d, fps (farthest point sampling) for models
import
os.path
as
osp
import
sys
from
tqdm
import
tqdm
cur_dir
=
osp
.
dirname
(
osp
.
abspath
(
__file__
))
sys
.
path
.
insert
(
0
,
osp
.
join
(
cur_dir
,
"
../../../../
"
))
import
mmcv
from
lib.pysixd
import
inout
,
misc
import
ref
from
core.utils.data_utils
import
get_fps_and_center
ref_key
=
"
lmo_full
"
data_ref
=
ref
.
__dict__
[
ref_key
]
model_dir
=
data_ref
.
model_dir
id2obj
=
data_ref
.
id2obj
def
main
():
vertex_scale
=
0.001
kpts3d_dict
=
{}
for
obj_id
in
tqdm
(
id2obj
):
print
(
obj_id
)
model_path
=
osp
.
join
(
model_dir
,
f
"
obj_
{
obj_id
:
06
d
}
.ply
"
)
model
=
inout
.
load_ply
(
model_path
,
vertex_scale
=
vertex_scale
)
kpts3d_dict
[
str
(
obj_id
)]
=
{}
kpts3d_dict
[
str
(
obj_id
)][
"
bbox3d_and_center
"
]
=
misc
.
get_bbox3d_and_center
(
model
[
"
pts
"
])
kpts3d_dict
[
str
(
obj_id
)][
"
fps4_and_center
"
]
=
get_fps_and_center
(
model
[
"
pts
"
],
num_fps
=
4
,
init_center
=
True
)
kpts3d_dict
[
str
(
obj_id
)][
"
fps8_and_center
"
]
=
get_fps_and_center
(
model
[
"
pts
"
],
num_fps
=
8
,
init_center
=
True
)
kpts3d_dict
[
str
(
obj_id
)][
"
fps12_and_center
"
]
=
get_fps_and_center
(
model
[
"
pts
"
],
num_fps
=
12
,
init_center
=
True
)
kpts3d_dict
[
str
(
obj_id
)][
"
fps16_and_center
"
]
=
get_fps_and_center
(
model
[
"
pts
"
],
num_fps
=
16
,
init_center
=
True
)
kpts3d_dict
[
str
(
obj_id
)][
"
fps20_and_center
"
]
=
get_fps_and_center
(
model
[
"
pts
"
],
num_fps
=
20
,
init_center
=
True
)
kpts3d_dict
[
str
(
obj_id
)][
"
fps32_and_center
"
]
=
get_fps_and_center
(
model
[
"
pts
"
],
num_fps
=
32
,
init_center
=
True
)
kpts3d_dict
[
str
(
obj_id
)][
"
fps64_and_center
"
]
=
get_fps_and_center
(
model
[
"
pts
"
],
num_fps
=
64
,
init_center
=
True
)
kpts3d_dict
[
str
(
obj_id
)][
"
fps128_and_center
"
]
=
get_fps_and_center
(
model
[
"
pts
"
],
num_fps
=
128
,
init_center
=
True
)
kpts3d_dict
[
str
(
obj_id
)][
"
fps256_and_center
"
]
=
get_fps_and_center
(
model
[
"
pts
"
],
num_fps
=
256
,
init_center
=
True
)
save_path
=
osp
.
join
(
model_dir
,
"
keypoints_3d.pkl
"
)
mmcv
.
dump
(
kpts3d_dict
,
save_path
)
print
(
f
"
saved to
{
save_path
}
"
)
if
__name__
==
"
__main__
"
:
main
()
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