Skip to content

Instantly share code, notes, and snippets.

import torch
from torch.autograd import Variable
import tools.utils as utils
import tools.dataset as dataset
from PIL import Image
from collections import OrderedDict
import cv2
from models.moran import MORAN
model_path = '/home/ryan/Downloads/2000_0.8805.pth'
https://gist.github.com/DecentMakeover/23d9b84b698f7acf6ccb85ff201205d7
frames =5
video_folder = '/media/ryan/shakira/3d-cnn-action-recognition/some_folder'
for file in os.listdir(video_folder):
if file.endswith('.webm'):
os.mkdir(os.path.join(video_folder,file.split('.')[0]))
folder_name = file.split('.')[0]
os.system('ffmpeg -t 4 -i {} -vf fps={} {}/%05d.jpg -t 10'.format(os.path.join(video_folder,file), frames,os.path.join(video_folder,folder_name )))
elif file.endswith('.mp4'):
os.mkdir(os.path.join(video_folder,file.split('.')[0]))
folder_name = file.split('.')[0]
import torch.nn as nn
import torch
class Modified3DUNet(nn.Module):
def __init__(self, in_channels, n_classes, base_n_filter = 8):
super(Modified3DUNet, self).__init__()
self.in_channels = in_channels
self.n_classes = n_classes
self.base_n_filter = base_n_filter