This commit is contained in:
Glenn Jocher 2019-12-10 18:25:14 -08:00
parent bb1a87d77f
commit 9f24c12c14
1 changed files with 7 additions and 4 deletions

View File

@ -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' # 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 if not path.endswith('.cfg'): # add .cfg suffix if omitted
path += '.cfg' 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 path = 'cfg' + os.sep + path
with open(path, 'r') as f: with open(path, 'r') as f:
@ -46,10 +46,13 @@ def parse_model_cfg(path):
def parse_data_cfg(path): def parse_data_cfg(path):
# Parses the data configuration file # Parses the data configuration file
options = dict() if not os.path.exists(path) and os.path.exists('data' + os.sep + path): # add data/ prefix if omitted
with open(path, 'r') as fp: path = 'data' + os.sep + path
lines = fp.readlines()
with open(path, 'r') as f:
lines = f.readlines()
options = dict()
for line in lines: for line in lines:
line = line.strip() line = line.strip()
if line == '' or line.startswith('#'): if line == '' or line.startswith('#'):