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:
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]
import caffe USE_GPU = True gpu = 1 if USE_GPU: caffe.set_device(gpu) caffe.set_mode_gpu() from kzpy3.caf6.Caffe_Net import * solver_file_path = opjh("kzpy3/caf6/z2_color/solver_" + str(gpu) + "_a.prototxt") version = 'version 1b' 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' # None #opjD('z2_color') caffe_net = Caffe_Net(solver_file_path, version, weights_file_mode, weights_file_path, True) time.sleep(10) def load_data_into_model_thread(version, data_queue, solver_ready_queue, solver_waiting_queue): while True: try: if solver_ready_queue.qsize() < 150: #print "load_data_into_model_thread" if np.random.random() > 0.5: flip = False else: flip = True data = data_queue.get() solver = solver_waiting_queue.get()
pause(0.00001) for i in range(len(data['right'])): #mi(d['right'][i],'right') #pause(0.00000001) cv2.imshow('right', cv2.cvtColor(data['left'][i], cv2.COLOR_RGB2BGR)) if cv2.waitKey(dt) & 0xFF == ord('q'): pass import caffe from kzpy3.caf6.Caffe_Net import * solver_file_path = opjh("kzpy3/caf6/z2_color/solver.prototxt") version = 'version 1b' weights_file_mode = None weights_file_path = None caffe_net = Caffe_Net(solver_file_path, version, weights_file_mode, weights_file_path, False) if False: import h5py hdf5_filename = '/media/karlzipser/ExtraDrive1/solver_inputs.hdf5' solver_inputs = h5py.File(hdf5_filename, 'r') ks = solver_inputs.keys() while True: k = random.choice(ks) grp = solver_inputs[k] for i in range(12): mi(grp['ZED_data_pool2'][0, i, :, :], 1) print(grp['metadata'][:]) print(grp['steer_motor_target_data'][:]) pause(0.5) #grp['metadata']
plt.ylim(0, 1.0) plot([-1, 5, 1.5], [-1, 5, 1.5], 'r') plt_square() plt.title(time_str('Pretty')) plt.xlabel(solver_file_path) #solver_file_path = opjh("kzpy3/caf6/z2_color/solver_"+str(gpu)+"_a.prototxt") solver_file_path = opjh("kzpy3/caf6/z2_color_small/solver.prototxt") version = 'version 1b' weights_file_mode = 'most recent' #None #'this one' #None #'most recent' #'this one' #None #'most recent' weights_file_path = opjD( 'z2_color_small' ) #None #opjh('kzpy3/caf6/z2_color/z2_color.caffemodel') #None #'/home/karlzipser/Desktop/z2_color' # None #opjD('z2_color') caffe_net = Caffe_Net(solver_file_path, version, weights_file_mode, weights_file_path, True) runs_folder = '/media/karlzipser/ExtraDrive1/runs' run_names = sorted(gg(opj(runs_folder, '*.hdf5')), key=natural_keys) solver_inputs_dic = {} keys = {} k_ctr = 0 for hdf5_filename in run_names: try: solver_inputs_dic[hdf5_filename] = h5py.File(hdf5_filename, 'r') print hdf5_filename kk = solver_inputs_dic[hdf5_filename].keys() for k in kk: keys[k] = hdf5_filename k_ctr += 1 except Exception as e: