diff --git a/detect.py b/detect.py index d655e63d..46d6de76 100644 --- a/detect.py +++ b/detect.py @@ -124,7 +124,7 @@ def detect(save_img=False): for *xyxy, conf, cls in det: if save_txt: # Write to file xywh = (xyxy2xywh(torch.tensor(xyxy).view(1, 4)) / gn).view(-1).tolist() # normalized xywh - with open(save_path + '.txt', 'a') as file: + with open(save_path[:save_path.rfind('.')] + '.txt', 'a') as file: file.write(('%g ' * 5 + '\n') % (cls, *xywh)) # label format if save_img or view_img: # Add bbox to image