From cf37aeb11a56e9b38ccecf656c48cc6653f42acb Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Fri, 10 Mar 2023 17:11:10 +0000 Subject: [PATCH] dlr: truncate jsonl before we start to avoid mixing things up --- aimodel/src/deeplabv3_plus_test_rainfall.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/aimodel/src/deeplabv3_plus_test_rainfall.py b/aimodel/src/deeplabv3_plus_test_rainfall.py index a5333ea..114f857 100755 --- a/aimodel/src/deeplabv3_plus_test_rainfall.py +++ b/aimodel/src/deeplabv3_plus_test_rainfall.py @@ -9,6 +9,7 @@ from lib.ai.helpers.summarywriter import summarywriter from lib.ai.components.CallbackCustomModelCheckpoint import CallbackCustomModelCheckpoint import os +import io import math import cv2 import numpy as np @@ -312,6 +313,9 @@ def save_samples(filepath, save_list): handle.close() def plot_predictions(filepath, input_items, colormap, model): + filepath_jsonl = filepath.replace("_$$", "").replace(".png", ".jsonl") + os.truncate(filepath_jsonl, 0) + i = 0 for input_pair in input_items: prediction_mask = infer(image_tensor=input_pair[0], model=model) @@ -334,7 +338,7 @@ def plot_predictions(filepath, input_items, colormap, model): ) save_samples( - filepath.replace("_$$", "").replace(".png", ".jsonl"), + filepath_jsonl, prediction_mask ) i += 1