Пример #1
0
def pred_loop():
    # evalu_model, x_ = eval_model.build()

    global pred_file_name

    evalu_model, x_ = eval_model.build()

    while True:
        # print "waiting"
        # s_time = time.time()
        print "pred_loop waiting"

        vid, cur_fr,n,fileName = q.get()
        # print "waited",(time.time()-s_time)/1000.,"ms"
        pred_file_name = fileName.split('/')
        pred_file_name = pred_file_name[-1].replace(".zip","_prediction.csv")
        # print "get"
        # print vid.shape, cur_fr
        x_.set_value(vid.astype("float32"),borrow=True)
        pred = evalu_model()[0][0]
        pred_p = pred.max()
        pred_idx = pred.argmax()+1
        # fps = int(1./((time.time()-time_start)/step))
        fr_start = cur_fr+step-n_f
        fr_end = cur_fr+step
        # print pred_idx,"\t", "\t",pred_p,"\t",fr_start, "-",fr_end,"\t",fps,'fps'
        predict(pred_idx,pred_p,fr_start)
        # print v_new.shape
        # for i in xrange(v_new.shape[0]):
        #     for j in xrange(v_new.shape[1]):
        #         for k in xrange(v_new.shape[2]):
        #             play_vid(v_new[i,j,k],wait=0)
        # cur_fr += step
        # print cur_fr, int(1./((time.time()-time_start)/step)),'fps'
        if cur_fr+2*step>=n:
            reinit()
Пример #2
0
# data = "/media/Data/mp/chalearn2014/40x90x90_train"
# data = "/home/lio/mp/chalearn2014/train_raw"
# data = "/home/lio/mp/chalearn2014/valid"
# dst = "/home/lio/Dropbox/MP/chalearn2014/evaluation/results/test"

data = "E:/mp/chalearn2014/train_raw"
dst = "C:/Users/lio/Dropbox/MP/chalearn2014/evaluation/results/test"

pp.make_sure_path_exists(dst)
step = 5
n_f = 32
pred_file_name = ''
h = vid_shape[-1]
# q = Queue(10)
# q2 = Queue(20)
evalu_model, x_ = eval_model.build()

# def eval(fileName):
# @profile
def eval():
    global pred_file_name

    # pred_file_name = fileName.split('/')
    # pred_file_name = pred_file_name[-1].replace(".zip","_prediction.csv")

    # print fileName

    files = glob(data+"/"+"*.zip")
    files.sort()

    print len(files), "found"