From 22b05aec763c922438600fa1a89009ad25007cad Mon Sep 17 00:00:00 2001 From: Till Raab Date: Mon, 4 Dec 2023 08:52:26 +0100 Subject: [PATCH] corrected labels that are checked are now exported to the train dataset via copy instead of moving them. --- correct_bboxes.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/correct_bboxes.py b/correct_bboxes.py index 5c67890..6f1f3f4 100644 --- a/correct_bboxes.py +++ b/correct_bboxes.py @@ -3,6 +3,7 @@ import sys from PyQt5.QtWidgets import * from PyQt5.QtCore import * import pyqtgraph as pg +import shutil from PIL import Image, ImageOps import numpy as np @@ -242,15 +243,18 @@ class Bbox_correct_UI(QMainWindow): target_image_path = pathlib.Path(export_path) / 'images' / export_image_path.name target_label_path = pathlib.Path(export_path) / 'labels' / export_label_path.name if not target_image_path.exists(): - os.rename(export_image_path, target_image_path) - os.rename(export_label_path, target_label_path) + # ToDo: this is not tested but should work + # os.rename(export_image_path, target_image_path) + shutil.copy(export_image_path, target_image_path) + # os.rename(export_label_path, target_label_path) + shutil.copy(export_label_path, target_label_path) else: keep_idxs.append(export_idx) # self.file_dict.loc[self.file_dict['name'] == self.highlighted_label.text()].index.values[0] drop_idxs = list(set(export_idxs) - set(keep_idxs)) - self.file_dict = self.file_dict.drop(drop_idxs) + # self.file_dict = self.file_dict.drop(drop_idxs) self.save_file_dict() self.close_without_saving_rois = True self.close()