Beispiel #1
0
                        '--positive_labels',
                        default='ESLMV',
                        help='Labels in CC_WEB_VIDEO datasets that '
                        'considered posetive. default=\'ESLMV\'')
    args = vars(parser.parse_args())

    print 'loading data...'
    cc_dataset = pk.load(open('datasets/cc_web_video.pickle', 'rb'))
    cc_features = np.load(args['evaluation_set'])

    model = DNN(cc_features.shape[1],
                None,
                args['model_path'],
                load_model=True,
                trainable=False)
    cc_embeddings = model.embeddings(cc_features)
    print 'Evaluation set file: ', args['evaluation_set']
    print 'Path to DML model: ', args['model_path']
    print 'Positive labels: ', args['positive_labels']

    print '\nEvaluation Results'
    print '=================='
    similarities = calculate_similarities(cc_dataset['queries'], cc_embeddings)
    mAP, pr_curve = evaluate(cc_dataset['ground_truth'],
                             similarities,
                             positive_labels=args['positive_labels'],
                             all_videos=False)
    print 'CC_WEB_VIDEO mAP: ', mAP
    plot_pr_curve(pr_curve, 'CC_WEB_VIDEO')

    mAP, pr_curve = evaluate(cc_dataset['ground_truth'],
Beispiel #2
0
    args = vars(parser.parse_args())

    print('Loading data...')
    cc_dataset = pk.load(open('datasets/cc_web_video.pickle', 'rb'))
    cc_features = load_features(args['evaluation_set'])

    print('Loading model...')
    model = DNN(cc_features.shape[1],
                args['model_path'],
                load_model=True,
                trainable=False)

    if args['fusion'].lower() == 'early':
        print('Fusion type: Early')
        print('Extract video embeddings...')
        cc_embeddings = model.embeddings(cc_features)
    else:
        print('Fusion type: Late')
        print('Extract video embeddings...')

        assert args['evaluation_features'] is not None, \
            'Argument \'--evaluation_features\' must be provided for Late fusion'
        feature_files = load_feature_files(args['evaluation_features'])

        cc_embeddings = np.zeros(
            (len(cc_dataset['index']), model.embedding_dim))
        for i, video_id in enumerate(tqdm(cc_dataset['index'])):
            if video_id in feature_files:
                features = load_features(feature_files[video_id])
                embeddings = model.embeddings(normalize(features))
                embeddings = embeddings.mean(0, keepdims=True)