Пример #1
0
	caffe.set_device(gpu)
	caffe.set_mode_gpu()

"""
for t in train_val_lst:
	print t
list_of_strings_to_txt_file(opj(model_path,'train_val.prototxt'),train_val_lst)
"""

if TEST:
	write_solver(model_path,base_lr=0.0,snapshot=100000000)
	test_solver_inputs_dic,test_keys = get_solver_inputs_dic_ks(test_runs_folder)
	median_errors = []
	if True:
		if len(gg(opjD(fname(model_path),'*.caffemodel'))) > 0:
			test_caffe_net = Caffe_Net(opj(model_path,'solver.prototxt'),version,weights_file_mode,weights_file_path,restore_solver=False)
			e = test(test_caffe_net,test_solver_inputs_dic,test_keys,version,model_path,test_time_limit)
			median_errors.append(e)
			figure('TEST ' + model_path + 'median errors',figsize=(2,2))
			plot(median_errors)
			plt.pause(0.0001)
		else:
			cprint("Can't test because no .caffemodel files",'red')
		print 'waiting . . .'
		time.sleep(60)

if TRAIN:
	write_solver(model_path,base_lr=base_lr,snapshot=snapshot)
	solver_inputs_dic,keys = get_solver_inputs_dic_ks(runs_folder,to_require=to_require,to_ignore=to_ignore)
	caffe_net = Caffe_Net(opj(model_path,'solver.prototxt'),version,weights_file_mode,weights_file_path,restore_solver=restore_solver)
	while True:
Пример #2
0
time.sleep(5)

import caffe

USE_GPU = True
if USE_GPU:
    caffe.set_device(0)
    caffe.set_mode_gpu()
from kzpy3.caf6.Caffe_Net import *

solver_file_path = opjh("kzpy3/caf6/z2_color_3_step/solver.prototxt")
version = 'version 2'
weights_file_mode = 'most recent'  #None #'this one'  #None #'most recent'
#weights_file_path = '/home/karlzipser/Desktop/z2_color_continue_training_of_12_19_2016/z2_color_iter_11700000.caffemodel' # None #opjD('z2_color')
weights_file_path = '/home/karlzipser/Desktop/z2_color_3_step'  # None #opjD('z2_color')
caffe_net = Caffe_Net(solver_file_path, version, weights_file_mode,
                      weights_file_path, False)

timer = Timer(30 * 60)

if True:
    while True:
        if timer.check():
            timer.reset()
            wait_delay = 60
            cprint(
                d2s('Waiting', wait_delay,
                    'seconds to let data thread load a lot of data.'))
            time.sleep(wait_delay)
        try:
            #print 'here 2'
            data = data_list[-1]