defparse_model_config(path):"""Parses the yolo-v3 layer configuration file and returns module definitions"""file=open(path,'r')lines=file.read().split('\n')lines=[xforxinlinesifxandnotx.startswith('#')]lines=[x.rstrip().lstrip()forxinlines]# get rid of fringe whitespacesmodule_defs=[]forlineinlines:ifline.startswith('['):# This marks the start of a new blockmodule_defs.append({})module_defs[-1]['type']=line[1:-1].rstrip()ifmodule_defs[-1]['type']=='convolutional':module_defs[-1]['batch_normalize']=0else:key,value=line.split("=")value=value.strip()module_defs[-1][key.rstrip()]=value.strip()returnmodule_defsdefparse_data_config(path):"""Parses the data configuration file"""options=dict()options['gpus']='0,1,2,3'options['num_workers']='10'withopen(path,'r')asfp:lines=fp.readlines()forlineinlines:line=line.strip()ifline==''orline.startswith('#'):continuekey,value=line.split('=')options[key.strip()]=value.strip()returnoptions