This commit is contained in:
2023-08-24 11:36:22 +00:00
parent 59f67a2495
commit afd482522d
36 changed files with 2194 additions and 291 deletions
+29 -2
View File
@@ -1,9 +1,11 @@
import os
import sys
import pickle
import numpy as np
from torch.utils.data import DataLoader
from stl import mesh as mesh_stl
from pathlib import Path
from data.utils import Frame
class Accumulator():
@@ -59,4 +61,29 @@ def save_stl(file, mesh, faces):
for j in range(3):
obj.vectors[i][j] = mesh[f[j],:]
obj.save(file)
obj.save(file)
def create_temp_frames(folder: str, frame: Frame):
with open(Path(folder) / 'frames_temp.txt', 'w') as f:
f.writelines([f'{frame}\n' for _ in range(4)])
def pickle_load(file):
"""
Load a pickle file.
"""
with open(file, 'rb') as f:
loadout = pickle.load(f)
return loadout
def pickle_dump(loadout, file):
"""
Dump a pickle file. Create the directory if it does not exist.
"""
os.makedirs(os.path.dirname(str(file)), exist_ok=True)
with open(file, 'wb') as f:
pickle.dump(loadout, f)