Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
mmdetection3d
Commits
9671da9d
Commit
9671da9d
authored
Apr 26, 2020
by
liyinhao
Browse files
change class names
parent
c8fa96f8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
15 deletions
+11
-15
tools/data_converter/scannet_converter.py
tools/data_converter/scannet_converter.py
+3
-3
tools/data_converter/scannet_data_utils.py
tools/data_converter/scannet_data_utils.py
+1
-4
tools/data_converter/sunrgbd_converter.py
tools/data_converter/sunrgbd_converter.py
+3
-4
tools/data_converter/sunrgbd_data_utils.py
tools/data_converter/sunrgbd_data_utils.py
+4
-4
No files found.
tools/data_converter/scannet_converter.py
View file @
9671da9d
...
@@ -2,7 +2,7 @@ import os
...
@@ -2,7 +2,7 @@ import os
import
pickle
import
pickle
from
pathlib
import
Path
from
pathlib
import
Path
from
tools.data_converter.scannet_data_utils
import
Scan
n
et
Object
from
tools.data_converter.scannet_data_utils
import
Scan
N
et
Data
def
create_scannet_info_file
(
data_path
,
pkl_prefix
=
'scannet'
,
save_path
=
None
):
def
create_scannet_info_file
(
data_path
,
pkl_prefix
=
'scannet'
,
save_path
=
None
):
...
@@ -14,8 +14,8 @@ def create_scannet_info_file(data_path, pkl_prefix='scannet', save_path=None):
...
@@ -14,8 +14,8 @@ def create_scannet_info_file(data_path, pkl_prefix='scannet', save_path=None):
assert
os
.
path
.
exists
(
save_path
)
assert
os
.
path
.
exists
(
save_path
)
train_filename
=
save_path
/
f
'
{
pkl_prefix
}
_infos_train.pkl'
train_filename
=
save_path
/
f
'
{
pkl_prefix
}
_infos_train.pkl'
val_filename
=
save_path
/
f
'
{
pkl_prefix
}
_infos_val.pkl'
val_filename
=
save_path
/
f
'
{
pkl_prefix
}
_infos_val.pkl'
train_dataset
=
Scan
n
et
Object
(
root_path
=
data_path
,
split
=
'train'
)
train_dataset
=
Scan
N
et
Data
(
root_path
=
data_path
,
split
=
'train'
)
val_dataset
=
Scan
n
et
Object
(
root_path
=
data_path
,
split
=
'val'
)
val_dataset
=
Scan
N
et
Data
(
root_path
=
data_path
,
split
=
'val'
)
scannet_infos_train
=
train_dataset
.
get_scannet_infos
(
has_label
=
True
)
scannet_infos_train
=
train_dataset
.
get_scannet_infos
(
has_label
=
True
)
with
open
(
train_filename
,
'wb'
)
as
f
:
with
open
(
train_filename
,
'wb'
)
as
f
:
pickle
.
dump
(
scannet_infos_train
,
f
)
pickle
.
dump
(
scannet_infos_train
,
f
)
...
...
tools/data_converter/scannet_data_utils.py
View file @
9671da9d
...
@@ -3,7 +3,7 @@ import os
...
@@ -3,7 +3,7 @@ import os
import
numpy
as
np
import
numpy
as
np
class
Scan
n
et
Object
(
object
):
class
Scan
N
et
Data
(
object
):
''' Load and parse object data '''
''' Load and parse object data '''
def
__init__
(
self
,
root_path
,
split
=
'train'
):
def
__init__
(
self
,
root_path
,
split
=
'train'
):
...
@@ -79,7 +79,4 @@ class ScannetObject(object):
...
@@ -79,7 +79,4 @@ class ScannetObject(object):
else
self
.
sample_id_list
else
self
.
sample_id_list
with
futures
.
ThreadPoolExecutor
(
num_workers
)
as
executor
:
with
futures
.
ThreadPoolExecutor
(
num_workers
)
as
executor
:
infos
=
executor
.
map
(
process_single_scene
,
sample_id_list
)
infos
=
executor
.
map
(
process_single_scene
,
sample_id_list
)
# infos = list()
# for sample in sample_id_list:
# infos.append(process_single_scene(sample))
return
list
(
infos
)
return
list
(
infos
)
tools/data_converter/sunrgbd_converter.py
View file @
9671da9d
...
@@ -2,7 +2,7 @@ import os
...
@@ -2,7 +2,7 @@ import os
import
pickle
import
pickle
from
pathlib
import
Path
from
pathlib
import
Path
from
tools.data_converter.sunrgbd_data_utils
import
SUNRGBD
Object
from
tools.data_converter.sunrgbd_data_utils
import
SUNRGBD
Data
def
create_sunrgbd_info_file
(
data_path
,
def
create_sunrgbd_info_file
(
data_path
,
...
@@ -17,10 +17,9 @@ def create_sunrgbd_info_file(data_path,
...
@@ -17,10 +17,9 @@ def create_sunrgbd_info_file(data_path,
assert
os
.
path
.
exists
(
save_path
)
assert
os
.
path
.
exists
(
save_path
)
train_filename
=
save_path
/
f
'
{
pkl_prefix
}
_infos_train.pkl'
train_filename
=
save_path
/
f
'
{
pkl_prefix
}
_infos_train.pkl'
val_filename
=
save_path
/
f
'
{
pkl_prefix
}
_infos_val.pkl'
val_filename
=
save_path
/
f
'
{
pkl_prefix
}
_infos_val.pkl'
train_dataset
=
SUNRGBD
Object
(
train_dataset
=
SUNRGBD
Data
(
root_path
=
data_path
,
split
=
'train'
,
use_v1
=
use_v1
)
root_path
=
data_path
,
split
=
'train'
,
use_v1
=
use_v1
)
val_dataset
=
SUNRGBDObject
(
val_dataset
=
SUNRGBDData
(
root_path
=
data_path
,
split
=
'val'
,
use_v1
=
use_v1
)
root_path
=
data_path
,
split
=
'val'
,
use_v1
=
use_v1
)
sunrgbd_infos_train
=
train_dataset
.
get_sunrgbd_infos
(
has_label
=
True
)
sunrgbd_infos_train
=
train_dataset
.
get_sunrgbd_infos
(
has_label
=
True
)
with
open
(
train_filename
,
'wb'
)
as
f
:
with
open
(
train_filename
,
'wb'
)
as
f
:
pickle
.
dump
(
sunrgbd_infos_train
,
f
)
pickle
.
dump
(
sunrgbd_infos_train
,
f
)
...
...
tools/data_converter/sunrgbd_data_utils.py
View file @
9671da9d
...
@@ -17,7 +17,7 @@ def random_sampling(pc, num_sample, replace=None, return_choices=False):
...
@@ -17,7 +17,7 @@ def random_sampling(pc, num_sample, replace=None, return_choices=False):
return
pc
[
choices
]
return
pc
[
choices
]
class
SUN
Object3d
(
object
):
class
SUN
RGBDInstance
(
object
):
def
__init__
(
self
,
line
):
def
__init__
(
self
,
line
):
data
=
line
.
split
(
' '
)
data
=
line
.
split
(
' '
)
...
@@ -43,7 +43,7 @@ class SUNObject3d(object):
...
@@ -43,7 +43,7 @@ class SUNObject3d(object):
])
])
class
SUNRGBD
Object
(
object
):
class
SUNRGBD
Data
(
object
):
''' Load and parse object data '''
''' Load and parse object data '''
def
__init__
(
self
,
root_path
,
split
=
'train'
,
use_v1
=
False
):
def
__init__
(
self
,
root_path
,
split
=
'train'
,
use_v1
=
False
):
...
@@ -57,7 +57,7 @@ class SUNRGBDObject(object):
...
@@ -57,7 +57,7 @@ class SUNRGBDObject(object):
self
.
cat2label
=
{
cat
:
self
.
classes
.
index
(
cat
)
for
cat
in
self
.
classes
}
self
.
cat2label
=
{
cat
:
self
.
classes
.
index
(
cat
)
for
cat
in
self
.
classes
}
self
.
label2cat
=
{
self
.
label2cat
=
{
label
:
self
.
classes
[
label
]
label
:
self
.
classes
[
label
]
for
label
in
len
(
self
.
classes
)
for
label
in
range
(
len
(
self
.
classes
)
)
}
}
assert
split
in
[
'train'
,
'val'
,
'test'
]
assert
split
in
[
'train'
,
'val'
,
'test'
]
split_dir
=
os
.
path
.
join
(
self
.
root_dir
,
'%s_data_idx.txt'
%
split
)
split_dir
=
os
.
path
.
join
(
self
.
root_dir
,
'%s_data_idx.txt'
%
split
)
...
@@ -100,7 +100,7 @@ class SUNRGBDObject(object):
...
@@ -100,7 +100,7 @@ class SUNRGBDObject(object):
def
get_label_objects
(
self
,
idx
):
def
get_label_objects
(
self
,
idx
):
label_filename
=
os
.
path
.
join
(
self
.
label_dir
,
'%06d.txt'
%
(
idx
))
label_filename
=
os
.
path
.
join
(
self
.
label_dir
,
'%06d.txt'
%
(
idx
))
lines
=
[
line
.
rstrip
()
for
line
in
open
(
label_filename
)]
lines
=
[
line
.
rstrip
()
for
line
in
open
(
label_filename
)]
objects
=
[
SUN
Object3d
(
line
)
for
line
in
lines
]
objects
=
[
SUN
RGBDInstance
(
line
)
for
line
in
lines
]
return
objects
return
objects
def
get_sunrgbd_infos
(
self
,
def
get_sunrgbd_infos
(
self
,
...
...
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