Ejemplo n.º 1
0
        Ds.append(Di)
        Ys.append(Yi)

    D = Ds[0]
    Y = Ys[0]
    for i,Di in enumerate(Ds[1:]):
        D = np.vstack( (D,Di) )
        Y = np.concatenate( (Y,Ys[i+1]) )

    print D.shape
    print Y.shape

    print "accuracy per fold is outputted"
    print "there is a lot of data here, this will take hours"
    ab_svm.kfoldcv_svm(D,Y,10,cores=1,innerCores=8,useLibLinear=True,useL1R=False)

    #res=ab_svm.SVMLinear(Dtrain,np.int32(Ytrain),Dtest)
    #tp=np.sum(res==Ytest)
    #print 'Accuracy is %.1f%%' % ((np.float64(tp)/Dtest.shape[0])*100)
    #









Ejemplo n.º 2
0
    pool.join()

    if args.onlyfeaturize:
        sys.exit(0)        

    # Step 2: Compute Action Bank Embedding of the Videos

    # Load the bank itself
    AB = ActionBank(args.bank)

    if (args.bankfactor != 1):
        AB.factor = args.bankfactor

    # Apply the bank
    #   do not do it asynchronously, as the individual bank elements are done that way
    for fi,f in enumerate(files):
        print "\b\b\b\b\b  %02d%%" % (100*fi/len(files))
        bank_and_save(AB,f,f.replace(args.input,args.output),args.cores)

    if not args.testsvm:
        sys.exit(0)

    # Step 3:  Try a k-fold cross-validation classification with an SVM in the simple set-up data set case.
    import ab_svm
    (D,Y) = ab_svm.load_simpleone(args.output)
    ab_svm.kfoldcv_svm(D,Y,10,cores=args.cores)


    # Nothing else to do here