From 27c7b02ffffc4cacdbd6cf4c257ca17d9353228a Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Sat, 16 May 2020 11:51:49 -0700 Subject: [PATCH] --save-txt extension fix --- detect.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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