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
7b27d8e7
Unverified
Commit
7b27d8e7
authored
Dec 04, 2021
by
xiazhongyv
Committed by
GitHub
Dec 04, 2021
Browse files
Use yaml.safe_load instead of yaml.load (#694)
Co-authored-by:
xiazhongyu
<
xiazhongyu@pku.edu.cn
>
parent
3fa8b512
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
8 deletions
+8
-8
pcdet/config.py
pcdet/config.py
+4
-4
pcdet/datasets/kitti/kitti_dataset.py
pcdet/datasets/kitti/kitti_dataset.py
+1
-1
pcdet/datasets/nuscenes/nuscenes_dataset.py
pcdet/datasets/nuscenes/nuscenes_dataset.py
+1
-1
pcdet/datasets/waymo/waymo_dataset.py
pcdet/datasets/waymo/waymo_dataset.py
+2
-2
No files found.
pcdet/config.py
View file @
7b27d8e7
...
@@ -52,9 +52,9 @@ def merge_new_config(config, new_config):
...
@@ -52,9 +52,9 @@ def merge_new_config(config, new_config):
if
'_BASE_CONFIG_'
in
new_config
:
if
'_BASE_CONFIG_'
in
new_config
:
with
open
(
new_config
[
'_BASE_CONFIG_'
],
'r'
)
as
f
:
with
open
(
new_config
[
'_BASE_CONFIG_'
],
'r'
)
as
f
:
try
:
try
:
yaml_config
=
yaml
.
load
(
f
,
Loader
=
yaml
.
FullLoader
)
yaml_config
=
yaml
.
safe_
load
(
f
,
Loader
=
yaml
.
FullLoader
)
except
:
except
:
yaml_config
=
yaml
.
load
(
f
)
yaml_config
=
yaml
.
safe_
load
(
f
)
config
.
update
(
EasyDict
(
yaml_config
))
config
.
update
(
EasyDict
(
yaml_config
))
for
key
,
val
in
new_config
.
items
():
for
key
,
val
in
new_config
.
items
():
...
@@ -71,9 +71,9 @@ def merge_new_config(config, new_config):
...
@@ -71,9 +71,9 @@ def merge_new_config(config, new_config):
def
cfg_from_yaml_file
(
cfg_file
,
config
):
def
cfg_from_yaml_file
(
cfg_file
,
config
):
with
open
(
cfg_file
,
'r'
)
as
f
:
with
open
(
cfg_file
,
'r'
)
as
f
:
try
:
try
:
new_config
=
yaml
.
load
(
f
,
Loader
=
yaml
.
FullLoader
)
new_config
=
yaml
.
safe_
load
(
f
,
Loader
=
yaml
.
FullLoader
)
except
:
except
:
new_config
=
yaml
.
load
(
f
)
new_config
=
yaml
.
safe_
load
(
f
)
merge_new_config
(
config
=
config
,
new_config
=
new_config
)
merge_new_config
(
config
=
config
,
new_config
=
new_config
)
...
...
pcdet/datasets/kitti/kitti_dataset.py
View file @
7b27d8e7
...
@@ -473,7 +473,7 @@ if __name__ == '__main__':
...
@@ -473,7 +473,7 @@ if __name__ == '__main__':
import
yaml
import
yaml
from
pathlib
import
Path
from
pathlib
import
Path
from
easydict
import
EasyDict
from
easydict
import
EasyDict
dataset_cfg
=
EasyDict
(
yaml
.
load
(
open
(
sys
.
argv
[
2
])))
dataset_cfg
=
EasyDict
(
yaml
.
safe_
load
(
open
(
sys
.
argv
[
2
])))
ROOT_DIR
=
(
Path
(
__file__
).
resolve
().
parent
/
'../../../'
).
resolve
()
ROOT_DIR
=
(
Path
(
__file__
).
resolve
().
parent
/
'../../../'
).
resolve
()
create_kitti_infos
(
create_kitti_infos
(
dataset_cfg
=
dataset_cfg
,
dataset_cfg
=
dataset_cfg
,
...
...
pcdet/datasets/nuscenes/nuscenes_dataset.py
View file @
7b27d8e7
...
@@ -356,7 +356,7 @@ if __name__ == '__main__':
...
@@ -356,7 +356,7 @@ if __name__ == '__main__':
args
=
parser
.
parse_args
()
args
=
parser
.
parse_args
()
if
args
.
func
==
'create_nuscenes_infos'
:
if
args
.
func
==
'create_nuscenes_infos'
:
dataset_cfg
=
EasyDict
(
yaml
.
load
(
open
(
args
.
cfg_file
)))
dataset_cfg
=
EasyDict
(
yaml
.
safe_
load
(
open
(
args
.
cfg_file
)))
ROOT_DIR
=
(
Path
(
__file__
).
resolve
().
parent
/
'../../../'
).
resolve
()
ROOT_DIR
=
(
Path
(
__file__
).
resolve
().
parent
/
'../../../'
).
resolve
()
dataset_cfg
.
VERSION
=
args
.
version
dataset_cfg
.
VERSION
=
args
.
version
create_nuscenes_info
(
create_nuscenes_info
(
...
...
pcdet/datasets/waymo/waymo_dataset.py
View file @
7b27d8e7
...
@@ -458,9 +458,9 @@ if __name__ == '__main__':
...
@@ -458,9 +458,9 @@ if __name__ == '__main__':
import
yaml
import
yaml
from
easydict
import
EasyDict
from
easydict
import
EasyDict
try
:
try
:
yaml_config
=
yaml
.
load
(
open
(
args
.
cfg_file
),
Loader
=
yaml
.
FullLoader
)
yaml_config
=
yaml
.
safe_
load
(
open
(
args
.
cfg_file
),
Loader
=
yaml
.
FullLoader
)
except
:
except
:
yaml_config
=
yaml
.
load
(
open
(
args
.
cfg_file
))
yaml_config
=
yaml
.
safe_
load
(
open
(
args
.
cfg_file
))
dataset_cfg
=
EasyDict
(
yaml_config
)
dataset_cfg
=
EasyDict
(
yaml_config
)
ROOT_DIR
=
(
Path
(
__file__
).
resolve
().
parent
/
'../../../'
).
resolve
()
ROOT_DIR
=
(
Path
(
__file__
).
resolve
().
parent
/
'../../../'
).
resolve
()
dataset_cfg
.
PROCESSED_DATA_TAG
=
args
.
processed_data_tag
dataset_cfg
.
PROCESSED_DATA_TAG
=
args
.
processed_data_tag
...
...
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