def run(self): while not self.kill_received: # get a task try: job = self.work_queue.get_nowait() except Queue.Empty: break start_time = time.time(); dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt"); dbrec3d_batch.init_process("bof_sample_statistics_process"); dbrec3d_batch.set_input_from_db(0,job.categories); dbrec3d_batch.set_input_from_db(1,job.global_pca); dbrec3d_batch.set_input_unsigned(2, job.scene_id); dbrec3d_batch.set_input_string(3, job.file_out); dbrec3d_batch.run_process(); dbrec3d_batch.clear(); dbrec3d_batch.reset_stdout(); print ("Runing time for worker:", self.name) print(time.time() - start_time);
def run(self): while not self.kill_received: # get a task try: job = self.work_queue.get_nowait() except Queue.Empty: break start_time = time.time(); dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt"); dbrec3d_batch.init_process("bof_learn_category_codebook_salient_process"); dbrec3d_batch.set_input_from_db(0,job.categories); dbrec3d_batch.set_input_unsigned(1, job.class_id); dbrec3d_batch.set_input_unsigned(2, job.num_means); dbrec3d_batch.set_input_double(3, job.fraction); dbrec3d_batch.set_input_unsigned(4, job.J); dbrec3d_batch.set_input_unsigned(5, job.max_it); dbrec3d_batch.set_input_float(6, job.top_p); dbrec3d_batch.set_input_string(7, job.class_mean_dir); dbrec3d_batch.run_process(); dbrec3d_batch.clear(); dbrec3d_batch.reset_stdout();
def run(self): while not self.kill_received: # get a task try: job = self.work_queue.get_nowait() except Queue.Empty: break start_time = time.time(); time.sleep(10); #dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt"); dbrec3d_batch.init_process("bofMakeClusterIdSceneProcess"); dbrec3d_batch.set_input_string(0, job.bof_path); dbrec3d_batch.set_input_from_db(1, job.codebook); dbrec3d_batch.set_input_int(2, job.scene_id); dbrec3d_batch.set_input_int(3, job.block_i); dbrec3d_batch.set_input_int(4, job.block_j); dbrec3d_batch.set_input_int(5, job.block_k); dbrec3d_batch.run_process(); dbrec3d_batch.clear(); #dbrec3d_batch.reset_stdout(); print ("Runing time for worker:", self.name) print(time.time() - start_time);
def run(self): while not self.kill_received: # get a task try: job = self.work_queue.get_nowait() except Queue.Empty: break start_time = time.time(); dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt"); dbrec3d_batch.init_process("bofKMeansOnVectorProcess"); dbrec3d_batch.set_input_string(0, job.cm_i_file); dbrec3d_batch.set_input_from_db(1, job.CM_set); dbrec3d_batch.set_input_unsigned(2, job.max_it); dbrec3d_batch.set_input_string(3, job.fm_i_file); dbrec3d_batch.run_process(); dbrec3d_batch.clear(); dbrec3d_batch.reset_stdout(); print ("Runing time for worker:", self.name) print(time.time() - start_time);
def run(self): while not self.kill_received: # get a task try: job = self.work_queue.get_nowait() except Queue.Empty: break start_time = time.time(); dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt"); dbrec3d_batch.init_process("bofLearnCategoriesProcess"); dbrec3d_batch.set_input_from_db(0, job.codebook); dbrec3d_batch.set_input_int(1, job.scene_id); dbrec3d_batch.set_input_string(2, job.bof_dir); dbrec3d_batch.set_input_string(3, job.path_out); dbrec3d_batch.run_process(); dbrec3d_batch.clear(); dbrec3d_batch.reset_stdout();
def run(self): while not self.kill_received: # get a task try: job = self.work_queue.get_nowait() except Queue.Empty: break start_time = time.time() dbrec3d_batch.set_stdout("logs/log_" + str(os.getpid()) + ".txt") dbrec3d_batch.init_process("bof_learn_categories_salient_process") dbrec3d_batch.set_input_from_db(0, job.codebook) dbrec3d_batch.set_input_int(1, job.scene_id) dbrec3d_batch.set_input_float(2, job.top_p) dbrec3d_batch.set_input_from_db(3, job.categories) dbrec3d_batch.set_input_string(4, job.path_out) dbrec3d_batch.run_process() dbrec3d_batch.clear() dbrec3d_batch.reset_stdout()
def run(self): while not self.kill_received: # get a task try: job = self.work_queue.get_nowait() except Queue.Empty: break start_time = time.time(); dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt"); dbrec3d_batch.init_process("bofClassifyProcess"); dbrec3d_batch.set_input_from_db(0, job.codebook); dbrec3d_batch.set_input_from_db(1, job.p_xc); dbrec3d_batch.set_input_int(2, job.scene_id); dbrec3d_batch.set_input_string(3, job.bof_dir); dbrec3d_batch.set_input_string(4, job.path_out); dbrec3d_batch.run_process(); dbrec3d_batch.clear(); dbrec3d_batch.reset_stdout(); print ("Runing time for worker:", self.name) print(time.time() - start_time);
# dbrec3d_batch.set_input_string(0,ply_path_in + '/' + file); # dbrec3d_batch.set_input_string(1,ply_path_out + '/' + file); # dbrec3d_batch.set_input_double(2,scale); # dbrec3d_batch.run_process(); #*********** Save a scene labeling objects for debigging purposes **************# print("Creating a Scene"); dbrec3d_batch.init_process("boxmCreateSceneProcess"); dbrec3d_batch.set_input_string(0, scene_in); dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); scene= dbvalue(id, type); dbrec3d_batch.init_process("bofExamineGroundTruthProcess"); dbrec3d_batch.set_input_from_db(0,scene); dbrec3d_batch.set_input_string(1,ply_path_out); dbrec3d_batch.set_input_string(2,obj_name); dbrec3d_batch.set_input_string(3,ply_path_out); dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); scene_out= dbvalue(id, type); print("Save Scene"); dbrec3d_batch.init_process("boxmSaveSceneRawProcess"); dbrec3d_batch.set_input_from_db(0,scene_out); dbrec3d_batch.set_input_string(1, ply_path_out + "/drishti/labeled_scene_level_0"); dbrec3d_batch.set_input_unsigned(2,0); dbrec3d_batch.set_input_unsigned(3,1); dbrec3d_batch.run_process();
dbrec3d_batch.set_input_int(2,min_y); dbrec3d_batch.set_input_int(3,max_y); dbrec3d_batch.set_input_int(4,min_z); dbrec3d_batch.set_input_int(5,max_z); dbrec3d_batch.set_input_float(6,axis_x); dbrec3d_batch.set_input_float(7,axis_y); dbrec3d_batch.set_input_float(8,axis_z); dbrec3d_batch.set_input_float(9,angle); dbrec3d_batch.run_process(); (kernel_id,kernel_type)= dbrec3d_batch.commit_output(0); kernel = dbvalue(kernel_id,kernel_type); print("Convert to Parts") dbrec3d_batch.init_process("dbrec3dKernelsToPartsProcess"); dbrec3d_batch.set_input_from_db(0, kernel_scene); dbrec3d_batch.set_input_from_db(1, kernel); dbrec3d_batch.run_process(); dbrec3d_batch.print_db(); print("Get the response") dbrec3d_batch.init_process("dbrec3dGetResponseProcess"); dbrec3d_batch.set_input_int(0, 0); dbrec3d_batch.run_process(); (scene_id, scene_type) = dbrec3d_batch.commit_output(0); response_scene= dbvalue(scene_id, scene_type); resolution = 0; enforce_level = 1;
dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); categories= dbvalue(id, type); #load class codebook class_id = 0; codebook_file = k_means_dir + "/class" + str(class_id) + "/lowest_sse_means.txt" dbrec3d_batch.init_process("bofInitCodebookProcess"); dbrec3d_batch.set_input_string(0,codebook_file); dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); codebook= dbvalue(id, type); #compute object weight for all testing objects dbrec3d_batch.init_process("bof_class_probability_process"); dbrec3d_batch.set_input_from_db(0,codebook); dbrec3d_batch.set_input_from_db(1,categories); dbrec3d_batch.set_input_unsigned(2, class_id); dbrec3d_batch.set_input_string(3, classification_dir); dbrec3d_batch.run_process(); # #Begin multiprocessing # job_list=[]; # start_time = time.time(); # # #Enqueue jobs # for scene_id in range (0, nscenes): # histogram_path = class_histograms_dir + "/scene_" + str(scene_id); # if not os.path.isdir(histogram_path +"/"): # os.mkdir(histogram_path +"/")
#Begin multiprocessing job_list=[]; start_time = time.time(); #load codebook codebook_file = k_means_dir + "/lowest_sse_means.txt" dbrec3d_batch.init_process("bofInitCodebookProcess"); dbrec3d_batch.set_input_string(0,codebook_file); dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); codebook= dbvalue(id, type); #load class/keypoints distributions dbrec3d_batch.init_process("bofLoadPXCProcess"); dbrec3d_batch.set_input_from_db(0,codebook); dbrec3d_batch.set_input_string(1,class_histograms_dir); dbrec3d_batch.set_input_unsigned(2, ncategories); dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); p_xc= dbvalue(id, type); #Enqueue jobs for scene_id in range(0, nscenes): current_job = bof_job(bof_dir, p_xc, codebook , scene_id, classification_dir); job_list.append(current_job); execute_bof_jobs(job_list, num_cores);
valid_scene_path = "/Users/isa/Experiments/boxm_scili_full/steerable_filters_alpha/valid_scene.xml" pcd_file = "/Users/isa/Experiments/pcl/tests/boxm_scili_full.pcd" #/Users/isa/Experiments/boxm_cit_only_filtered/steerable_filters_alpha # #grad_scene_path = "/Users/isa/Experiments/helicopter_providence/boxm_scenes/site12/steerable_filters_alpha/steerable_gauss_3d_scene.xml" #valid_scene_path= "/Users/isa/Experiments/helicopter_providence/boxm_scenes/site12/steerable_filters_alpha/valid_scene.xml" #pcd_file = "/Users/isa/Experiments/pcl/tests/site_12.pcd" #load gradient scene print("Creating a Scene"); dbrec3d_batch.init_process("boxmCreateSceneProcess"); dbrec3d_batch.set_input_string(0, grad_scene_path); dbrec3d_batch.run_process(); (scene_id, scene_type) = dbrec3d_batch.commit_output(0); grad_scene= dbvalue(scene_id, scene_type); #load valid scene dbrec3d_batch.init_process("boxmCreateSceneProcess"); dbrec3d_batch.set_input_string(0, valid_scene_path); dbrec3d_batch.run_process(); (scene_id, scene_type) = dbrec3d_batch.commit_output(0); valid_scene= dbvalue(scene_id, scene_type); dbrec3d_batch.init_process("pcl_convert_scene_to_pc_process"); dbrec3d_batch.set_input_from_db(0, grad_scene); dbrec3d_batch.set_input_from_db(1, valid_scene); dbrec3d_batch.set_input_string(2, pcd_file); dbrec3d_batch.run_process();
#Parse inputs print ("******************************Compute Object level***************************") parser = optparse.OptionParser(description='Init Category info'); parser.add_option('--bof_dir', action="store", dest="bof_dir"); options, args = parser.parse_args(); bof_dir = options.bof_dir; if not os.path.isdir(bof_dir +"/"): print "Invalid bof Dir" sys.exit(-1); #load category info dbrec3d_batch.init_process("bofLoadCategoryInfoProces"); dbrec3d_batch.set_input_string(0, bof_dir); dbrec3d_batch.set_input_string(1, "bof_info_train.xml") dbrec3d_batch.set_input_string(2, "bof_category_info_old.xml") dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); categories= dbvalue(id, type); #load category info dbrec3d_batch.init_process("bof_object_level_process"); dbrec3d_batch.set_input_from_db(0, categories); dbrec3d_batch.run_process();
model_dir ="/Users/isa/Experiments/CapitolBOXM"; print("Creating a Scene"); dbrec3d_batch.init_process("boxmCreateSceneProcess"); dbrec3d_batch.set_input_string(0, model_dir +"/apm_scene.xml"); dbrec3d_batch.run_process(); (scene_id, scene_type) = dbrec3d_batch.commit_output(0); mog_scene = dbvalue(scene_id, scene_type); print("*************************************"); print("Save Scene"); dbrec3d_batch.init_process("boxmSaveOccupancyRawProcess"); dbrec3d_batch.set_input_from_db(0,mog_scene); dbrec3d_batch.set_input_string(1,model_dir + "/gauss_scene"); dbrec3d_batch.set_input_unsigned(2,0); dbrec3d_batch.set_input_unsigned(3,0); dbrec3d_batch.run_process(); #print("Merging the scene"); #dbrec3d_batch.init_process("boxmMergeMixturesProcess"); #dbrec3d_batch.set_input_from_db(0, mog_scene); #dbrec3d_batch.run_process(); #(scene_id, scene_type) = dbrec3d_batch.commit_output(0); #gauss_scene = dbvalue(scene_id, scene_type); #print("Convert to regular grid"); #dbrec3d_batch.init_process("boxmSceneToBvxmGridProcess");
dbrec3d_batch.set_input_double(6,var); dbrec3d_batch.set_input_double(7,var); dbrec3d_batch.set_input_int(8,xmin); dbrec3d_batch.set_input_int(9,ymin); dbrec3d_batch.set_input_int(10,zmin); dbrec3d_batch.set_input_int(11,xmax); dbrec3d_batch.set_input_int(12,ymax); dbrec3d_batch.set_input_int(13,zmax); dbrec3d_batch.set_input_string(14, pair_scene_dir); dbrec3d_batch.run_process(); (id,type)= dbrec3d_batch.commit_output(0); composite_context_id = dbvalue(id,type); print("Save VRML"); dbrec3d_batch.init_process("dbrec3dSaveVrmlProcess"); dbrec3d_batch.set_input_from_db(0,composite_context_id); dbrec3d_batch.set_input_string(1,pair_scene_dir + "/edges_01.wrl"); dbrec3d_batch.set_input_double(2, -0.13); dbrec3d_batch.set_input_double(3, -0.08); dbrec3d_batch.set_input_double(4, 0); dbrec3d_batch.set_input_double(5, -0.08); dbrec3d_batch.set_input_double(6, -0.03); dbrec3d_batch.set_input_double(7, 0.05); dbrec3d_batch.run_process(); print("Save Parts and Contexts"); dbrec3d_batch.init_process("dbrec3dXmlWriteProcess"); dbrec3d_batch.set_input_string(0, pair_scene_dir + "/hierarchy.xml"); dbrec3d_batch.set_input_string(1, pair_scene_dir + "/contexts.xml"); dbrec3d_batch.run_process();
dbrec3d_batch.set_input_int(1,max_x); dbrec3d_batch.set_input_int(2,min_y); dbrec3d_batch.set_input_int(3,max_y); dbrec3d_batch.set_input_int(4,min_z); dbrec3d_batch.set_input_int(5,max_z); dbrec3d_batch.set_input_float(6,axis_x); dbrec3d_batch.set_input_float(7,axis_y); dbrec3d_batch.set_input_float(8,axis_z); dbrec3d_batch.set_input_float(9,angle); dbrec3d_batch.run_process(); (kernel_id,kernel_type)= dbrec3d_batch.commit_output(0); kernel = dbvalue(kernel_id,kernel_type); print("Running Operator"); dbrec3d_batch.init_process("bvplSceneKernelOperatorProcess"); dbrec3d_batch.set_input_from_db(0,scene); dbrec3d_batch.set_input_from_db(1,kernel); dbrec3d_batch.set_input_string(2,"bsta_gauss_f1"); dbrec3d_batch.set_input_string(3,"positive_gauss_convolution"); dbrec3d_batch.set_input_string(4, output_dir); dbrec3d_batch.run_process(); (out_scene_id,out_scene_type)= dbrec3d_batch.commit_output(0); result_scene = dbvalue(out_scene_id,out_scene_type); resolution = 0; enforce_level = 1; print("Convert to regular grid"); dbrec3d_batch.init_process("boxmSceneToBvxmGridProcess"); dbrec3d_batch.set_input_from_db(0,result_scene); dbrec3d_batch.set_input_string(1, output_dir + "/response.vox");