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"); 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"); 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(); 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("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"); # 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 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(); print("Save Scene"); dbrec3d_batch.init_process("bofSaveCategorySceneRawProcess"); dbrec3d_batch.set_input_string(0,job.bof_dir); dbrec3d_batch.set_input_int(1, job.scene_id); dbrec3d_batch.run_process(); 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 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("bofKMeansTrainProcess"); dbrec3d_batch.set_input_string(0, job.bof_path); dbrec3d_batch.set_input_string(1, job.starting_means_path); 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.set_input_unsigned(6, job.max_it); dbrec3d_batch.set_input_string(7, 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("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);
import dbrec3d_batch; dbrec3d_batch.register_processes(); dbrec3d_batch.register_datatypes(); class dbvalue: def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string 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");
# # print ply_files # # for file in ply_files: # # dbrec3d_batch.init_process("bofScalePLYProcess"); # 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");
max_z = 0; axes_x=[-1.0,0.0,0.0]; axes_y=[0.0,-1.0,0.0]; axes_z=[0.0,0.0,-1.0]; angle = 0.0; i=1; axis_x = axes_x[i]; axis_y = axes_y[i]; axis_z = axes_z[i]; print("Creating Scene"); dbrec3d_batch.init_process("boxmCreateSceneProcess"); dbrec3d_batch.set_input_string(0, model_dir +"/gauss_response_scene.xml"); dbrec3d_batch.run_process(); (scene_id, scene_type) = dbrec3d_batch.commit_output(0); kernel_scene= dbvalue(scene_id, scene_type); print("Creating 3D edge kernel"); dbrec3d_batch.init_process("bvplCreateEdge3dKernelProcess"); dbrec3d_batch.set_input_int(0,min_x); 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);
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" #/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);
print "Invalid k-means Dir" sys.exit(-1); if not os.path.isdir(classification_dir +"/"): print "Invalid classification_dir " os.mkdir(classification_dir + "/" ); #parse the number of scenes bof_info_file = bof_dir + "/bof_info.xml"; nscenes = parse_bof_info(bof_info_file); print "Number of Scenes:" print nscenes #load category info dbrec3d_batch.init_process("bofLoadCategoryInfoProces"); dbrec3d_batch.set_input_string(0, bof_dir); 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");
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();
#Parse inputs parser = optparse.OptionParser(description='bof Statistics Pass 0'); parser.add_option('--bof_dir', action="store", dest="bof_dir"); parser.add_option('--init_k_means_dir', action="store", dest="init_k_means_dir"); parser.add_option('--num_means', action="store", dest="num_means", type="int", default =50) options, args = parser.parse_args() bof_dir = options.bof_dir; num_means = options.num_means; init_k_means_dir = options.init_k_means_dir; if not os.path.isdir(bof_dir +"/"): print "Invalid bof Dir" sys.exit(-1); if not os.path.isdir(init_k_means_dir +"/"): os.mkdir(init_k_means_dir +"/"); dbrec3d_batch.init_process("bofRndMeansProcess"); dbrec3d_batch.set_input_string(0,bof_dir); dbrec3d_batch.set_input_int(1,num_means); dbrec3d_batch.set_input_string(2, init_k_means_dir + "/sp_means.txt"); dbrec3d_batch.run_process(); dbrec3d_batch.clear();
os.mkdir(class_histograms_dir +"/") #parse the number of scenes bof_info_file = bof_dir + "/bof_info.xml"; nscenes = parse_bof_info(bof_info_file); print "Number of Scenes:" print nscenes #Begin multiprocessing job_list=[]; start_time = time.time(); #initial satrting point means 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); #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 +"/") current_job = bof_job(bof_dir, codebook , scene_id, histogram_path); job_list.append(current_job); execute_bof_jobs(job_list, num_cores);
class_histograms_dir = options.class_histograms_dir; if not os.path.isdir(bof_dir +"/"): print "Invalid bof Dir" sys.exit(-1); if not os.path.isdir(class_histograms_dir +"/"): print "Invalid histogram Dir" sys.exit(-1); output_path = class_histograms_dir + "/all_scenes" if not os.path.isdir(output_path +"/"): os.mkdir(output_path +"/"); codebook_file = k_means_dir + "/lowest_sse_means.txt" start_time = time.time(); dbrec3d_batch.init_process("bofCombineQuantizationProcess"); dbrec3d_batch.set_input_string(0,bof_dir); dbrec3d_batch.set_input_string(1,class_histograms_dir + "/scene_"); dbrec3d_batch.set_input_string(2,codebook_file); dbrec3d_batch.set_input_string(3,output_path); dbrec3d_batch.run_process(); dbrec3d_batch.clear(); print ("Total running time: "); print(time.time() - start_time);
# normalize_object_lcf.py # voxels-at-lems # # Created by Maria Restrepo on 11/22/11. # Copyright (c) 2011 Brown University. All rights reserved. # Calls processes to normalize the local coordinate system on a point cloud import dbrec3d_batch; import os; import optparse; dbrec3d_batch.register_processes(); dbrec3d_batch.register_datatypes(); class dbvalue: def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string pcl_dir = "/Users/isa/Experiments/pcl/tests" #input_pcd_file = pcl_dir + "/boxm_scili.pcd" #output_pcd_file = pcl_dir + "/boxm_scili_normalized_lcf.pcd" input_pcd_file = pcl_dir + "/site12_objects/object_1.pcd" output_pcd_file = pcl_dir + "/site12_objects/object_1_normalized_lcf.pcd" dbrec3d_batch.init_process("pcl_trasform_xy_align_process"); dbrec3d_batch.set_input_string(0, input_pcd_file); dbrec3d_batch.set_input_string(1, output_pcd_file); dbrec3d_batch.run_process();
#*******************The Main Algorithm ************************# if __name__=="__main__": dbrec3d_batch.register_processes(); dbrec3d_batch.register_datatypes(); #Parse inputs print ("******************************Init Category Info***************************") 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); start_time = time.time(); dbrec3d_batch.init_process("bofInitCategoryInfoProcess"); dbrec3d_batch.set_input_string(0,bof_dir); dbrec3d_batch.run_process(); dbrec3d_batch.clear(); print ("Total running time: "); print(time.time() - start_time);
os.mkdir(classification_dir + "/"); #parse the number of scenes bof_info_file = bof_dir + "/bof_info.xml"; nscenes = parse_bof_info(bof_info_file); print "Number of Scenes:" print nscenes #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
if not os.path.isdir(bof_dir + "/"): print "Invalid bof Dir" print bof_dir sys.exit(-1) if not os.path.isdir(k_means_dir + "/"): print "Invalid k-means Dir" sys.exit(-1) if not os.path.isdir(class_histograms_dir + "/"): os.mkdir(class_histograms_dir + "/") # initial starting point means 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 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_train_info.xml") dbrec3d_batch.run_process() (id, type) = dbrec3d_batch.commit_output(0) categories = dbvalue(id, type) # parse the number of scenes bof_info_file = bof_dir + "/bof_info_train.xml"
#!/bin/python # scene_to_pcl.py # voxels-at-lems # # Created by Isabel Restrepo on 11/2/11. # Copyright (c) 2011 Brown University. All rights reserved. import dbrec3d_batch; import os; import optparse; dbrec3d_batch.register_processes(); dbrec3d_batch.register_datatypes(); class dbvalue: def __init__(self, index, type): self.id = index # unsigned integer self.type = type # string ply_fname = "/Users/isa/Experiments/helicopter_providence/tests_normals/max_level_6/flipped_normals.ply" pcd_fname = "/Users/isa/Experiments/helicopter_providence/tests_normals/max_level_6/flipped_normals.pcd" dbrec3d_batch.init_process("pcl_read_and_filter_ply_normals_process"); dbrec3d_batch.set_input_string(0, ply_fname); dbrec3d_batch.set_input_string(1, pcd_fname); dbrec3d_batch.set_input_float(2, 0.0701328); #this value corresponds to 5% dbrec3d_batch.run_process();
self.id = index # unsigned integer self.type = type # string model_dir = "/Users/isa/Experiments/CapitolBOXMSmall"; output_path = "/Users/isa/Experiments/tests/edges/"; 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, output_path + "/hierarchy.xml"); dbrec3d_batch.set_input_string(1, output_path + "/contexts.xml"); 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));
if not os.path.isdir(CM_path +"/"): print "Invalid CM Dir" sys.exit(-1); FM_path = init_k_means_dir + "/FM"; if not os.path.isdir(FM_path +"/"): os.mkdir(FM_path +"/"); CM_files = glob.glob1(CM_path, 'CM*'); num_mean_files = len(CM_files); #Combine all CM_i means into one set CM to be passed for k-means mean_file_sfx = CM_path + "/CM_" ; dbrec3d_batch.init_process("bofCombineMeansProcess"); dbrec3d_batch.set_input_string(0, mean_file_sfx); dbrec3d_batch.set_input_unsigned(1, num_mean_files); dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); CM_set= dbvalue(id, type); #Begin multiprocessing job_list=[]; #Enqueue jobs for CM_file in CM_files: cm_file = CM_path + "/" + CM_file; fm_file = FM_path + "/FM" + CM_file.strip('CM'); current_job = bof_job(cm_file, CM_set, max_it, fm_file); job_list.append(current_job);
import dbrec3d_batch; import os; import optparse; dbrec3d_batch.register_processes(); dbrec3d_batch.register_datatypes(); class dbvalue: 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" xyznormal_file = pcl_dir + "/boxm_scili.pcd"; fpfh_file =pcl_dir + "/fpfh_boxm_scili.pcd"; means_file = pcl_dir + "/means_50_scili/lowest_sse_means.txt" output_dir = pcl_dir + "/means_50_scili"; dbrec3d_batch.init_process("pcl_k_means_assign_process"); dbrec3d_batch.set_input_string(0, xyznormal_file); dbrec3d_batch.set_input_string(1, fpfh_file); dbrec3d_batch.set_input_string(2, means_file); dbrec3d_batch.set_input_string(3, output_dir); dbrec3d_batch.run_process();
temp_results_dir = pca_dir + "/temp"; if not os.path.isdir(pca_dir +"/"): print "Invalid PCA Dir" sys.exit(-1); if not os.path.isdir(temp_results_dir +"/"): os.mkdir(temp_results_dir +"/"); nscenes=parse_pca_info(pca_info_file); print ("Number of scenes: " + str(nscenes)); #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_train_info.xml") dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); categories= dbvalue(id, type); dbrec3d_batch.init_process("bvplLoadGlobalPCA125Process"); dbrec3d_batch.set_input_string(0,pca_dir); dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); global_pca = dbvalue(id, type); #Begin multiprocessing