(imgs, size, video_path, fps=30)
| 33 | return imgs, fps |
| 34 | |
| 35 | def save_video(imgs, size, video_path, fps=30): |
| 36 | fourcc = cv2.VideoWriter_fourcc(*'XVID') |
| 37 | out = cv2.VideoWriter(video_path, fourcc, fps, size) |
| 38 | for frame in imgs: |
| 39 | out.write(frame) |
| 40 | out.release() |
| 41 | print('video saved') |
| 42 | |
| 43 | def coords_grid(batch, ht, wd): |
| 44 | coords = torch.meshgrid(torch.arange(ht), torch.arange(wd)) |