print_params(params) 
    ####################################################################
    ####################################################################
    print "\n%s\n\t epoch %d \n%s"%('-'*30, epoch, '-'*30)
    ####################################################################
    ####################################################################
    time_start = time()
    for i in range(loader.n_iter_train):     
        #load data
        time_start_iter = time()
        loader.next_train_batch(x_, y_, x_skeleton_)
        tr.batch_size = y_.get_value(borrow=True).shape[0]
        ce.append(_batch(train_model, tr.batch_size, batch, True, apply_updates))
       
        timing_report(i, time()-time_start_iter, tr.batch_size, res_dir)
        print "\t| "+ training_report(ce[-1]) + ", finish total of: 0." + str(i*1.0/loader.n_iter_train)
    # End of Epoch
    ####################################################################
    ####################################################################
    print "\n%s\n\t End of epoch %d, \n printing some debug info.\n%s" \
        %('-'*30, epoch, '-'*30)
    ####################################################################
    ####################################################################
    # print insp_
    train_ce.append(_avg(ce))
    # validate
    valid_ce.append(test_lio_skel(use, test_model, batch, drop, tr.rng, epoch, tr.batch_size, x_, y_, loader, x_skeleton_))

    # save best params
    # if valid_ce[-1][1] < 0.25:
    res_dir = save_results(train_ce, valid_ce, res_dir, params=params)
    print "\n%s\n\t epoch %d \n%s" % ('-' * 30, epoch, '-' * 30)
    ####################################################################
    ####################################################################
    time_start = time()
    for i in range(loader.n_iter_train):
        #load data
        time_start_iter = time()
        loader.next_train_batch(x_, y_, x_skeleton_)
        print('tr.batch_size_before=%d' % tr.batch_size)
        tr.batch_size = y_.get_value(borrow=True).shape[0]
        print('tr.batch_size_after=%d' % tr.batch_size)
        ce.append(
            _batch(train_model, tr.batch_size, batch, True, apply_updates)[0])
        print "the %d iteration,time used:%d" % (i, time() - time_start_iter)
        #timing_report(i, time()-time_start_iter, tr.batch_size, res_dir)
        print "\t| " + training_report(ce[-1]) + ", finish total of: 0." + str(
            i * 1.0 / loader.n_iter_train)
    # End of Epoch
    ####################################################################
    ####################################################################
    print "\n%s\n\t End of epoch %d, \n printing some debug info.\n%s" \
        %('-'*30, epoch, '-'*30)
    ####################################################################
    ####################################################################
    # print insp_
    train_ce.append(_avg(ce))
    # validate
    valid_ce.append(
        test_lio_skel(use, test_model, batch, drop, tr.rng, epoch,
                      tr.batch_size, x_, y_, loader, x_skeleton_))
    out_std_train = []
    print_params(net_convnet3d_grbm_early_fusion.params) 
    ####################################################################
    print "\n%s\n\t epoch %d \n%s"%('-'*30, epoch, '-'*30)
    time_start = time()
    for i in range(loader.n_iter_train):     
        #load data
        time_start_iter = time()
        loader.next_train_batch(x_, y_, x_skeleton_)
        ce_temp, out_mean_temp, out_std_temp = _batch(train_model, tr.batch_size, batch, True, apply_updates)
        ce.append(ce_temp)
        out_mean_train.append(out_mean_temp)
        out_std_train.append(out_std_temp)

        print "Training: No.%d iter of Total %d, %d s"% (i,loader.n_iter_train, time()-time_start_iter)  \
                + "\t| negative_log_likelihood "+ training_report(ce[-1]) 
    # End of Epoch
    ####################################################################
    print "\n%s\n\t End of epoch %d, \n printing some debug info.\n%s" \
        %('-'*30, epoch, '-'*30)

    train_ce.append(_avg(ce))
    out_mean_all.append(_avg(out_mean_train))
    out_std_all.append(_avg(out_std_train))
    # validate
    valid_ce.append(test_lio_skel(use, test_model, batch, drop, tr.rng, epoch, tr.batch_size, x_, y_, loader, x_skeleton_))

    # save best params
    res_dir = save_results(train_ce, valid_ce, res_dir, params=net_convnet3d_grbm_early_fusion.params, out_mean_train=out_mean_all,out_std_train=out_std_all)
    if not tr.moved: res_dir = move_results(res_dir)
Exemple #4
0
    ####################################################################
    time_start = time()
    print loader.n_iter_train
    for i in range(loader.n_iter_train):     
        #load data
        time_start_iter = time()
        loader.next_train_batch(x_, y_, x_skeleton_)
        #tr.batch_size = y_.get_value(borrow=True).shape[0]
        ce_temp, out_mean_temp, out_std_temp = _batch(train_model, tr.batch_size, batch, True, apply_updates)
	#print out_mean_train, out_std_train
        ce.append(ce_temp)
        out_mean_train.append(out_mean_temp)
        out_std_train.append(out_std_temp)

        print "Training: No.%d iter of Total %d, %d s"% (i,loader.n_iter_train, time()-time_start_iter)  \
                + "\t| negative_log_likelihood "+ training_report(ce[-1]) 
    # End of Epoch
    ####################################################################
    ####################################################################
    print "\n%s\n\t End of epoch %d, \n printing some debug info.\n%s" \
        %('-'*30, epoch, '-'*30)
    ####################################################################
    ####################################################################
    print ce
    train_ce.append(_avg(ce))
    out_mean_all.append(_avg(out_mean_train))
    out_std_all.append(_avg(out_std_train))
    # validate
    valid_ce.append(test_lio_skel(use, test_model, batch, drop, tr.rng, epoch, tr.batch_size, x_, y_, loader, x_skeleton_))

    # save best params
    ####################################################################
    print "\n%s\n\t epoch %d \n%s"%('-'*30, epoch, '-'*30)
    ####################################################################
    ####################################################################
    for i in range(loader.n_iter_train):
        time_start = time()
        #load
        # load_data(train_file, tr.rng, epoch, tr.batch_size, x_, y_)
        loader.next_train_batch(x_, y_)
        # print "loading time", time()-time_start
        # train
        tr.batch_size = y_.get_value(borrow=True).shape[0]
        ce.append(_batch(train_model, tr.batch_size, batch, True, apply_updates))
       
        if epoch==0: timing_report(i, time()-time_start, tr.batch_size, res_dir)
        print "\t| "+ training_report(ce[-1])
    # End of Epoch
    #-------------------------------
    ####################################################################
    ####################################################################
    print "\n%s\n\t End of epoch %d, \n printing some debug info.\n%s" \
        %('-'*30, epoch, '-'*30)
    ####################################################################
    ####################################################################
    # print insp_
    train_ce.append(_avg(ce))
    # validate
    valid_ce.append(test_lio(file_info.valid, use, test_model, batch, drop, tr.rng, epoch, tr.batch_size, x_, y_,loader))

    # save best params
    # if valid_ce[-1][1] < 0.25: