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(); bvpl_octree_batch.init_process("bvplThresholdCornersProcess"); bvpl_octree_batch.set_input_from_db(0,job.global_taylor); bvpl_octree_batch.set_input_from_db(1,job.global_corners); bvpl_octree_batch.set_input_int(2, job.scene_id); bvpl_octree_batch.set_input_float(3, job.harris_threshold); bvpl_octree_batch.set_input_string(4, job.output_path); bvpl_octree_batch.run_process(); #Save dristhi raw scene drishti_dir = job.output_path + "/drishti"; if not os.path.isdir(drishti_dir +"/"): os.mkdir(drishti_dir +"/"); path_scene_out = drishti_dir + "/valid_scene"; print("Creating a Scene"); bvpl_octree_batch.init_process("boxmCreateSceneProcess"); bvpl_octree_batch.set_input_string(0, job.output_path + "/valid_scene_" + str(job.scene_id) + ".xml"); bvpl_octree_batch.run_process(); (id, type) = bvpl_octree_batch.commit_output(0); scene= dbvalue(id, type); print("Save Scene"); bvpl_octree_batch.init_process("boxmSaveSceneRawProcess"); bvpl_octree_batch.set_input_from_db(0,scene); bvpl_octree_batch.set_input_string(1, path_scene_out); bvpl_octree_batch.set_input_unsigned(2,0); bvpl_octree_batch.set_input_unsigned(3,1); bvpl_octree_batch.run_process(); bvpl_octree_batch.clear(); print ("Runing time for worker:", self.name) print(time.time() - start_time);
sigma = options.sigma; model_dirs = []; output_dirs = []; lengths=[]; scene_blocks =[]; parse_scenes_info(scenes_info, model_dirs, output_dirs, lengths, scene_blocks); #Begin multiprocessing job_list=[]; start_time = time.time(); print("Creating Gauss kernel"); bvpl_octree_batch.init_process("bvpl_create_gauss3d_kernel_process"); bvpl_octree_batch.set_input_float(0,sigma); bvpl_octree_batch.set_input_float(1,sigma); bvpl_octree_batch.set_input_float(2,sigma); bvpl_octree_batch.set_input_float(3,1.0); #axis of rotation - irrelevant for isotropic gaussian bvpl_octree_batch.set_input_float(4,0.0); bvpl_octree_batch.set_input_float(5,0.0); bvpl_octree_batch.set_input_float(6,0.0); #rotation about axis of rotation ;) bvpl_octree_batch.run_process(); (kernel_id,kernel_type)= bvpl_octree_batch.commit_output(0); kernel = dbvalue(kernel_id,kernel_type); #Enqueue jobs if(len(model_dirs)==len(output_dirs)==len(lengths)==len(scene_blocks) ): for scene_id in range (14, len(scene_blocks)):
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("Creating Gauss kernel"); bvpl_octree_batch.init_process("bvpl_create_gauss3d_kernel_process"); bvpl_octree_batch.set_input_float(0,job.sigma); bvpl_octree_batch.set_input_float(1,job.sigma); bvpl_octree_batch.set_input_float(2,job.sigma); bvpl_octree_batch.set_input_float(3,1.0); bvpl_octree_batch.set_input_float(4,0.0); bvpl_octree_batch.set_input_float(5,0.0); bvpl_octree_batch.set_input_float(6,0.0); bvpl_octree_batch.run_process(); (kernel_id,kernel_type)= bvpl_octree_batch.commit_output(0); kernel = dbvalue(kernel_id,kernel_type); print("Running Kernel"); bvpl_octree_batch.init_process("bvplBlockKernelOperatorProcess"); bvpl_octree_batch.set_input_from_db(0,job.scene); bvpl_octree_batch.set_input_from_db(1,kernel); bvpl_octree_batch.set_input_int(2, job.block_i); bvpl_octree_batch.set_input_int(3, job.block_j) bvpl_octree_batch.set_input_int(4, job.block_k) bvpl_octree_batch.set_input_string(5,"algebraic"); bvpl_octree_batch.set_input_string(6, job.output_path); bvpl_octree_batch.set_input_double(7, job.cell_length); bvpl_octree_batch.run_process(); print ("Runing time for worker:", self.name) print(time.time() - start_time); #output exit code in this case #important: having a result queue makes the execute_jobs wait for all jobs in the queue before exiting self.result_queue.put(0);
axis_x = axes_x[i]; axis_y = axes_y[i]; axis_z = axes_z[i]; if not os.path.isdir( output_dir + "/"): os.mkdir( output_dir + "/"); print("Creating 3D edge kernel"); bvpl_octree_batch.init_process("bvplCreateEdge3dKernelProcess"); bvpl_octree_batch.set_input_int(0,min_x); bvpl_octree_batch.set_input_int(1,max_x); bvpl_octree_batch.set_input_int(2,min_y); bvpl_octree_batch.set_input_int(3,max_y); bvpl_octree_batch.set_input_int(4,min_z); bvpl_octree_batch.set_input_int(5,max_z); bvpl_octree_batch.set_input_float(6,axis_x); bvpl_octree_batch.set_input_float(7,axis_y); bvpl_octree_batch.set_input_float(8,axis_z); bvpl_octree_batch.set_input_float(9,angle); bvpl_octree_batch.run_process(); (kernel_id,kernel_type)= bvpl_octree_batch.commit_output(0); kernel = dbvalue(kernel_id,kernel_type); print("Running Operator"); bvpl_octree_batch.init_process("bvplSceneKernelOperatorProcess"); bvpl_octree_batch.set_input_from_db(0,scene); bvpl_octree_batch.set_input_from_db(1,kernel); bvpl_octree_batch.set_input_string(2,"bsta_gauss_f1"); bvpl_octree_batch.set_input_string(3,"positive_gauss_convolution"); bvpl_octree_batch.set_input_string(4, output_dir); bvpl_octree_batch.run_process();
output_dir = output_dirs[i]; if not os.path.isdir( output_dir + "/"): os.mkdir( output_dir + "/"); axis_x = axes_x[i]; axis_y = axes_y[i]; axis_z = axes_z[i]; if not os.path.isdir( output_dir + "/"): os.mkdir( output_dir + "/"); print("Creating 3D edge kernel"); bvpl_octree_batch.init_process("bvplCreateGauss3dXKernelProcess"); bvpl_octree_batch.set_input_float(0,sigma1); bvpl_octree_batch.set_input_float(1,sigma2); bvpl_octree_batch.set_input_float(2,sigma3); bvpl_octree_batch.set_input_float(3,axis_x); bvpl_octree_batch.set_input_float(4,axis_y); bvpl_octree_batch.set_input_float(5,axis_z); bvpl_octree_batch.set_input_float(6,angle); bvpl_octree_batch.run_process(); (kernel_id,kernel_type)= bvpl_octree_batch.commit_output(0); kernel = dbvalue(kernel_id,kernel_type); print("Running Operator"); bvpl_octree_batch.init_process("bvplSceneKernelOperatorProcess"); bvpl_octree_batch.set_input_from_db(0,scene); bvpl_octree_batch.set_input_from_db(1,kernel); bvpl_octree_batch.set_input_string(2,"float");