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("Adding Errors") bvpl_octree_batch.init_process("bvplAddTaylorErrorsProcess") bvpl_octree_batch.set_input_from_db(0, job.error_scene) bvpl_octree_batch.set_input_double(1, job.fraction) 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.run_process() (id, type) = bvpl_octree_batch.commit_output(0) error_val = dbvalue(id, type) error = bvpl_octree_batch.get_output_double(id) self.result_queue.put(error) print("error") print(error) 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(); bvpl_octree_batch.init_process("bvplThresholdHarrisProcess"); bvpl_octree_batch.set_input_string(0,job.taylor_path); bvpl_octree_batch.set_input_int(1, job.scene_id); 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_double(5, job.harris_k); bvpl_octree_batch.run_process(); bvpl_octree_batch.clear(); 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);
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("Adding Errors"); bvpl_octree_batch.init_process("bvplAddPCAErrorsProcess"); bvpl_octree_batch.set_input_from_db(0,job.pca_scenes); bvpl_octree_batch.set_input_unsigned(1, job.dim); bvpl_octree_batch.set_input_double(2,job.fraction); bvpl_octree_batch.set_input_int(3, job.block_i); bvpl_octree_batch.set_input_int(4, job.block_j) bvpl_octree_batch.set_input_int(5, job.block_k) bvpl_octree_batch.run_process(); (id, type) = bvpl_octree_batch.commit_output(0); error_val = dbvalue(id, type); error = bvpl_octree_batch.get_output_double(id); self.result_queue.put(error); 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("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);
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.set_stdout('logs/log_' + str(os.getpid())+ ".txt"); 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,job.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); #free memory bvpl_octree_batch.reset_stdout(); bvpl_octree_batch.clear(); #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);
if not os.path.isdir(pca_dir + "/"): os.makedirs(pca_dir + "/") print("Extracting Principal Components patches") print("Creating a Scene") batch.init_process("boxmCreateSceneProcess") batch.set_input_string(0, model_dir + "/mean_color_scene.xml") batch.run_process() (scene_id, scene_type) = batch.commit_output(0) scene = dbvalue(scene_id, scene_type) start_time = time.time() print("Extract PC") batch.init_process("bvplDiscoverPCAFeaturesProcess") batch.set_input_from_db(0, scene) batch.set_input_string(1, pca_dir) batch.set_input_double(2, train_fraction) batch.set_input_int(3, -2) # min and max points of the kernel batch.set_input_int(4, -2) batch.set_input_int(5, -2) batch.set_input_int(6, 2) batch.set_input_int(7, 2) batch.set_input_int(8, 2) batch.run_process() print("Runing time forbvplDiscoverPCAFeaturesProcess:") print(time.time() - start_time)
pca_dir = pca_dir + "/" + str(int(train_fraction * 100)) if not os.path.isdir(pca_dir + "/"): os.makedirs(pca_dir + "/") print("Extracting Principal Components patches") print("Creating a Scene") bvpl_octree_batch.init_process("boxmCreateSceneProcess") bvpl_octree_batch.set_input_string(0, model_dir + "/mean_color_scene.xml") bvpl_octree_batch.run_process() (scene_id, scene_type) = bvpl_octree_batch.commit_output(0) scene = dbvalue(scene_id, scene_type) start_time = time.time() print("Extract PC") bvpl_octree_batch.init_process("bvplDiscoverPCAFeaturesProcess") bvpl_octree_batch.set_input_from_db(0, scene) bvpl_octree_batch.set_input_string(1, pca_dir) bvpl_octree_batch.set_input_double(2, train_fraction) bvpl_octree_batch.set_input_int(3, -2) # min and max points of the kernel bvpl_octree_batch.set_input_int(4, -2) bvpl_octree_batch.set_input_int(5, -2) bvpl_octree_batch.set_input_int(6, 2) bvpl_octree_batch.set_input_int(7, 2) bvpl_octree_batch.set_input_int(8, 2) bvpl_octree_batch.run_process() print ("Runing time for bvplDiscoverPCAFeaturesProcess:") print(time.time() - start_time)
if not os.path.isdir(pca_dir + "/"): os.makedirs(pca_dir + "/") print("Extracting Principal Components patches") print("Creating a Scene") bvpl_octree_batch.init_process("boxmCreateSceneProcess") bvpl_octree_batch.set_input_string(0, model_dir + "/mean_color_scene.xml") bvpl_octree_batch.run_process() (scene_id, scene_type) = bvpl_octree_batch.commit_output(0) scene = dbvalue(scene_id, scene_type) start_time = time.time() print("Extract PC") bvpl_octree_batch.init_process("bvplDiscoverPCAFeaturesProcess") bvpl_octree_batch.set_input_from_db(0, scene) bvpl_octree_batch.set_input_string(1, pca_dir) bvpl_octree_batch.set_input_double(2, train_fraction) bvpl_octree_batch.set_input_int(3, -2) #min and max points of the kernel bvpl_octree_batch.set_input_int(4, -2) bvpl_octree_batch.set_input_int(5, -2) bvpl_octree_batch.set_input_int(6, 2) bvpl_octree_batch.set_input_int(7, 2) bvpl_octree_batch.set_input_int(8, 2) bvpl_octree_batch.run_process() print("Runing time forbvplDiscoverPCAFeaturesProcess:") print(time.time() - start_time)