def __init__(self, folder): self.frames_list = list_paths(folder) self.ind = 0 self.done = False self.first = True self.sequence_list = []
def detectFromFolder(folder): paths = list_paths(folder) images, locations, new_paths = detectFromPaths(paths) return images, locations, new_paths
def load_stadiums(): print("Loading stadiums.") p = os.path.join(ROOT_DIR, 'metadata/data/places/stadiums') pys = [e for e in list_paths(p) if e.endswith('.py')] l = [] # What is this? for py in pys: if not py.startswith('_'): #tail = py.replace('/home/chris/www/', '').replace('.py', '').replace('/', '.') tail = py.replace(ROOT_DIR, '').replace('.py', '').replace('/', '.') if tail.startswith('.'): tail = tail[1:] l.extend(import_path(tail).l) regions = [e for e in os.listdir(p) if '.' not in e] final = [] # Do this in normalize? for e in l: d = stadium_defaults.copy() d.update(e) final.append(d) return final
async def index(request): stages = {} global imports for (key, module) in imports.items(): setup = getattr(module, 'setup') module_pys = get_import_files(setup['path']) stages[key] = list_paths(module_pys) return json({'success': True, 'data': stages})
async def stage_index(request, stage_name): lessons = {} global imports, module_pys if stage_name in imports: setup = getattr(imports[stage_name], 'setup') lessons = list_paths(module_imports[stage_name]) return json({'success': True, 'data': lessons}) else: return json({'fail': True, 'error': 'No such stage.'})
def test(self): with torch.no_grad(): self.g_model.eval() test_videos = list_paths(c.TEST_DIR) psnr_all_videos = [] for vid in test_videos: # test videos seperately vid_name = vid.split('/')[-1] video_loader = Loader(folder=vid) psnr_mean = self.process_video(video_loader) print('{:15s} - PSNR: {:5.2f}'.format(vid_name, psnr_mean)) psnr_all_videos.append(psnr_mean) psnr_videos_mean = np.mean(psnr_all_videos) print('{:15s} - PSNR: {:5.2f}'.format('AVERAGE', psnr_videos_mean)) print('\nPredicted frames are saved at {}'.format(c.IMG_SAVE_DIR))