コード例 #1
0
ファイル: mapping.py プロジェクト: wzmsltw/unsup_temp_embed
label, from which I got rid of during training. To simplify everything I just
won't use 0 as index for this (YTI) dataset.
-1 - background index
"""

__author__ = 'Anna Kukleva'
__date__ = 'September 2018'

import os

from ute.utils.util_functions import dir_check
from ute.utils.arg_pars import opt
import data_utils.FS_utils.update_argpars as fs_utils

actions = ['-1.', '-2.']
fs_utils.update()
dir_check(opt.gt)

label2idx = {}
idx2label = {}

videos = {}

for filename in os.listdir(opt.gt):
    with open(os.path.join(opt.gt, filename), 'r') as f:
        for line in f:
            line = line.strip()
            if label2idx.get(line, -1) == -1:
                idx = len(idx2label)
                label2idx[line] = idx
                idx2label[idx] = line
コード例 #2
0
if __name__ == '__main__':

    # set root
    opt.dataset_root = '/sequoia/data1/akukleva/projects/unsup_temp_embed/fs'

    opt.subaction = 'rgb'
    # set feature extension and dimensionality
    opt.ext = 'txt'
    opt.feature_dim = 64

    # model name can be 'mlp' or 'nothing' for no embedding (just raw features)
    opt.model_name = 'mlp'

    # load an already trained model (stored in the models directory in dataset_root)
    opt.load_model = False

    # use background noise (e.g. for YTI)
    opt.bg = False
    # granularity level eval or high
    opt.gr_lev = 'eval'

    # update log name and absolute paths
    update()

    # run temporal embedding
    if opt.subaction == 'all':
        actions = ['rgb']
        all_actions(actions)
    else:
        temp_embed()