This commit is contained in:
2021-09-27 16:02:11 -04:00
parent 90edf9bd45
commit e18232df84
35 changed files with 3037 additions and 78 deletions

25
generate_matrix_sets.py Normal file
View File

@@ -0,0 +1,25 @@
vpath = '/srv/ftp/railing/2021/09/04/Railing_00_20210904070617.mp4'
stack_path = os.path.splitext(vpath)[0]
import cv2
import numpy
import torch
cap = cv2.VideoCapture(vpath)
frame_num = 0
step_frame = 5
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
# %%
images = list()
stack_num = 0
for frame_num in range(0, total_frames, step_frame):
img = cap.read()[1].copy()
images.append(img)
if len(images) == 16:
stack_num +=1
break
# %%
imgs = np.moveaxis(np.stack(images), 3, 1)
bt = torch.FloatTensor(imgs)
tensor_path = f'{stack_path}.{stack_num:03}.pt'