diff --git a/src/twomartens/masterthesis/cli.py b/src/twomartens/masterthesis/cli.py index 30c7e1a..ff01f95 100644 --- a/src/twomartens/masterthesis/cli.py +++ b/src/twomartens/masterthesis/cli.py @@ -174,7 +174,7 @@ def _train_execute_action(args: argparse.Namespace, on_ssd: callable) -> None: def _ssd_train(args: argparse.Namespace) -> None: from twomartens.masterthesis import data - from twomartens.masterthesis import debug + from twomartens.masterthesis import plotting from twomartens.masterthesis import ssd from twomartens.masterthesis.ssd_keras.eval_utils import coco_utils @@ -205,7 +205,7 @@ def _ssd_train(args: argparse.Namespace) -> None: predictor_sizes) _ssd_debug_save_images(args, conf_obj, paths, - debug.save_ssd_train_images, coco_utils.get_coco_category_maps, + plotting.save_ssd_train_images, coco_utils.get_coco_category_maps, generators.train_debug_generator) nr_batches_train = _get_nr_batches(generators.train_length, conf_obj.parameters.batch_size) @@ -299,7 +299,7 @@ def _ssd_evaluate_entropy_loop(conf_obj: conf.Config, paths: AttributeDict, entropy_thresholds: Sequence[float], labels: Sequence[Sequence], filenames: Sequence[str]) -> None: - from twomartens.masterthesis import debug + from twomartens.masterthesis import plotting from twomartens.masterthesis import evaluate from twomartens.masterthesis.ssd_keras.bounding_box_utils import bounding_box_utils @@ -317,7 +317,7 @@ def _ssd_evaluate_entropy_loop(conf_obj: conf.Config, paths: AttributeDict, if conf_obj.parameters.ssd_use_entropy_threshold else f"{paths.predictions_file}.bin", predictions) _ssd_evaluate_save_images(filenames, predictions, - coco_utils.get_coco_category_maps, debug.save_ssd_train_images, + coco_utils.get_coco_category_maps, plotting.save_ssd_train_images, conf_obj, paths) predictions_per_class = evaluate.prepare_predictions(predictions, conf_obj.parameters.nr_classes) diff --git a/src/twomartens/masterthesis/debug.py b/src/twomartens/masterthesis/plotting.py similarity index 98% rename from src/twomartens/masterthesis/debug.py rename to src/twomartens/masterthesis/plotting.py index b9b6cf7..595ee82 100644 --- a/src/twomartens/masterthesis/debug.py +++ b/src/twomartens/masterthesis/plotting.py @@ -16,11 +16,13 @@ # limitations under the License. """ -Handle debug functionality. +Handle plotting functionality. Functions: save_ssd_train_images(...): saves the first batch of SSD train images with overlaid ground truth bounding boxes + draw_bbox_figure(...): + draws a bounding box figure and saves it under the image file name under the output path """ import functools import os diff --git a/src/twomartens/masterthesis/ssd.py b/src/twomartens/masterthesis/ssd.py index 4c4295f..461fa1b 100644 --- a/src/twomartens/masterthesis/ssd.py +++ b/src/twomartens/masterthesis/ssd.py @@ -40,7 +40,7 @@ import tensorflow as tf from attributedict.collections import AttributeDict from twomartens.masterthesis import config -from twomartens.masterthesis import debug +from twomartens.masterthesis import plotting from twomartens.masterthesis.ssd_keras.bounding_box_utils import bounding_box_utils from twomartens.masterthesis.ssd_keras.data_generator import object_detection_2d_misc_utils from twomartens.masterthesis.ssd_keras.eval_utils import coco_utils @@ -181,7 +181,7 @@ def predict(generator: callable, "vanilla_step": functools.partial(_predict_vanilla_step, model=model), "save_images": functools.partial( _predict_save_images, - save_images=debug.save_ssd_train_images, + save_images=plotting.save_ssd_train_images, get_coco_cat_maps_func=coco_utils.get_coco_category_maps, output_path=output_path, conf_obj=conf_obj