Commit ceb87c6c authored by Gilberto Astolfi's avatar Gilberto Astolfi
Browse files

adicionando obj.data para yolo

parent 08eb314b
......@@ -68,9 +68,18 @@ class YoloUtils:
f.write(text_out)
f.close()
def createFilesYolo(self, repositorio):
def createObjectData(self, obj_data_file, txt_object_data):
f = open(obj_data_file, 'w')
f.write(txt_object_data)
f.close()
def createFilesYolo(self, repositorio, backup_weight_yolo):
for fold in os.listdir(repositorio):
fold_src = repositorio + '/' + fold
path_train = ''
path_valid = ''
path_names = ''
num_classes = 0
for set_ in os.listdir(fold_src):
if set_ != 'test':
path_pbtxt = fold_src + '/' + set_+'/' + fold +'_'+set_+'.pbtxt'
......@@ -81,6 +90,19 @@ class YoloUtils:
path_yolo_txt = fold_src + '/' + set_+'/' + fold +'_'+set_+'.txt'
self.createFileSetYolo(path_set, path_yolo_txt)
if set_ != 'train':
path_train = path_yolo_txt
num_classes = len(dictClasses)
else:
path_valid = path_yolo_txt
obj_data_file = fold_src + '/obj.data'
txt_object_data = 'classes = ' + str(num_classes) + '\n'
txt_object_data += 'train = ' + path_train + '\n'
txt_object_data += 'valid = ' + path_valid + '\n'
txt_object_data += 'backup = ' + backup_weight_yolo
self.createObjectData(obj_data_file, txt_object_data)
def searchSourceFile(self,path_search, file_img):
for cl in os.listdir(path_search):
path_cl = path_search + '/' + cl
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment