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
OpenPCDet
Commits
0db30f45
Commit
0db30f45
authored
May 13, 2023
by
chenshi3
Browse files
Adjust the hook function and nuscenes_dataset.py
parent
ed2bb815
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
60 additions
and
55 deletions
+60
-55
pcdet/datasets/augmentor/data_augmentor.py
pcdet/datasets/augmentor/data_augmentor.py
+1
-1
pcdet/datasets/nuscenes/nuscenes_dataset.py
pcdet/datasets/nuscenes/nuscenes_dataset.py
+58
-53
tools/train_utils/train_utils.py
tools/train_utils/train_utils.py
+1
-1
No files found.
pcdet/datasets/augmentor/data_augmentor.py
View file @
0db30f45
...
...
@@ -24,7 +24,7 @@ class DataAugmentor(object):
cur_augmentor
=
getattr
(
self
,
cur_cfg
.
NAME
)(
config
=
cur_cfg
)
self
.
data_augmentor_queue
.
append
(
cur_augmentor
)
def
disable
A
ugmentation
(
self
,
augmentor_configs
):
def
disable
_a
ugmentation
(
self
,
augmentor_configs
):
self
.
data_augmentor_queue
=
[]
aug_config_list
=
augmentor_configs
if
isinstance
(
augmentor_configs
,
list
)
\
else
augmentor_configs
.
AUG_CONFIG_LIST
...
...
pcdet/datasets/nuscenes/nuscenes_dataset.py
View file @
0db30f45
...
...
@@ -152,36 +152,7 @@ class NuScenesDataset(DatasetTemplate):
input_dict
[
'camera_imgs'
]
=
crop_images
return
input_dict
def
__len__
(
self
):
if
self
.
_merge_all_iters_to_one_epoch
:
return
len
(
self
.
infos
)
*
self
.
total_epochs
return
len
(
self
.
infos
)
def
__getitem__
(
self
,
index
):
if
self
.
_merge_all_iters_to_one_epoch
:
index
=
index
%
len
(
self
.
infos
)
info
=
copy
.
deepcopy
(
self
.
infos
[
index
])
points
=
self
.
get_lidar_with_sweeps
(
index
,
max_sweeps
=
self
.
dataset_cfg
.
MAX_SWEEPS
)
input_dict
=
{
'points'
:
points
,
'frame_id'
:
Path
(
info
[
'lidar_path'
]).
stem
,
'metadata'
:
{
'token'
:
info
[
'token'
]}
}
if
'gt_boxes'
in
info
:
if
self
.
dataset_cfg
.
get
(
'FILTER_MIN_POINTS_IN_GT'
,
False
):
mask
=
(
info
[
'num_lidar_pts'
]
>
self
.
dataset_cfg
.
FILTER_MIN_POINTS_IN_GT
-
1
)
else
:
mask
=
None
input_dict
.
update
({
'gt_names'
:
info
[
'gt_names'
]
if
mask
is
None
else
info
[
'gt_names'
][
mask
],
'gt_boxes'
:
info
[
'gt_boxes'
]
if
mask
is
None
else
info
[
'gt_boxes'
][
mask
]
})
if
self
.
use_camera
:
def
load_camera_info
(
self
,
input_dict
,
info
):
input_dict
[
"image_paths"
]
=
[]
input_dict
[
"lidar2camera"
]
=
[]
input_dict
[
"lidar2image"
]
=
[]
...
...
@@ -236,6 +207,40 @@ class NuScenesDataset(DatasetTemplate):
# resize and crop image
input_dict
=
self
.
crop_image
(
input_dict
)
return
input_dict
def
__len__
(
self
):
if
self
.
_merge_all_iters_to_one_epoch
:
return
len
(
self
.
infos
)
*
self
.
total_epochs
return
len
(
self
.
infos
)
def
__getitem__
(
self
,
index
):
if
self
.
_merge_all_iters_to_one_epoch
:
index
=
index
%
len
(
self
.
infos
)
info
=
copy
.
deepcopy
(
self
.
infos
[
index
])
points
=
self
.
get_lidar_with_sweeps
(
index
,
max_sweeps
=
self
.
dataset_cfg
.
MAX_SWEEPS
)
input_dict
=
{
'points'
:
points
,
'frame_id'
:
Path
(
info
[
'lidar_path'
]).
stem
,
'metadata'
:
{
'token'
:
info
[
'token'
]}
}
if
'gt_boxes'
in
info
:
if
self
.
dataset_cfg
.
get
(
'FILTER_MIN_POINTS_IN_GT'
,
False
):
mask
=
(
info
[
'num_lidar_pts'
]
>
self
.
dataset_cfg
.
FILTER_MIN_POINTS_IN_GT
-
1
)
else
:
mask
=
None
input_dict
.
update
({
'gt_names'
:
info
[
'gt_names'
]
if
mask
is
None
else
info
[
'gt_names'
][
mask
],
'gt_boxes'
:
info
[
'gt_boxes'
]
if
mask
is
None
else
info
[
'gt_boxes'
][
mask
]
})
if
self
.
use_camera
:
input_dict
=
self
.
load_camera_info
(
input_dict
,
info
)
data_dict
=
self
.
prepare_data
(
data_dict
=
input_dict
)
if
self
.
dataset_cfg
.
get
(
'SET_NAN_VELOCITY_TO_ZEROS'
,
False
)
and
'gt_boxes'
in
info
:
...
...
tools/train_utils/train_utils.py
View file @
0db30f45
...
...
@@ -267,6 +267,6 @@ def disable_augmentation_hook(hook_config, dataloader, total_epochs, cur_epoch,
dataset_cfg
=
cfg
.
DATA_CONFIG
logger
.
info
(
f
'Disable augmentations:
{
DISABLE_AUG_LIST
}
'
)
dataset_cfg
.
DATA_AUGMENTOR
.
DISABLE_AUG_LIST
=
DISABLE_AUG_LIST
dataloader
.
_dataset
.
data_augmentor
.
disable
A
ugmentation
(
dataset_cfg
.
DATA_AUGMENTOR
)
dataloader
.
_dataset
.
data_augmentor
.
disable
_a
ugmentation
(
dataset_cfg
.
DATA_AUGMENTOR
)
flag
=
True
return
flag
\ 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