From ee5d09adfeb9f96026e8275eb5ab2704b07731d7 Mon Sep 17 00:00:00 2001 From: "552068321@qq.com" Date: Tue, 8 Nov 2022 09:59:54 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controller/AlgorithmController.py | 6 +++--- app/file_tool.py | 4 ++-- app/yolov5/data/coco128.yaml | 4 ++-- app/yolov5/train_server.py | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controller/AlgorithmController.py b/app/controller/AlgorithmController.py index c86378c..3522a89 100644 --- a/app/controller/AlgorithmController.py +++ b/app/controller/AlgorithmController.py @@ -242,7 +242,7 @@ from app import file_tool # 启动训练 -@start_train_algorithm() +#@start_train_algorithm() def train_R0DY(params_str, id): from app.yolov5.train_server import train_start params = TrainParams() @@ -314,7 +314,7 @@ def train_R0DY(params_str, id): # zip_outputPath = os.path.join(exp_outputPath, "inference_model.zip") -@obtain_train_param() +#@obtain_train_param() def returnTrainParams(): # nvmlInit() # gpuDeviceCount = nvmlDeviceGetCount() # 获取Nvidia GPU块数 @@ -338,7 +338,7 @@ def returnTrainParams(): {"index": 7, "name": "CLASS_NAMES", "value": ['hole', '456'], "description": '类别名称', "default": '', "type": "L", "items": '', 'show': False}, - {"index": 8, "name": "DatasetDir", "value": "E:/aicheck/data_set/11442136178662604800/ori/", + {"index": 8, "name": "DatasetDir", "value": "E:/aicheck/data_set/11442136178662604800/ori", "description": '数据集路径', "default": "./app/maskrcnn/datasets/test", "type": "S", 'show': False} # ORI_PATH ] diff --git a/app/file_tool.py b/app/file_tool.py index 28178c4..c5a32d6 100644 --- a/app/file_tool.py +++ b/app/file_tool.py @@ -179,7 +179,7 @@ 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 + path = ori_path + '/images/' +img #'/images/' # print(os.path.exists(path)) print('图像路径',path) if os.path.exists(path): @@ -187,7 +187,7 @@ def get_file(ori_path: str, type_list: Union[object,str]): print('1111') #label = ori_path + 'labels/' + os.path.split(path)[1] (filename1, extension) = os.path.splitext(img) # 文件名与后缀名分开 - label = ori_path + '/labels/' + filename1 + '.json' + label = ori_path + '/labels/' + filename1 + '.json' #'/labels/' print('标签',label) if label is not None: #train_files.append(label) diff --git a/app/yolov5/data/coco128.yaml b/app/yolov5/data/coco128.yaml index 31e0cf5..473a868 100644 --- a/app/yolov5/data/coco128.yaml +++ b/app/yolov5/data/coco128.yaml @@ -3,5 +3,5 @@ train: E:/aicheck/data_set/11442136178662604800/trained/images/train/ val: E:/aicheck/data_set/11442136178662604800/trained/images/val/ test: null names: - 0: logo - 1: 3C + 0: hole + 1: '456' diff --git a/app/yolov5/train_server.py b/app/yolov5/train_server.py index 318a7f7..3cc1c56 100644 --- a/app/yolov5/train_server.py +++ b/app/yolov5/train_server.py @@ -304,7 +304,7 @@ def train(hyp, opt, device, data_list,id,callbacks): # hyp is path/to/hyp.yaml num_train_img=train_num, train_mod_savepath=best) - # @algorithm_process_value_websocket() + @algorithm_process_value_websocket() def report_cellback(i, num_epochs, reportAccu): report.rate_of_progess = ((i + 1) / num_epochs) * 100 report.progress = (i + 1) @@ -470,7 +470,7 @@ def train(hyp, opt, device, data_list,id,callbacks): # hyp is path/to/hyp.yaml print('##############',best) for f in best: print('##################',f) - if os.path.exists(f): + if os.path.exists(best): strip_optimizer(f) # strip optimizers if f is best: LOGGER.info(f'\nValidating {f}...')