Video-Summary/Application/Importer.py

25 lines
678 B
Python
Raw Normal View History

2020-10-16 08:36:52 +00:00
import pickle
2022-09-11 09:25:36 +00:00
import os.path
2022-01-09 19:25:44 +00:00
2020-10-16 08:36:52 +00:00
class Importer:
def __init__(self, config):
2022-10-07 21:10:26 +00:00
self.path = config["cachePath"]
2020-10-16 08:36:52 +00:00
2022-09-11 09:25:36 +00:00
def import_raw_data(self):
2020-11-08 15:28:47 +00:00
print("Loading previous results")
2022-09-11 09:25:36 +00:00
2022-10-07 21:10:26 +00:00
layers = self.load_if_present(self.path + "_layers.txt")
contours = self.load_if_present(self.path + "_contours.txt")
masks = self.load_if_present(self.path + "_masks.txt")
2022-09-11 09:25:36 +00:00
return layers, contours, masks
def load_if_present(self, path):
var = None
if os.path.isfile(path):
with open(path, "rb") as file:
var = pickle.load(file)
else:
print(path, "file not found")
return var