Merge branch 'master' of https://gitea.star-rising.cn/xkrs_manan/RODY
This commit is contained in:
commit
728523b2e5
@ -387,7 +387,7 @@ def returnTrainParams():
|
||||
{"index": 2, "name": "img_size", "value": 640, "description": '训练图像大小', "default": 640, "type": "I",
|
||||
'show': True},
|
||||
{"index": 3, "name": "device", "value": f'{_kernel[0]}', "description": '训练核心', "default": f'{_kernel[0]}', "type": "E",
|
||||
"items": _kernel, 'show': True}, # _kernel
|
||||
"items": _kernel, 'show': False}, # _kernel
|
||||
{"index": 4, "name": "saveModDir", "value": "E:/alg_demo-master/alg_demo/app/yolov5/best.pt",
|
||||
"description": '保存模型路径',
|
||||
"default": "./app/maskrcnn/saved_model/test.pt", "type": "S", 'show': False},
|
||||
|
@ -107,6 +107,8 @@ def mv_file(train_files: List[str], test_files: List[str], r_v_rate: Optional[fl
|
||||
train_len = ceil(train_len_all * r_v_rate)
|
||||
# t_files: 训练集, val_files:验证集
|
||||
t_files = train_img_files[0:train_len]
|
||||
if train_len==train_len_all:
|
||||
train_len = 0
|
||||
val_files = train_img_files[train_len:train_len_all]
|
||||
|
||||
# 判断目标文件夹是否存在, 存在则删除目录下文件
|
||||
@ -179,18 +181,15 @@ def get_file(ori_path: str, type_list: Union[object,str]):
|
||||
test_files = []
|
||||
# 训练、测试比例强制9:1
|
||||
for img in imgs[0:1]:
|
||||
path = ori_path + '/images/' +img #'/images/'
|
||||
# print(os.path.exists(path))
|
||||
path = ori_path + '/images/' +img #'./ori/images/xxx.jpg'
|
||||
print('图像路径',path)
|
||||
if os.path.exists(path):
|
||||
test_files.append(path)
|
||||
print('1111')
|
||||
#label = ori_path + 'labels/' + os.path.split(path)[1]
|
||||
(filename1, extension) = os.path.splitext(img) # 文件名与后缀名分开
|
||||
label = ori_path + '/labels/' + filename1 + '.json' #'/labels/'
|
||||
print('标签',label)
|
||||
if label is not None:
|
||||
#train_files.append(label)
|
||||
test_files.append(label)
|
||||
print('2222')
|
||||
for img in imgs[1:]:
|
||||
@ -209,10 +208,6 @@ def get_file(ori_path: str, type_list: Union[object,str]):
|
||||
# proj = plc.get_proj_by_proj_no(proj_no=proj_no, db=db)
|
||||
target_path = mv_file(train_files=train_files, test_files=test_files)
|
||||
# 生成标签
|
||||
# img_types = ilc.get_label_by_proj_no(proj_no=proj_no, db=db)
|
||||
# type_list = []
|
||||
# for img_type in img_types:
|
||||
# type_list.append(img_type.lebel_type)
|
||||
type_dict = {'classes': type_list}
|
||||
str_json = json.dumps(type_dict)
|
||||
path = os.path.dirname(ori_path) + '/img_label_type'
|
||||
|
@ -326,6 +326,8 @@ def train(hyp, opt, device, data_list,id,callbacks): # hyp is path/to/hyp.yaml
|
||||
report.progress = (i + 1)
|
||||
report.end_time = datetime.now()
|
||||
report.precision[0].value.append(reportAccu)
|
||||
if (i+1) == num_epochs:
|
||||
report.isfinish = 2
|
||||
return report.dict()
|
||||
###################结束#######################
|
||||
for epoch in range(start_epoch, epochs): # epoch ------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user