def caffe_net_thread(thread_id,solver_file_path,version,weights_file_mode,weights_file_path,command_dic,gpu_num): caffe.set_device(gpu_num) caffe.set_mode_gpu() caffe_net = Caffe_Net(solver_file_path,version,weights_file_mode,weights_file_path) cprint(d2s('Starting thread ',thread_id),'yellow','on_blue') state = command_dic[thread_id] while True: command = command_dic[thread_id] if command == 'pause thread': if state == 'pause': pass else: state = 'pause' cprint(d2s('Pausing thread ',thread_id),'yellow','on_blue') time.sleep(1) continue if command == 'start thread' and state == 'pause': state = 'running' cprint(d2s('Unpausing thread ',thread_id),'yellow','on_blue') if command == 'stop thread': cprint(d2s('Stopping thread ',thread_id),'yellow','on_blue') return if True: #try: data = access_bag_files.get_data(BF_dic,played_bagfile_dic,used_timestamps) else: #except Exception as e: cprint("********** Exception ***********************",'red') print(e.message, e.args) if data != None: caffe_net.train_step(data)
if True: #try: data = access_bag_files.get_data(BF_dic,played_bagfile_dic,used_timestamps) else: #except Exception as e: cprint("********** Exception ***********************",'red') print(e.message, e.args) if data != None: caffe_net.train_step(data) """ threading.Thread(target=caffe_net_thread,args=(thread_id,solver_file_path,version,weights_file_mode,weights_file_path,command_dic,gpu_num)).start() """ caffe_net = Caffe_Net(solver_file_path,version,weights_file_mode,weights_file_path) while True: try: data = access_bag_files.get_data(BF_dic,played_bagfile_dic,used_timestamps) except Exception as e: cprint("********** Exception ***********************",'red') print(e.message, e.args) if data != None: caffe_net.train_step(data) """ caffe_net = Caffe_Net.Caffe_Net(solver_file_path,version,weights_file_mode,weights_file_path) def caffe_net_thread(): caffe.set_device(0) caffe.set_mode_gpu() while True: try: data = access_bag_files.get_data(BF_dic,played_bagfile_dic,used_timestamps) except Exception as e: