def run(self): while not self.kill_received: # get a task try: job = self.work_queue.get_nowait() except Queue.Empty: break dbrec3d_batch.register_processes(); dbrec3d_batch.register_datatypes(); start_time = time.time(); dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt"); dbrec3d_batch.init_process("bofKMeansSubsampleProcess"); dbrec3d_batch.set_input_string(0, job.bof_path); dbrec3d_batch.set_input_string(1, job.starting_means_path); dbrec3d_batch.set_input_double(2, job.fraction); dbrec3d_batch.set_input_unsigned(3, job.max_it); dbrec3d_batch.set_input_string(4, 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(); #dbrec3d_batch.set_stdout('logs/log_' + str(os.getpid())+ ".txt"); # file_in = str(job.pcl_dir) + "/object_" + str(job.object_id) + ".pcd"; # file_out = str(job.pcl_dir) + "/fpfh_object_" + str(job.object_id) + ".pcd"; # file_in = str(job.pcl_dir) + "/boxm_scili.pcd"; # file_out = str(job.pcl_dir) + "/fpfh_boxm_scili.pcd"; file_in = str(job.pcl_dir) + "/mesh_0.ply"; file_out = str(job.pcl_dir) + "/fpfh_mesh_0.pcd"; dbrec3d_batch.init_process("pcl_compute_fphf_process"); dbrec3d_batch.set_input_string(0, file_in); dbrec3d_batch.set_input_double(1, job.radius); dbrec3d_batch.set_input_string(2, 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"); # file_in = str(job.pcl_dir) + "/object_" + str(job.object_id) + ".pcd"; # file_out = str(job.pcl_dir) + "/fpfh_object_" + str(job.object_id) + ".pcd"; # file_in = str(job.pcl_dir) + "/boxm_scili.pcd"; # file_out = str(job.pcl_dir) + "/fpfh_boxm_scili.pcd"; # file_in="/Projects/pcl_dev/pcl/trunk/test/bun0.pcd" file_in = str(job.pcl_dir) + "/mesh_0.ply"; file_out = str(job.pcl_dir) + "/spin_mesh_0.pcd"; dbrec3d_batch.init_process("pcl_compute_spin_image_process"); dbrec3d_batch.set_input_string(0, file_in); dbrec3d_batch.set_input_double(1, job.radius); dbrec3d_batch.set_input_int(2, job.width); dbrec3d_batch.set_input_double(3, job.sup_angle); dbrec3d_batch.set_input_int(4, job.num_neighbors); dbrec3d_batch.set_input_bool(5, job.radial); dbrec3d_batch.set_input_bool(6, job.angular); dbrec3d_batch.set_input_string(7, 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 __init__(self, index, type): self.id = index # unsigned integer self.type = type # string #grad_scene_path = "/Users/isa/Experiments/boxm_scili_full/steerable_filters_alpha/steerable_gauss_3d_scene.xml" #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" #Run k-means pcl_dir = "/Users/isa/Experiments/pcl/tests" fpfh_file =pcl_dir + "/fpfh_boxm_scili.pcd"; n_means = 50; init_frac = 0.1; init_iter = 10 max_iter = 500; means_dir = pcl_dir + "/means_50_scili" if not os.path.isdir(means_dir +"/"): os.mkdir(means_dir + "/"); dbrec3d_batch.init_process("pcl_k_means_learning_process"); dbrec3d_batch.set_input_string(0, fpfh_file); dbrec3d_batch.set_input_unsigned(1, n_means); dbrec3d_batch.set_input_double(2, init_frac); dbrec3d_batch.set_input_unsigned(3, init_iter); dbrec3d_batch.set_input_unsigned(4, max_iter); dbrec3d_batch.set_input_string(5, means_dir); dbrec3d_batch.run_process();
dbrec3d_batch.print_db(); #Parameters to group edge "0" and "1" mean_x = 2.0; mean_y = 0; mean_z = 2.0; var = 3; xmin=-5; ymin=-1; zmin=-7; xmax=0; ymax=1; zmax=0; print("Composing pairs"); id_0 = 0; id_1=1; print(str(id_0)); print(str(id_1)); dbrec3d_batch.init_process("dbrec3dFindPairsProcess"); dbrec3d_batch.set_input_int(0, id_0); dbrec3d_batch.set_input_int(1, id_1); dbrec3d_batch.set_input_double(2,mean_x); dbrec3d_batch.set_input_double(3,mean_y); dbrec3d_batch.set_input_double(4,mean_z); dbrec3d_batch.set_input_double(5,var); 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);
pair_scene_dir = "/Users/isa/Experiments/tests/edges_pairs/0_1_pair"; if not os.path.isdir( pair_scene_dir + "/"): os.mkdir( pair_scene_dir + "/"); #Compose pairs print("Loading Parts and Contexts"); dbrec3d_batch.init_process("dbrec3dXmlParseProcess"); 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.print_db(); print("Save VRML"); dbrec3d_batch.init_process("dbrec3dSaveVrmlProcess"); dbrec3d_batch.set_input_int(0,4); 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 + "/hierarchy2.xml"); dbrec3d_batch.set_input_string(1, pair_scene_dir + "/contexts2.xml"); dbrec3d_batch.run_process();
dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); categories= dbvalue(id, type); #learn codebook for a particular class class_id = 0; class_mean_dir = k_means_dir + "/class" + str(class_id); if not os.path.isdir(class_mean_dir +"/"): os.mkdir(class_mean_dir + "/" ); dbrec3d_batch.init_process("bofLearnCategoryCodebookProcess"); dbrec3d_batch.set_input_from_db(0,categories); dbrec3d_batch.set_input_unsigned(1, class_id); dbrec3d_batch.set_input_unsigned(2, num_means); dbrec3d_batch.set_input_double(3, fraction); dbrec3d_batch.set_input_unsigned(4, J); dbrec3d_batch.set_input_unsigned(5, max_it); dbrec3d_batch.set_input_string(6, class_mean_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 +"/")