diff --git a/darknet_images.py b/darknet_images.py index 0f1fca9b7ae..17ac91731a7 100644 --- a/darknet_images.py +++ b/darknet_images.py @@ -162,7 +162,7 @@ def save_annotations(name, image, detections, class_names): """ Files saved with image_name.txt and relative coordinates """ - file_name = name.split(".")[:-1][0] + ".txt" + file_name = os.path.splitext(name)[0] + ".txt" with open(file_name, "w") as f: for label, confidence, bbox in detections: x, y, w, h = convert2relative(image, bbox)