From 9f24c12c14c137873df4b31b9d5f6b5856d40604 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 10 Dec 2019 18:25:14 -0800 Subject: [PATCH] updates --- utils/parse_config.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/utils/parse_config.py b/utils/parse_config.py index 8ecf6441..5d3c20fb 100644 --- a/utils/parse_config.py +++ b/utils/parse_config.py @@ -7,7 +7,7 @@ def parse_model_cfg(path): # Parse the yolo *.cfg file and return module definitions path may be 'cfg/yolov3.cfg', 'yolov3.cfg', or 'yolov3' if not path.endswith('.cfg'): # add .cfg suffix if omitted path += '.cfg' - if not os.path.exists(path) and not path.startswith('cfg' + os.sep): # add cfg/ prefix if omitted + if not os.path.exists(path) and os.path.exists('cfg' + os.sep + path): # add cfg/ prefix if omitted path = 'cfg' + os.sep + path with open(path, 'r') as f: @@ -46,10 +46,13 @@ def parse_model_cfg(path): def parse_data_cfg(path): # Parses the data configuration file - options = dict() - with open(path, 'r') as fp: - lines = fp.readlines() + if not os.path.exists(path) and os.path.exists('data' + os.sep + path): # add data/ prefix if omitted + path = 'data' + os.sep + path + with open(path, 'r') as f: + lines = f.readlines() + + options = dict() for line in lines: line = line.strip() if line == '' or line.startswith('#'):