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("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"); # 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(); 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 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_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 = 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("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(); 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 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);
nclasses = options.nclasses; if not os.path.isdir(k_means_dir +"/"): print "Invalid k_means Dir" sys.exit(-1); FM_path = k_means_dir + "/FM"; if not os.path.isdir(FM_path +"/"): os.mkdir(FM_path +"/"); start_time = time.time(); #Combine all CM_i means into one set CM to be passed for k-means mean_file_sfx = k_means_dir + "/class" ; dbrec3d_batch.init_process("bof_combine_category_means_process"); dbrec3d_batch.set_input_string(0, mean_file_sfx); dbrec3d_batch.set_input_unsigned(1, nclasses); dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); CM_set= dbvalue(id, type); saveout = sys.stdout # save initial state of stdout #Begin multiprocessing job_list=[]; #Enqueue jobs for class_id in range (0, nclasses): cm_file = mean_file_sfx + str(class_id) + "/lowest_sse_means.txt"; fm_file = FM_path + "/FM_means_class" + str(class_id) + ".txt";
thresh = options.thresh; top_p = thresh/100.0 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 "Creating k-means Dir" os.mkdir(k_means_dir + "/" ); #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); # #Begin multiprocessing job_list=[]; start_time = time.time(); #Enqueue jobs for class_id in range (0, nclasses):
min_y = -30; max_y = 30; min_z = -15; max_z = 15; 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; axis_x = axes_x[0]; axis_y = axes_y[0]; axis_z = axes_z[0]; 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); 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);
# ply_files = glob.glob1(ply_path_in, "*.ply"); # # 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");
min_z = 0; 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);
print "Invalid bof Dir" sys.exit(-1); FM_path = k_means_dir + "/FM"; if not os.path.isdir(FM_path +"/"): print "Invalid FM_path Dir" sys.exit(-1); if not os.path.isdir(k_means_dir +"/"): os.mkdir(k_means_dir +"/"); #Begin start_time = time.time(); mean_file_sfx = FM_path + "/FM_" ; dbrec3d_batch.init_process("bofChooseMinDistortionClusteringProcess"); dbrec3d_batch.set_input_string(0, mean_file_sfx); dbrec3d_batch.run_process(); (id, type) = dbrec3d_batch.commit_output(0); mean_idx_val = dbvalue(id, type); best_mean_file = dbrec3d_batch.get_output_string(mean_idx_val.id); dbrec3d_batch.clear(); print "In python output string: " + str(best_mean_file) base_file = re.sub('\_info$', '', best_mean_file) best_fm_file = FM_path + '/' + base_file + ".txt"; print "In python best_fm_file: " + best_fm_file lowest_sse_file = k_means_dir + "/lowest_sse_means.txt"
#*******************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);
CM_path = init_k_means_dir + "/CM"; 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);
#!/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();
#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();
pca_info_file = pca_dir + "/pca_global_info.xml"; 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);
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();
parser.add_option('--pca_dir', action="store", dest="pca_dir"); parser.add_option('--bof_dir', action="store", dest="bof_dir"); parser.add_option('--num_means', action="store", dest="num_means", type="int", default =0) options, args = parser.parse_args(); pca_dir = options.pca_dir; bof_dir = options.bof_dir; num_means = options.num_means; if not os.path.isdir(pca_dir +"/"): print "Invalid PCA Dir" sys.exit(-1); if not os.path.isdir(bof_dir +"/"): os.mkdir(bof_dir +"/"); start_time = time.time(); dbrec3d_batch.init_process("bofInitInfoFileProcess"); dbrec3d_batch.set_input_string(0,pca_dir); dbrec3d_batch.set_input_unsigned(1,num_means); dbrec3d_batch.set_input_string(2,bof_dir); dbrec3d_batch.run_process(); print ("Total running time: "); print(time.time() - start_time);
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
if not os.path.isdir(k_means_dir +"/"): 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
#!/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 pcd_fname = "/Users/isa/Experiments/helicopter_providence/tests_normals/max_level_6/flipped_normals.pcd" dbrec3d_batch.init_process("pcl_split_points_and_normals_process"); dbrec3d_batch.set_input_string(0, pcd_fname); dbrec3d_batch.run_process();
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();
if not os.path.isdir(class_histograms_dir +"/"): 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);