# import datasets.MSRII import numpy as np DATA_LIST = ['UCF-Sports', 'JHMDB', 'UCF101', 'MSRII'] MOD_LIST = ['RGB', 'FLOW'] LEN_LIST = ['1', '5', '10'] SPLIT_LIST = ['0', '1', '2'] for dataset in DATA_LIST: for mod in MOD_LIST: for lens in LEN_LIST: for split in SPLIT_LIST: name = '{}_{}_{}_split_{}'.format(dataset, mod, lens, split) image_set = name if dataset is 'UCF-Sports': __sets[name] = (lambda split=image_set, phase='TRAIN': ucfsports(split, phase)) elif dataset is 'JHMDB': __sets[name] = (lambda split=image_set, phase='TRAIN': JHMDB(split, phase)) elif dataset is 'UCF101': __sets[name] = (lambda split=image_set, phase='TRAIN': UCF101(split, phase)) # elif dataset is 'MSRII': # __sets[name] = (lambda split=split, datapath='/home/lear/xpeng/data/MSR_II/pweinzaeMSR2/frames': #frames #features/fat2/motion_cnn_proposals/jpeg0 # datasets.MSRII(split, datapath)) def get_imdb(name): """Get an imdb (image database) by name.""" if not __sets.has_key(name): raise KeyError('Unknown dataset: {}'.format(name))
if __name__ == '__main__': args = parse_args() if not os.path.isfile(args.net): raise IOError(('{:s} not found.').format(args.net)) cfg.TEST.HAS_RPN = True cfg.TEST.SCALES = [600] MOD = args.imdb.split('_')[1] LEN = int(args.imdb.split('_')[2]) if MOD == 'FLOW' and LEN == 1: cfg.PIXEL_MEANS = np.array([[[128., 128., 128.]]]) if MOD == 'FLOW' and LEN == 5: cfg.PIXEL_MEANS = np.array([[[128., 128., 128.] * 5]]) ucfsports_test = ucfsports(args.imdb, 'TEST') roidb = ucfsports_test.roidb if not os.path.exists(args.savepath): if args.cpu_mode: caffe.set_mode_cpu() else: caffe.set_mode_gpu() caffe.set_device(args.gpu_id) caffe_net = caffe.Net(args.proto, args.net, caffe.TEST) pred_all_dets = {} n_fr = len(ucfsports_test.image_index) for i in range(n_fr): image_name = ucfsports_test.image_index[i] image_path = os.path.join(ucfsports_test._data_path, image_name)