Reduced references

Signed-off-by: Jim Martens <github@2martens.de>
This commit is contained in:
2019-05-01 11:59:12 +02:00
parent 54cacfd45d
commit 2120ac8eec

View File

@ -190,9 +190,11 @@ def _predict_one_epoch(dataset: tf.data.Dataset,
for _ in range(forward_passes_per_image): for _ in range(forward_passes_per_image):
result = np.array(ssd(inputs)) result = np.array(ssd(inputs))
decoded_predictions_batch.append(result) decoded_predictions_batch.append(result)
del result
else: else:
result = np.array(ssd(inputs)) result = np.array(ssd(inputs))
decoded_predictions_batch.append(result) decoded_predictions_batch.append(result)
del result
# save predictions batch-wise to prevent memory problems # save predictions batch-wise to prevent memory problems
if nr_digits is not None: if nr_digits is not None:
@ -203,6 +205,7 @@ def _predict_one_epoch(dataset: tf.data.Dataset,
with open(filename, 'wb') as file: with open(filename, 'wb') as file:
decoded_predictions_batch_np = np.array(decoded_predictions_batch) 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) np.save(file, decoded_predictions_batch_np, allow_pickle=False, fix_imports=False)
counter += 1 counter += 1