From 692d8d98105dc2bfc697643917ca3e3bc1c96e67 Mon Sep 17 00:00:00 2001 From: Paul Liu Date: Sat, 9 Jul 2022 00:03:11 -0700 Subject: [PATCH 1/2] fix typo and minor bug --- utils/datasets.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/datasets.py b/utils/datasets.py index 886b992..af68152 100644 --- a/utils/datasets.py +++ b/utils/datasets.py @@ -58,11 +58,11 @@ def __init__(self, path, img_width, img_height, aug=False): else: self.data_list.append(data_path) else: - raise Exception("%s is not exist" % data_path) + raise Exception("%s does not exist" % data_path) def __getitem__(self, index): img_path = self.data_list[index] - label_path = img_path.split(".")[0] + ".txt" + label_path = '.'.join(img_path.split(".")[:-1]) + ".txt" # 加载图片 img = cv2.imread(img_path) @@ -80,7 +80,7 @@ def __getitem__(self, index): #assert (label >= 0).all(), 'negative labels: %s'%label_path #assert (label[:, 1:] <= 1).all(), 'non-normalized or out of bounds coordinate labels: %s'%label_path else: - raise Exception("%s is not exist" % label_path) + raise Exception("%s does not exist" % label_path) # 是否进行数据增强 if self.aug: From 85324c3c9b9493a851db4db4d154edac75e1d9c0 Mon Sep 17 00:00:00 2001 From: Paul Liu Date: Sat, 9 Jul 2022 00:41:56 -0700 Subject: [PATCH 2/2] Windows does not support semicolon in filename --- train.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/train.py b/train.py index 93271f1..dfc3279 100644 --- a/train.py +++ b/train.py @@ -124,7 +124,7 @@ def train(self): self.model.eval() print("computer mAP...") mAP05 = self.evaluation.compute_map(self.val_dataloader, self.model) - torch.save(self.model.state_dict(), "checkpoint/weight_AP05:%f_%d-epoch.pth"%(mAP05, epoch)) + torch.save(self.model.state_dict(), "checkpoint/weight_AP05_%f_%d-epoch.pth"%(mAP05, epoch)) # 学习率调整 self.scheduler.step()