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);
示例#2
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("Creating a Scene")
            bvpl_octree_batch.init_process("boxmCreateSceneProcess")
            bvpl_octree_batch.set_input_string(0, job.input_scene_path)
            bvpl_octree_batch.run_process()
            (scene_id, scene_type) = bvpl_octree_batch.commit_output(0)
            scene = dbvalue(scene_id, scene_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, job.output_scene_path)
            bvpl_octree_batch.set_input_unsigned(2, 0)
            bvpl_octree_batch.set_input_unsigned(3, 1)
            bvpl_octree_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();    
            
            print("Creating a Scene");
            bvpl_octree_batch.init_process("boxmCreateSceneProcess");
            bvpl_octree_batch.set_input_string(0, job.input_scene_path);
            bvpl_octree_batch.run_process();
            (scene_id, scene_type) = bvpl_octree_batch.commit_output(0);
            scene= dbvalue(scene_id, scene_type);
            
            #Use the save scene in bvxm because boxm rounds to bytes and doesn't work for negative values
#
#            print("Save Scene");
#            bvpl_octree_batch.init_process("boxmSaveOccupancyRawProcess");
#            bvpl_octree_batch.set_input_from_db(0,scene);
#            bvpl_octree_batch.set_input_string(1, job.output_scene_path);
#            bvpl_octree_batch.set_input_unsigned(2,0);
#            bvpl_octree_batch.set_input_unsigned(3,1);
#            bvpl_octree_batch.run_process();
            
            resolution = 0;
            enforce_level = 1;

            print("Convert to regular grid");
            bvpl_octree_batch.init_process("boxmSceneToBvxmGridProcess");
            bvpl_octree_batch.set_input_from_db(0,scene);
            bvpl_octree_batch.set_input_string(1, job.output_scene_path + ".vox");
            bvpl_octree_batch.set_input_unsigned(2, resolution);
            bvpl_octree_batch.set_input_bool(3, enforce_level);
            bvpl_octree_batch.run_process();
            (grid_id, grid_type) = bvpl_octree_batch.commit_output(0);
            grid = dbvalue(grid_id, grid_type);

            print("Save Grid");
            bvpl_octree_batch.init_process("bvxmSaveGridRawProcess");
            bvpl_octree_batch.set_input_from_db(0,grid);
            bvpl_octree_batch.set_input_string(1,job.output_scene_path);
            bvpl_octree_batch.run_process();
            
            print ("Runing time for worker:", self.name)
            print(time.time() - start_time);
示例#4
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("Creating a Scene")
            batch.init_process("boxmCreateSceneProcess")
            batch.set_input_string(0, job.input_scene_path)
            batch.run_process()
            (scene_id, scene_type) = batch.commit_output(0)
            scene = dbvalue(scene_id, scene_type)

            print("Save Scene")
            batch.init_process("boxmSaveSceneRawProcess")
            batch.set_input_from_db(0, scene)
            batch.set_input_string(
                1, job.output_scene_path + "_float")
            batch.set_input_unsigned(2, 0)
            batch.set_input_unsigned(3, 1)
            batch.run_process()

#            resolution = 0;
#            enforce_level = 1;

#            print("Convert to regular grid");
#            batch.init_process("boxmSceneToBvxmGridProcess");
#            batch.set_input_from_db(0,scene);
#            batch.set_input_string(1, job.output_scene_path + ".vox");
#            batch.set_input_unsigned(2, resolution);
#            batch.set_input_bool(3, enforce_level);
#            batch.run_process();
#            (grid_id, grid_type) = batch.commit_output(0);
#            grid = dbvalue(grid_id, grid_type);
#
#            print("Save Grid");
#            batch.init_process("bvxmSaveGridRawProcess");
#            batch.set_input_from_db(0,grid);
#            batch.set_input_string(1,job.output_scene_path + ".raw");
#            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();
            
            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);
    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("bvplInitGlobalPCAProcess");
            bvpl_octree_batch.set_input_string(0,job.pca_dir);
            bvpl_octree_batch.set_input_unsigned(1, job.scene_id);
            bvpl_octree_batch.run_process();
            
            bvpl_octree_batch.clear();

 
            print ("Runing time for worker:", self.name)
            print(time.time() - start_time);
示例#7
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("Computing Error Scene")
            batch.init_process("bvplComputePCAErrorBlockProcess")
            batch.set_input_from_db(0, job.pca_info)
            batch.set_input_from_db(1, job.pca_error_scenes)
            batch.set_input_int(2, job.block_i)
            batch.set_input_int(3, job.block_j)
            batch.set_input_int(4, job.block_k)
            batch.set_input_unsigned(5, job.dim)
            batch.run_process()

            print("Runing time for worker:", self.name)
            print(time.time() - start_time)
示例#8
0
        sys.exit(-1)

    print("Loading Data 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)
    data_scene = dbvalue(scene_id, scene_type)

    # Load pca scenes
    pca_feature_dim = 125
    print("Loading PCA Error Scenes")
    batch.init_process("bvplLoadPCAErrorSceneProcess")
    batch.set_input_from_db(0, data_scene)
    batch.set_input_string(1, pca_dir)
    batch.set_input_unsigned(
        2, pca_feature_dim)  # dimension pca feature
    batch.run_process()
    (id, type) = batch.commit_output(0)
    pca_scenes = dbvalue(id, type)

    print("Loading PCA Info")
    batch.init_process("bvplLoadPCAInfoProcess")
    batch.set_input_string(0, pca_dir)
    batch.run_process()
    (id, type) = batch.commit_output(0)
    pca_info = dbvalue(id, type)

    # Begin multiprocessing
    work_queue = multiprocessing.Queue()
    job_list = []

  print("Loading Data 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);
  data_scene= dbvalue(scene_id, scene_type);

  #Load pca scenes
  pca_feature_dim = 125;
  print("Loading PCA Error Scenes");
  bvpl_octree_batch.init_process("bvplLoadPCAErrorSceneProcess");
  bvpl_octree_batch.set_input_from_db(0, data_scene);
  bvpl_octree_batch.set_input_string(1, pca_dir);
  bvpl_octree_batch.set_input_unsigned(2, pca_feature_dim); #dimension pca feature
  bvpl_octree_batch.run_process();
  (id, type) = bvpl_octree_batch.commit_output(0);
  pca_scenes = dbvalue(id, type);


  print("Loading PCA Info");
  bvpl_octree_batch.init_process("bvplLoadPCAInfoProcess");
  bvpl_octree_batch.set_input_string(0, pca_dir);
  bvpl_octree_batch.run_process();
  (id, type) = bvpl_octree_batch.commit_output(0);
  pca_info = dbvalue(id, type);

  #Begin multiprocessing
  work_queue=multiprocessing.Queue();
  job_list=[];
                              
        results = execute_jobs(job_list, num_cores);
        print results;
        
        print("Creating a Scene");
        bvpl_octree_batch.init_process("boxmCreateSceneProcess");
        bvpl_octree_batch.set_input_string(0,  output_dirs[scene_id] +"/float_response_scene.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, output_dirs[scene_id] + "/drishti/gauss_scene");
        bvpl_octree_batch.set_input_unsigned(2,0);
        bvpl_octree_batch.set_input_unsigned(3,1);
        bvpl_octree_batch.run_process();



  print ("Total running time: ");
  print(time.time() - start_time);
    

  



  
  
示例#11
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();
  (out_scene_id,out_scene_type)= bvpl_octree_batch.commit_output(0);
  result_scene = dbvalue(out_scene_id,out_scene_type);

  resolution = 0;
  enforce_level = 1;

  print("Convert to regular grid");
  bvpl_octree_batch.init_process("boxmSceneToBvxmGridProcess");
  bvpl_octree_batch.set_input_from_db(0,result_scene);
  bvpl_octree_batch.set_input_string(1, output_dir + "/response.vox");
  bvpl_octree_batch.set_input_unsigned(2, resolution);
  bvpl_octree_batch.set_input_bool(3, enforce_level);
  bvpl_octree_batch.run_process();
  (grid_id, grid_type) = bvpl_octree_batch.commit_output(0);
  grid = dbvalue(grid_id, grid_type);

  print("Save Grid");
  bvpl_octree_batch.init_process("bvxmSaveGridRawProcess");
  bvpl_octree_batch.set_input_from_db(0,grid);
  bvpl_octree_batch.set_input_string(1,output_dir + "/response.raw");
  bvpl_octree_batch.run_process();
示例#12
0
    self.type = type   # string


model_dir = "/Users/isa/Experiments/Synthetic";
output_dir = "/Users/isa/Experiments/Synthetic/edge3d";


print("Creating a Scene");
bvpl_octree_batch.init_process("bvplCreateSceneProcess");
bvpl_octree_batch.set_input_string(0,  output_dir +"/response_scene.xml");
bvpl_octree_batch.run_process();
(scene_id, scene_type) = bvpl_octree_batch.commit_output(0);
scene= dbvalue(scene_id, scene_type);

print("*************************************");
print("Creating 3D edge kernel");
bvpl_octree_batch.init_process("bvplCreateEdge3dKernelVectorProcess");
bvpl_octree_batch.set_input_unsigned(0,3);
bvpl_octree_batch.set_input_unsigned(1,3);
bvpl_octree_batch.set_input_unsigned(2,3);
bvpl_octree_batch.run_process();
(kernel_id,kernel_type)= bvpl_octree_batch.commit_output(0);
kernel_vector = dbvalue(kernel_id,kernel_type);


print("Writing World");
bvpl_octree_batch.init_process("bvplSaveVrmlProcess");
bvpl_octree_batch.set_input_from_db(0,scene);
bvpl_octree_batch.set_input_from_db(1,kernel_vector);
bvpl_octree_batch.set_input_string(2, output_dir +"/result_scene.wrl");
bvpl_octree_batch.run_process();
示例#13
0
        sys.exit(-1)

    print("Loading Data 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)
    data_scene = dbvalue(scene_id, scene_type)

    #Load pca scenes
    pca_feature_dim = 125
    print("Loading PCA Error Scenes")
    bvpl_octree_batch.init_process("bvplLoadPCAErrorSceneProcess")
    bvpl_octree_batch.set_input_from_db(0, data_scene)
    bvpl_octree_batch.set_input_string(1, pca_dir)
    bvpl_octree_batch.set_input_unsigned(2, pca_feature_dim)
    #dimension pca feature
    bvpl_octree_batch.run_process()
    (id, type) = bvpl_octree_batch.commit_output(0)
    pca_scenes = dbvalue(id, type)

    print("Loading PCA Info")
    bvpl_octree_batch.init_process("bvplLoadPCAInfoProcess")
    bvpl_octree_batch.set_input_string(0, pca_dir)
    bvpl_octree_batch.run_process()
    (id, type) = bvpl_octree_batch.commit_output(0)
    pca_info = dbvalue(id, type)

    #Begin multiprocessing
    work_queue = multiprocessing.Queue()
    job_list = []
示例#14
0
        sys.exit(-1)

    print("Loading Data 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)
    data_scene = dbvalue(scene_id, scene_type)

    # Load PCA scenes
    pca_feature_dim = 125
    print("Loading PCA Error Scenes")
    bvpl_octree_batch.init_process("bvplLoadPCAErrorSceneProcess")
    bvpl_octree_batch.set_input_from_db(0, data_scene)
    bvpl_octree_batch.set_input_string(1, pca_dir)
    bvpl_octree_batch.set_input_unsigned(
        2, pca_feature_dim)  # dimension pca feature
    bvpl_octree_batch.run_process()
    (id, type) = bvpl_octree_batch.commit_output(0)
    pca_scenes = dbvalue(id, type)

    # Begin multiprocessing
    # Enqueue jobs
    job_list = []
    # for dim in range(0, pca_feature_dim):
    for block_i in range(0, nblocks_x):
        for block_j in range(0, nblocks_y):
            for block_k in range(0, nblocks_z):
                current_job = pca_error_job(pca_scenes, dimension, fraction,
                                            block_i, block_j, block_k)
                job_list.append(current_job)