This commit is contained in:
552068321@qq.com 2022-11-07 20:55:55 +08:00
parent 48efd8b7af
commit 735c7c514d

View File

@ -54,7 +54,6 @@ from app.yolov5.utils.general import (LOGGER, check_amp, check_dataset, check_fi
init_seeds, intersect_dicts, labels_to_class_weights, labels_to_image_weights, methods, init_seeds, intersect_dicts, labels_to_class_weights, labels_to_image_weights, methods,
one_cycle, print_args, print_mutation, strip_optimizer, yaml_save) one_cycle, print_args, print_mutation, strip_optimizer, yaml_save)
from app.yolov5.utils.loggers import Loggers from app.yolov5.utils.loggers import Loggers
#from yolov5.utils.loggers.wandb.wandb_utils import check_wandb_resume
from app.yolov5.utils.loss import ComputeLoss from app.yolov5.utils.loss import ComputeLoss
from app.yolov5.utils.metrics import fitness from app.yolov5.utils.metrics import fitness
from app.yolov5.utils.plots import plot_evolve from app.yolov5.utils.plots import plot_evolve
@ -78,7 +77,7 @@ def yaml_rewrite(file='data.yaml',data_list=[]):
f.close() f.close()
classes = class_dict["classes"] classes = class_dict["classes"]
nc, names = (len(classes), classes) nc, names = (len(classes), classes)
#print(names) print("names##############",names)
coco_dict['train'] = data_list[0] coco_dict['train'] = data_list[0]
coco_dict['val'] = data_list[1] coco_dict['val'] = data_list[1]
label_name = {} label_name = {}
@ -86,6 +85,7 @@ def yaml_rewrite(file='data.yaml',data_list=[]):
label_name[i] = names[i] label_name[i] = names[i]
#print(label_name) #print(label_name)
coco_dict['names'] = label_name coco_dict['names'] = label_name
print('coco_names################:',coco_dict['names'])
with open(file, 'w') as f: with open(file, 'w') as f:
yaml.safe_dump(coco_dict, f, sort_keys=False) yaml.safe_dump(coco_dict, f, sort_keys=False)