Exemplo n.º 1
0
    fullvideonames, videonames, class_labels, action_names, traintest_parts, opt_criterion = \
        get_dataset_info(xml_config['datasets_path'], args.dataset_name[0])  # build dataset-related variable

    tracklets_path, clusters_path, intermediates_path, feats_path, kernels_path = \
        create_main_directories(join(xml_config['data_path'], args.dataset_name[0]))

    ##########################
    ## Execution of methods ##
    ##########################

    # whatever is the method, these two are mandatory
    tracklet_extraction.extract_multithread(fullvideonames, videonames, xml_config['features_list'], tracklets_path, nt=args.nt, verbose=args.verbose)
    tracklet_clustering.cluster_multithread(tracklets_path, videonames, clusters_path, nt=args.nt, verbose=args.verbose)

    if 'atep-bovw' in args.methods:
        tracklet_representation.train_bovw_codebooks(tracklets_path, videonames, traintest_parts, xml_config['features_list'], intermediates_path, pca_reduction=True, nt=args.nt, verbose=args.verbose)
        tracklet_representation.compute_bovw_descriptors_multithread(tracklets_path, intermediates_path, videonames, traintest_parts, xml_config['features_list'], \
                                                                     feats_path + '/bovwtree/', \
                                                                     treelike=True, pca_reduction=True, clusters_path=clusters_path, nt=args.nt, verbose=args.verbose)

        atep_bovw = kernels.compute_ATEP_kernels(feats_path + '/bovwtree/', videonames, traintest_parts, xml_config['features_list'], \
                                                 kernels_path + '/atep-bovw/', kernel_type='intersection', norm='l1', power_norm=False, \
                                                 use_disk=False, nt=args.nt, verbose=args.verbose)

        params = [[[1]], [1], np.linspace(0,1,21), desc_weights_gbl]
        results = classification.classify(atep_bovw, \
                                          class_labels, traintest_parts, params, \
                                          xml_config['features_list'], \
                                          C=C_gbl,
                                          strategy=strategy_gbl,
                                          opt_criterion=opt_criterion,
Exemplo n.º 2
0
                                            xml_config['features_list'],
                                            tracklets_path,
                                            nt=args.nt,
                                            verbose=args.verbose)
    tracklet_clustering.cluster_multithread(tracklets_path,
                                            videonames,
                                            clusters_path,
                                            nt=args.nt,
                                            verbose=args.verbose)

    if 'atep-bovw' in args.methods:
        tracklet_representation.train_bovw_codebooks(
            tracklets_path,
            videonames,
            traintest_parts,
            xml_config['features_list'],
            intermediates_path,
            pca_reduction=True,
            nt=args.nt,
            verbose=args.verbose)
        tracklet_representation.compute_bovw_descriptors_multithread(tracklets_path, intermediates_path, videonames, traintest_parts, xml_config['features_list'], \
                                                                     feats_path + '/bovwtree/', \
                                                                     treelike=True, pca_reduction=True, clusters_path=clusters_path, nt=args.nt, verbose=args.verbose)

        atep_bovw = kernels.compute_ATEP_kernels(feats_path + '/bovwtree/', videonames, traintest_parts, xml_config['features_list'], \
                                                 kernels_path + '/atep-bovw/', kernel_type='intersection', norm='l1', power_norm=False, \
                                                 use_disk=False, nt=args.nt, verbose=args.verbose)

        params = [[[1]], [1], np.linspace(0, 1, 21), desc_weights_gbl]
        results = classification.classify(atep_bovw, \
                                          class_labels, traintest_parts, params, \
Exemplo n.º 3
0
    tracklet_extraction.extract(fullvideonames, videonames, INSTANCE_ST,
                                INSTANCE_TOTAL,
                                INTERNAL_PARAMETERS['feature_types'],
                                tracklets_path)
    tracklet_clustering.cluster(tracklets_path,
                                videonames,
                                INSTANCE_ST,
                                INSTANCE_TOTAL,
                                clusters_path,
                                visualize=False)

    tracklet_representation.train_bovw_codebooks(
        tracklets_path,
        videonames,
        traintest_parts,
        INTERNAL_PARAMETERS['feature_types'],
        intermediates_path,
        pca_reduction=False)
    tracklet_representation.train_fv_gmms(tracklets_path, videonames,
                                          traintest_parts,
                                          INTERNAL_PARAMETERS['feature_types'],
                                          intermediates_path)

    tracklet_representation.compute_bovw_descriptors(tracklets_path, intermediates_path, videonames, traintest_parts, \
                                                     INSTANCE_ST, INSTANCE_TOTAL, \
                                                     INTERNAL_PARAMETERS['feature_types'], feats_path + 'bovwtree/', \
                                                     pca_reduction=False, treelike=True, global_repr=True, clusters_path=clusters_path)
    tracklet_representation.compute_fv_descriptors(tracklets_path, intermediates_path, videonames, traintest_parts, \
                                                   INSTANCE_ST, INSTANCE_TOTAL, \
                                                   INTERNAL_PARAMETERS['feature_types'], feats_path + 'fvtree/', \
Exemplo n.º 4
0
        INSTANCE_TOTAL = len(videonames)
    elif len(sys.argv) < 4:
        INSTANCE_ST = int(sys.argv[1])
        if INSTANCE_ST > len(videonames) - 1:
            INSTANCE_ST = len(videonames) - 1

        INSTANCE_TOTAL = int(sys.argv[2])
        if INSTANCE_ST + int(sys.argv[2]) > len(videonames):
            INSTANCE_TOTAL = len(videonames) - INSTANCE_ST

    print('INSTANCE_ST: %d, INSTANCE_TOTAL: %d' % (INSTANCE_ST, INSTANCE_TOTAL))

    tracklet_extraction.extract(fullvideonames, videonames, INSTANCE_ST, INSTANCE_TOTAL, INTERNAL_PARAMETERS['feature_types'], tracklets_path)
    tracklet_clustering.cluster(tracklets_path, videonames, INSTANCE_ST, INSTANCE_TOTAL, clusters_path, visualize=False)

    tracklet_representation.train_bovw_codebooks(tracklets_path, videonames, traintest_parts, INTERNAL_PARAMETERS['feature_types'], intermediates_path, pca_reduction=False)
    tracklet_representation.train_fv_gmms(tracklets_path, videonames, traintest_parts, INTERNAL_PARAMETERS['feature_types'], intermediates_path)

    tracklet_representation.compute_bovw_descriptors(tracklets_path, intermediates_path, videonames, traintest_parts, \
                                                     INSTANCE_ST, INSTANCE_TOTAL, \
                                                     INTERNAL_PARAMETERS['feature_types'], feats_path + 'bovwtree/', \
                                                     pca_reduction=False, treelike=True, global_repr=True, clusters_path=clusters_path)
    tracklet_representation.compute_fv_descriptors(tracklets_path, intermediates_path, videonames, traintest_parts, \
                                                   INSTANCE_ST, INSTANCE_TOTAL, \
                                                   INTERNAL_PARAMETERS['feature_types'], feats_path + 'fvtree/', \
                                                   treelike=True, global_repr=True, clusters_path=clusters_path)

    c = [0.001, 0.01, 0.05, 0.1, 0.5, 1, 5, 10, 50, 100, 500, 1000, 5000, 10000]

    st_time = time.time()
    results = classification.classify(feats_path + 'bovwtree/', videonames, class_labels, traintest_parts, \