From 2120ac8eec41e7a4386e70e14fe340456ec820a5 Mon Sep 17 00:00:00 2001 From: Jim Martens Date: Wed, 1 May 2019 11:59:12 +0200 Subject: [PATCH] Reduced references Signed-off-by: Jim Martens --- src/twomartens/masterthesis/ssd.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/twomartens/masterthesis/ssd.py b/src/twomartens/masterthesis/ssd.py index 4ff2042..90f975c 100644 --- a/src/twomartens/masterthesis/ssd.py +++ b/src/twomartens/masterthesis/ssd.py @@ -190,9 +190,11 @@ def _predict_one_epoch(dataset: tf.data.Dataset, for _ in range(forward_passes_per_image): result = np.array(ssd(inputs)) decoded_predictions_batch.append(result) + del result else: result = np.array(ssd(inputs)) decoded_predictions_batch.append(result) + del result # save predictions batch-wise to prevent memory problems if nr_digits is not None: @@ -203,6 +205,7 @@ def _predict_one_epoch(dataset: tf.data.Dataset, with open(filename, 'wb') as file: decoded_predictions_batch_np = np.array(decoded_predictions_batch) + del decoded_predictions_batch np.save(file, decoded_predictions_batch_np, allow_pickle=False, fix_imports=False) counter += 1