Example #1
0
def pred_loop():
    evalu_model, x_ = eval_model.build(cpu)

    global pred_file_name

    while True:

        vid, cur_fr, n, fileName = q.get()
        # pred_file_name = fileName.split('/')
        # # pred_file_name = pred_file_name[-1].replace(".zip","_prediction.csv")
        # pred_file_name = pred_file_name[-1].replace(".zip","")[-4:]
        x_.set_value(vid.astype("float32"), borrow=True)
        pred = evalu_model()[0][0]
        pred_p = pred.max()
        pred_idx = pred.argmax() + 1
        fr_start = cur_fr + step - n_f
        fr_end = cur_fr + step
        predict(pred_idx, pred_p, fr_start)
        if cur_fr + 2 * step >= n:
            reinit()
Example #2
0
def pred_loop():
    evalu_model, x_ = eval_model.build(cpu)

    global pred_file_name

    while True:

        vid, cur_fr, n, fileName = q.get()
        # pred_file_name = fileName.split('/')
        # # pred_file_name = pred_file_name[-1].replace(".zip","_prediction.csv")
        # pred_file_name = pred_file_name[-1].replace(".zip","")[-4:]
        x_.set_value(vid.astype("float32"), borrow=True)
        pred = evalu_model()[0][0]
        pred_p = pred.max()
        pred_idx = pred.argmax() + 1
        fr_start = cur_fr + step - n_f
        fr_end = cur_fr + step
        predict(pred_idx, pred_p, fr_start)
        if cur_fr + 2 * step >= n:
            reinit()
Example #3
0
def pred_loop():
    evalu_model, x_ = eval_model.build(cpu)

    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()
Example #4
0
def pred_loop():
    evalu_model, x_ = eval_model.build(cpu)

    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()
Example #5
0
            predictions.append(pred)

            cur_fr += step

        predictions = array(predictions,float32)
        pred_file_name = fileName.split('/')
        pred_file_name = pred_file_name[-1].replace(".zip","_prediction.zip")
        file = GzipFile(dst+"/"+pred_file_name, 'wb')
        dump(predictions, file, -1)
        file.close()

        # print cur_fr, int(1./((time.time()-time_start)/step)),'fps'
    #reinit()

# @profile
evalu_model, x_ = eval_model.build(cpu)
def pred_loop(vid, cur_fr,n,fileName):

    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")
Example #6
0
            cur_fr += step

        predictions = array(predictions, float32)
        pred_file_name = fileName.split('/')
        pred_file_name = pred_file_name[-1].replace(".zip", "_prediction.zip")
        file = GzipFile(dst + "/" + pred_file_name, 'wb')
        dump(predictions, file, -1)
        file.close()

        # print cur_fr, int(1./((time.time()-time_start)/step)),'fps'
    #reinit()


# @profile
evalu_model, x_ = eval_model.build(cpu)


def pred_loop(vid, cur_fr, n, fileName):

    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"