--save-txt extension fix
This commit is contained in:
parent
3a71daf4bc
commit
27c7b02fff
|
@ -124,7 +124,7 @@ def detect(save_img=False):
|
||||||
for *xyxy, conf, cls in det:
|
for *xyxy, conf, cls in det:
|
||||||
if save_txt: # Write to file
|
if save_txt: # Write to file
|
||||||
xywh = (xyxy2xywh(torch.tensor(xyxy).view(1, 4)) / gn).view(-1).tolist() # normalized xywh
|
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
|
file.write(('%g ' * 5 + '\n') % (cls, *xywh)) # label format
|
||||||
|
|
||||||
if save_img or view_img: # Add bbox to image
|
if save_img or view_img: # Add bbox to image
|
||||||
|
|
Loading…
Reference in New Issue