diff --git a/src/twomartens/masterthesis/debug.py b/src/twomartens/masterthesis/debug.py index 2afd67f..ae5a2da 100644 --- a/src/twomartens/masterthesis/debug.py +++ b/src/twomartens/masterthesis/debug.py @@ -33,7 +33,7 @@ from twomartens.masterthesis import config from twomartens.masterthesis.ssd_keras.eval_utils import coco_utils -def save_ssd_train_images(images: np.ndarray, labels: np.ndarray, output_path: str) -> None: +def save_ssd_train_images(images: np.ndarray, labels: np.ndarray, output_path: str, custom_string: str = None) -> None: annotation_file_train = f"{config.get_property('Paths.coco')}/annotations/instances_train2014.json" _, _, _, classes_to_names = coco_utils.get_coco_category_maps(annotation_file_train) colors = pyplot.cm.hsv(np.linspace(0, 1, 81)).tolist() @@ -42,12 +42,13 @@ def save_ssd_train_images(images: np.ndarray, labels: np.ndarray, output_path: s nr_images = len(images) nr_digits = math.ceil(math.log10(nr_images)) image_size = config.get_property("Parameters.ssd_image_size") + custom_string = f"{custom_string}_" if custom_string is not None else "" for i, train_image in enumerate(images): instances = labels[i] image = Image.fromarray(train_image) image.save(f"{output_path}/" - f"train_image{str(i).zfill(nr_digits)}.png") + f"{custom_string}train_image{str(i).zfill(nr_digits)}.png") figure = pyplot.figure(figsize=(20, 12)) pyplot.imshow(image)