elif dataset.upper().startswith('KTH'): from lib.dataloaders.kth_dataset import Video_Dataset_small_clip else: raise ('Unknown Dataset') dataset_frames = os.path.abspath( os.path.join(root_path, dataset_cfg.dataset.dataset_frames_folder)) boxes_file = os.path.abspath( os.path.join(root_path, dataset_cfg.dataset.boxes_file)) split_txt_path = os.path.abspath( os.path.join(root_path, dataset_cfg.dataset.split_txt_path)) ### get videos id actions = dataset_cfg.dataset.classes cls2idx = {actions[i]: i for i in range(0, len(actions))} vid2idx, vid_names = get_vid_dict(dataset_frames) # # get mean # mean = [112.07945832, 112.87372333, 106.90993363] # ucf-101 24 classes mean = [0.5, 0.5, 0.5] std = [0.5, 0.5, 0.5] spatial_transform = Compose([ Scale(sample_size), # [Resize(sample_size), ToTensor(), Normalize(mean, std) ]) temporal_transform = LoopPadding(sample_duration) n_classes = len(actions)
mean = [112.07945832, 112.87372333, 106.90993363] # ucf-101 24 classes # generate model actions = [ '__background__', 'Basketball', 'BasketballDunk', 'Biking', 'CliffDiving', 'CricketBowling', 'Diving', 'Fencing', 'FloorGymnastics', 'GolfSwing', 'HorseRiding', 'IceDancing', 'LongJump', 'PoleVault', 'RopeClimbing', 'SalsaSpin', 'SkateBoarding', 'Skiing', 'Skijet', 'SoccerJuggling', 'Surfing', 'TennisSwing', 'TrampolineJumping', 'VolleyballSpiking', 'WalkingWithDog' ] cls2idx = {actions[i]: i for i in range(0, len(actions))} ### get videos id vid2idx, vid_names = get_vid_dict(dataset_folder) spatial_transform = Compose([ Scale(sample_size), # [Resize(sample_size), ToTensor(), Normalize(mean, [1, 1, 1]) ]) temporal_transform = LoopPadding(sample_duration) n_classes = len(actions) ########################################## # Model Initialization # ########################################## model = Model(actions, sample_duration, sample_size)