调试
This commit is contained in:
parent
a78ef10b8a
commit
9e5134628e
@ -249,7 +249,6 @@ def train_R0DY(params_str, id):
|
|||||||
params.read_from_str(params_str)
|
params.read_from_str(params_str)
|
||||||
print(params.get('device').default)
|
print(params.get('device').default)
|
||||||
data_list = file_tool.get_file(ori_path=params.get('DatasetDir').value, type_list=params.get('CLASS_NAMES').value)
|
data_list = file_tool.get_file(ori_path=params.get('DatasetDir').value, type_list=params.get('CLASS_NAMES').value)
|
||||||
print('---------------------',data_list)
|
|
||||||
weights = params.get('resumeModPath').value # 初始化模型绝对路径
|
weights = params.get('resumeModPath').value # 初始化模型绝对路径
|
||||||
img_size = params.get('img_size').value
|
img_size = params.get('img_size').value
|
||||||
savemodel = os.path.splitext(params.get('saveModDir').value)[0] + '_' + str(img_size) + '.pt' # 模型命名加上图像参数
|
savemodel = os.path.splitext(params.get('saveModDir').value)[0] + '_' + str(img_size) + '.pt' # 模型命名加上图像参数
|
||||||
|
@ -77,7 +77,6 @@ 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##############",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 = {}
|
||||||
@ -85,7 +84,6 @@ 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)
|
||||||
|
|
||||||
@ -306,7 +304,7 @@ def train(hyp, opt, device, data_list,id,callbacks): # hyp is path/to/hyp.yaml
|
|||||||
num_train_img=train_num,
|
num_train_img=train_num,
|
||||||
train_mod_savepath=best)
|
train_mod_savepath=best)
|
||||||
|
|
||||||
@algorithm_process_value_websocket()
|
# @algorithm_process_value_websocket()
|
||||||
def report_cellback(i, num_epochs, reportAccu):
|
def report_cellback(i, num_epochs, reportAccu):
|
||||||
report.rate_of_progess = ((i + 1) / num_epochs) * 100
|
report.rate_of_progess = ((i + 1) / num_epochs) * 100
|
||||||
report.progress = (i + 1)
|
report.progress = (i + 1)
|
||||||
|
@ -428,13 +428,11 @@ class LoadImagesAndLabels(Dataset):
|
|||||||
|
|
||||||
# Check cache
|
# Check cache
|
||||||
self.label_files = img2label_paths(self.im_files) # labels
|
self.label_files = img2label_paths(self.im_files) # labels
|
||||||
print('labelfile############',self.label_files)
|
|
||||||
cache_path = (p if p.is_file() else Path(self.label_files[0]).parent).with_suffix('.cache')
|
cache_path = (p if p.is_file() else Path(self.label_files[0]).parent).with_suffix('.cache')
|
||||||
try:
|
try:
|
||||||
cache, exists = np.load(cache_path, allow_pickle=True).item(), True # load dict
|
cache, exists = np.load(cache_path, allow_pickle=True).item(), True # load dict
|
||||||
assert cache['version'] == self.cache_version # matches current version
|
assert cache['version'] == self.cache_version # matches current version
|
||||||
assert cache['hash'] == get_hash(self.label_files + self.im_files) # identical hash
|
assert cache['hash'] == get_hash(self.label_files + self.im_files) # identical has
|
||||||
print('load_cache#########')
|
|
||||||
except Exception:
|
except Exception:
|
||||||
cache, exists = self.cache_labels(cache_path, prefix), False # run cache ops
|
cache, exists = self.cache_labels(cache_path, prefix), False # run cache ops
|
||||||
|
|
||||||
@ -449,7 +447,6 @@ class LoadImagesAndLabels(Dataset):
|
|||||||
|
|
||||||
# Read cache
|
# Read cache
|
||||||
[cache.pop(k) for k in ('hash', 'version', 'msgs')] # remove items
|
[cache.pop(k) for k in ('hash', 'version', 'msgs')] # remove items
|
||||||
print('@@@@@@@@@@@@@@@@@@@@@')
|
|
||||||
labels, shapes, self.segments = zip(*cache.values())
|
labels, shapes, self.segments = zip(*cache.values())
|
||||||
nl = len(np.concatenate(labels, 0)) # number of labels
|
nl = len(np.concatenate(labels, 0)) # number of labels
|
||||||
assert nl > 0 or not augment, f'{prefix}All labels empty in {cache_path}, can not start training. {HELP_URL}'
|
assert nl > 0 or not augment, f'{prefix}All labels empty in {cache_path}, can not start training. {HELP_URL}'
|
||||||
|
Loading…
Reference in New Issue
Block a user