def evaluate_performance(params): name, original_path, label_path = params y_true = [] y_pred = [] video_segmentizer = Segmentizer(352, 288) data_loader = LASIESTADataLoader(original_path, label_path) for i, (original_frame, label_frame) in enumerate(data_loader): predicted_background = video_segmentizer.fit_and_predict(original_frame) label_frame = label_frame.tolist() label_frame = [[background_map_conversion(rgb) for rgb in row] for row in label_frame] y_true += list(chain.from_iterable(label_frame)) y_pred += list(chain.from_iterable(predicted_background)) y_pred, y_true = remove_uncertain_pixels(y_pred, y_true) score = f1_score(y_true, y_pred) print('Finished evaluation of dataset ' + name) return name, score
from segmentizer import Segmentizer from segmentizer.data_loader import LASIESTADataLoader import time data_loader = LASIESTADataLoader('/Users/dsoellinger/Downloads/I_SI_01') video_segmentizer = Segmentizer(352, 288) start = time.time() for i, frame in enumerate(data_loader): if i == 10: break print("Frame: " + str(i + 1)) video_segmentizer.fit_and_predict(frame) end = time.time() print("Elapsed time: " + str(end - start))