#mse = [] #ssim = [] ############################################################################ ## Load the model ofmodel = loadOpticalFlowModel(opticalflow_ckpt_file) ofSample = torch.FloatTensor(2, FRA, numOfPixels) # set test list name: testFolderFile = 'testlist01.txt' # set test data directory: rootDir = '/data/Abhishek/frames/' # for UCF dataset: testFoldeList = getListOfFolders(testFolderFile)[::10] ## if Kitti: use folderList instead of testFoldeList ## folderList = [name for name in os.listdir(rootDir) if os.path.isdir(os.path.join(rootDir))] ## folderList.sort() flowDir = '/home/abhishek/Workspace/UCF_Flows/Flows_ByName/' for numfo,folder in enumerate(testFoldeList): print("Started testing for - "+ folder) if not os.path.exists(os.path.join("Results", str(10*numfo+1))): os.makedirs(os.path.join("Results", str(10*numfo+1))) frames = [each for each in os.listdir(os.path.join(rootDir, folder)) if each.endswith(('.jpeg'))] frames.sort()
trained_encoder = '../preTrainedModel/UCFModel.pth' # for Kitti Dataset: 'KittiModel.pth' # pick up training # trained_encoder = checkptname checkptname = "DYAN-ResNet50-RGB" ckpt_file = './DYAN-ResNet50-RGB60.pth' ## Load input data # set train list name: trainFolderFile = 'trainlist01.txt' # set training data directory: rootDir = '/data/Abhishek/frames/' # RGB # rootDir = '/storage/truppr/UCF-FLOWS-FULL' # PGOF trainFoldeList = getListOfFolders(trainFolderFile)[::5] trainingData = videoDatasetRawFrames(folderList=trainFoldeList, rootDir=rootDir, N_FRAME=N_FRAME) # for raw RGB frames # trainingData = videoDatasetPreGenOF(folderList=trainFoldeList, rootDir=rootDir, N_FRAME=N_FRAME) # for pre-generated OF dataloader = DataLoader(trainingData, batch_size=BATCH_SIZE, shuffle=True, num_workers=1) ## Initializing r, theta stateDict = torch.load(trained_encoder)['state_dict'] Dtheta = stateDict['l1.theta'] Drr = stateDict['l1.rr']