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
yaoyuping
nnDetection
Commits
34e8cfc7
Commit
34e8cfc7
authored
Apr 27, 2022
by
Kapsner
Browse files
refactor: enhancing detection of yaml files
parent
87bbe588
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
0 deletions
+4
-0
nndet/utils/config.py
nndet/utils/config.py
+4
-0
No files found.
nndet/utils/config.py
View file @
34e8cfc7
...
...
@@ -39,11 +39,15 @@ def load_dataset_info(task_dir: Pathlike) -> dict:
"""
task_dir
=
Path
(
task_dir
)
yaml_path
=
task_dir
/
"dataset.yaml"
yaml_path_fallback
=
task_dir
/
"dataset.yml"
json_path
=
task_dir
/
"dataset.json"
if
yaml_path
.
is_file
():
with
open
(
yaml_path
,
'r'
)
as
f
:
data
=
yaml
.
full_load
(
f
)
elif
yaml_path_fallback
.
is_file
():
with
open
(
yaml_path_fallback
,
'r'
)
as
f
:
data
=
yaml
.
full_load
(
f
)
elif
json_path
.
is_file
():
with
open
(
json_path
,
"r"
)
as
f
:
data
=
json
.
load
(
f
)
...
...
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