コード例 #1
0
ファイル: save_pca_raw.py プロジェクト: Skylion007/vxl
    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)
コード例 #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)
コード例 #3
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.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);
コード例 #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");
            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 + "_float");
            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 + ".raw");
#            bvpl_octree_batch.run_process();
            
            print ("Runing time for worker:", self.name)
            print(time.time() - start_time);
コード例 #5
0
ファイル: save_taylor_raw.py プロジェクト: mrceresa/vxl_dev
    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 + "_float")
            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 + ".raw");
            #            bvpl_octree_batch.run_process();

            print("Runing time for worker:", self.name)
            print(time.time() - start_time)
コード例 #6
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 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);
コード例 #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();
            
            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);
コード例 #8
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 taylor kernel")
            bvpl_octree_batch.init_process("bvplLoadTaylorKernelProcess")
            bvpl_octree_batch.set_input_string(0, job.kernel_path)
            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.run_process()

            print("Runing time for worker:", self.name)
            print(time.time() - start_time)
コード例 #9
0
ファイル: taylor_kernel_threads.py プロジェクト: thewtex/vxl
    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 taylor kernel")
            batch.init_process("bvplLoadTaylorKernelProcess")
            batch.set_input_string(0, job.kernel_path)
            batch.run_process()
            (kernel_id, kernel_type) = batch.commit_output(0)
            kernel = dbvalue(kernel_id, kernel_type)

            print("Running Kernel")
            batch.init_process("bvplBlockKernelOperatorProcess")
            batch.set_input_from_db(0, job.scene)
            batch.set_input_from_db(1, kernel)
            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_string(5, "algebraic")
            batch.set_input_string(6, job.output_path)
            batch.run_process()

            print ("Runing time for worker:", self.name)
            print(time.time() - start_time)
コード例 #10
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.init_process("bvplPCAGlobalStatisticsProcess")
            bvpl_octree_batch.set_input_from_db(0, job.global_pca)
            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_string(5, job.file_out)
            bvpl_octree_batch.run_process()

            bvpl_octree_batch.clear()

            print ("Runing time for worker:", self.name)
            print (time.time() - start_time)
コード例 #11
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.scene_path );
            bvpl_octree_batch.run_process();
            (scene_id, scene_type) = bvpl_octree_batch.commit_output(0);
            scene= dbvalue(scene_id, scene_type);
  
            print("Explore Histogram");
            bvpl_octree_batch.init_process("bvplSceneHistorgramProcess");
            bvpl_octree_batch.set_input_from_db(0,scene);
            bvpl_octree_batch.run_process();
 
            print ("Runing time for worker:", self.name)
            print(time.time() - start_time);
コード例 #12
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.scene_path)
            batch.run_process()
            (scene_id, scene_type) = batch.commit_output(0)
            scene = dbvalue(scene_id, scene_type)

            print("Explore Histogram")
            batch.init_process("bvplSceneHistorgramProcess")
            batch.set_input_from_db(0, scene)
            batch.run_process()

            print("Runing time for worker:", self.name)
            print(time.time() - start_time)
コード例 #13
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);
コード例 #14
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.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);
コード例 #15
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.init_process("bvplCombinePairwiseStatisticsProcess");
            bvpl_octree_batch.set_input_string(0,job.stats_file1);
            bvpl_octree_batch.set_input_string(1,job.stats_file2);
            bvpl_octree_batch.set_input_string(2,job.stats_file_out);
            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);
コード例 #16
0
    #Parse inputs
    parser = optparse.OptionParser(description='Compute PCA basis')

    parser.add_option('--pca_dir', action="store", dest="pca_dir")
    parser.add_option('--train_fraction',
                      action="store",
                      dest="train_fraction",
                      type="float",
                      default=0.0)
    options, args = parser.parse_args()

    pca_dir = options.pca_dir
    train_fraction = (options.train_fraction) / 10

    if not os.path.isdir(pca_dir + "/"):
        os.makedirs(pca_dir + "/")

    pca_dir = pca_dir + "/" + str(int(train_fraction * 100))
    if not os.path.isdir(pca_dir + "/"):
        os.makedirs(pca_dir + "/")

    start_time = time.time()

    bvpl_octree_batch.init_process("bvplNormalizePCATrainingErrorProcess")
    bvpl_octree_batch.set_input_string(0, pca_dir)
    bvpl_octree_batch.run_process()

    print("Runing time for bvplNormalizePCATrainingErrorProcess:")
    print(time.time() - start_time)
コード例 #17
0
  
  #a list to keep the dimension (#of blocks) of each scene
  scene_blocks =[];
  
  parse_pca_info(pca_info_file, scene_blocks);
  
  print "Scene Blocks:"
  print scene_blocks

  
  #Begin multiprocessing
 
  start_time = time.time();

  bvpl_octree_batch.init_process("bvplLoadGlobalPCA125Process");
  bvpl_octree_batch.set_input_string(0,pca_dir);
  bvpl_octree_batch.run_process();
  (id, type) = bvpl_octree_batch.commit_output(0);
  global_pca = dbvalue(id, type);
  
  #Enqueue jobs
  i = 0;
  #for s_idx in range (1, len(scene_blocks)):
  for s_idx in [4,5,8,10,11,14,17]:
      job_list=[];
      nblocks = scene_blocks[s_idx];
      for block_i in range (0, nblocks[1]):
          for block_j in range (0, nblocks[2]):
              for block_k in range (0, nblocks[3]):
                  current_job = pca_project_job(global_pca, s_idx, block_i, block_j, block_k);
                  job_list.append(current_job);
コード例 #18
0
 #scene2 = CapitolBOXMSmall
 scene_blocks.append([2,1,1,1]);
 
 #Enqueue jobs
 i = 0;
 for s_idx in range (0, len(scene_blocks)):
     nblocks = scene_blocks[s_idx];
     for block_i in range (0, nblocks[1]):
         for block_j in range (0, nblocks[2]):
             for block_k in range (0, nblocks[3]):
 
                 file_out = temp_results_dir + "/stats_pass_0_" + str(i) + ".txt";
                 idx = scene_blocks[i];
                 
                 bvpl_octree_batch.init_process("bvplPCAGlobalStatisticsProcess");
                 bvpl_octree_batch.set_input_string(0,pca_dir);
                 bvpl_octree_batch.set_input_int(1,s_idx);
                 bvpl_octree_batch.set_input_int(2,block_i);
                 bvpl_octree_batch.set_input_int(3,block_j);
                 bvpl_octree_batch.set_input_int(4,block_k);
                 bvpl_octree_batch.set_input_string(5, file_out);
                 bvpl_octree_batch.run_process();
                 
                 i=i+1;
 
              
 nfiles_prev_pass = i;
 #Number of leyers in the binary (pairing) tree
 nlevels = int(ceil(log(nfiles_prev_pass)/log(2)))
   
 print (" Number of levels to process: " + str(nlevels))
コード例 #19
0
  scene_blocks.append([1,1,1,1]);
  
  #Begin multiprocessing
  work_queue=multiprocessing.Queue();
  job_list=[];
  num_cores = 1;


  #Enqueue jobs
  i = 0;
  for s_idx in range (0, len(scene_blocks)):
      nblocks = scene_blocks[s_idx];
      for block_i in range (0, nblocks[1]):
          for block_j in range (0, nblocks[2]):
              for block_k in range (0, nblocks[3]):
  
                  file_out = temp_results_dir + "/stats_pass_0_" + str(i) + ".txt";
                  idx = scene_blocks[i];
                  
                  bvpl_octree_batch.init_process("bvplPCAGlobalStatisticsProcess");
                  bvpl_octree_batch.set_input_string(0,pca_dir);
                  bvpl_octree_batch.set_input_int(1,s_idx);
                  bvpl_octree_batch.set_input_int(2,block_i);
                  bvpl_octree_batch.set_input_int(3,block_j);
                  bvpl_octree_batch.set_input_int(4,block_k);
                  bvpl_octree_batch.set_input_string(5, file_out);
                  bvpl_octree_batch.run_process();
                  
                  i=i+1;
                  
    
コード例 #20
0
ファイル: add_taylor_error.py プロジェクト: Skylion007/vxl
    nblocks_y = options.nblocks_y
    nblocks_z = options.nblocks_z
    num_cores = options.num_cores
    fraction = options.fraction

    if not os.path.isdir(model_dir + "/"):
        print "Invalid Model Dir"
        sys.exit(-1)

    if not os.path.isdir(taylor_dir + "/"):
        print "Invalid Taylor Dir"
        sys.exit(-1)

    print("Loading Error Scene")
    bvpl_octree_batch.init_process("boxmCreateSceneProcess")
    bvpl_octree_batch.set_input_string(0,  taylor_dir + "/error_scene.xml")
    bvpl_octree_batch.run_process()
    (scene_id, scene_type) = bvpl_octree_batch.commit_output(0)
    error_scene = dbvalue(scene_id, scene_type)

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

    blocks_x = [i for i in range(0, nblocks_x)]
    blocks_y = [i for i in range(0, nblocks_y)]
    blocks_z = [i for i in range(0, nblocks_z)]

    random.shuffle(blocks_x)
    random.shuffle(blocks_y)
    random.shuffle(blocks_y)
コード例 #21
0
    nblocks_y = options.nblocks_y
    nblocks_z = options.nblocks_z
    num_cores = options.num_cores
    dimension = options.dimension

    if not os.path.isdir(model_dir + "/"):
        print "Invalid Model Dir"
        sys.exit(-1)

    if not os.path.isdir(pca_dir + "/"):
        print "Invalid PCA Dir"
        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)
コード例 #22
0
  aux_scene_dir = options.aux_scene_dir;


  temp_results_dir = taylor_dir + "/temp";

  if not os.path.isdir(taylor_dir +"/"):
    print "Invalid taylor Dir"
    sys.exit(-1);
  
  start_time = time.time();
   
  scene_id = 9;
  component = 3;
   
  bvpl_octree_batch.init_process("bvplExploreCoefficientSceneProcess");
  bvpl_octree_batch.set_input_string(0,taylor_dir);
  bvpl_octree_batch.set_input_int(1,scene_id);  #scene id
  bvpl_octree_batch.set_input_int(2,component);  #component
  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, aux_scene_dir + "/scene" + str(scene_id) + "coeff" + str(component));
  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: ");
コード例 #23
0

  #Enqueue jobs
  if(len(model_dirs)==len(output_dirs)==len(lengths)==len(scene_blocks) ):
      
    for scene_id in range (14, len(scene_blocks)):
        
        if not os.path.isdir(output_dirs[scene_id] +"/"):
            os.mkdir(output_dirs[scene_id] +"/");
            
        if not os.path.isdir(output_dirs[scene_id] +"/drishti/"):
            os.mkdir(output_dirs[scene_id] +"/drishti/");
        
        print("Creating a Scene");
        bvpl_octree_batch.init_process("boxmCreateSceneProcess");
        bvpl_octree_batch.set_input_string(0,  model_dirs[scene_id]);
        bvpl_octree_batch.run_process();
        (id, type) = bvpl_octree_batch.commit_output(0);
        scene= dbvalue(id, type);
         
        nblocks = scene_blocks[scene_id];
        print nblocks;
        for block_i in range (0, nblocks[1]):
            for block_j in range (0, nblocks[2]):
                for block_k in range (0, nblocks[3]):
                    current_job = gauss_job(scene, kernel , block_i, block_j, block_k, output_dirs[scene_id], lengths[scene_id]);
                    job_list.append(current_job);
                    
                              
        results = execute_jobs(job_list, num_cores);
        print results;
コード例 #24
0
  scene_in = "/Users/isa/Experiments/BOF/helicopter_providence/harris_test/aux_dirs/site22/valid_scene_13.xml";
  path_out = "/Users/isa/Experiments/BOF/helicopter_providence/harris_test/aux_dirs/site22"
  
#  scene_in = "/Users/isa/Experiments/BOF/helicopter_providence/harris_test/aux_dirs/site22/harris_scene.xml";
#  path_out = "/Users/isa/Experiments/BOF/helicopter_providence/harris_test/aux_dirs/site22"
  
  
  if not os.path.isdir(path_out +"/drishti/"):
    os.mkdir(path_out + "/drishti/");
  
  start_time = time.time();
  
  print("Creating a Scene");
  bvpl_octree_batch.init_process("boxmCreateSceneProcess");
  bvpl_octree_batch.set_input_string(0, scene_in);
  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_out + "/drishti/valid_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);
コード例 #25
0
ファイル: add_taylor_error.py プロジェクト: yochju/vxl
    nblocks_y = options.nblocks_y
    nblocks_z = options.nblocks_z
    num_cores = options.num_cores
    fraction = options.fraction

    if not os.path.isdir(model_dir + "/"):
        print "Invalid Model Dir"
        sys.exit(-1)

    if not os.path.isdir(taylor_dir + "/"):
        print "Invalid Taylor Dir"
        sys.exit(-1)

    print("Loading Error Scene")
    batch.init_process("boxmCreateSceneProcess")
    batch.set_input_string(0, taylor_dir + "/error_scene.xml")
    batch.run_process()
    (scene_id, scene_type) = batch.commit_output(0)
    error_scene = dbvalue(scene_id, scene_type)

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

    blocks_x = [i for i in range(0, nblocks_x)]
    blocks_y = [i for i in range(0, nblocks_y)]
    blocks_z = [i for i in range(0, nblocks_z)]

    random.shuffle(blocks_x)
    random.shuffle(blocks_y)
    random.shuffle(blocks_y)
コード例 #26
0
    nblocks_y = options.nblocks_y
    nblocks_z = options.nblocks_z
    num_cores = options.num_cores
    fraction = options.fraction

    if not os.path.isdir(model_dir + "/"):
        print "Invalid Model Dir"
        sys.exit(-1)

    if not os.path.isdir(taylor_dir + "/"):
        print "Invalid Taylor Dir"
        sys.exit(-1)

    print("Loading Error Scene")
    bvpl_octree_batch.init_process("boxmCreateSceneProcess")
    bvpl_octree_batch.set_input_string(0, taylor_dir + "/error_scene.xml")
    bvpl_octree_batch.run_process()
    (scene_id, scene_type) = bvpl_octree_batch.commit_output(0)
    error_scene = dbvalue(scene_id, scene_type)

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

    blocks_x = [i for i in range(0, nblocks_x)]
    blocks_y = [i for i in range(0, nblocks_y)]
    blocks_z = [i for i in range(0, nblocks_z)]

    random.shuffle(blocks_x)
    random.shuffle(blocks_y)
    random.shuffle(blocks_y)
コード例 #27
0
    batch.register_processes()
    batch.register_datatypes()

    # Parse inputs
    parser = optparse.OptionParser(description='Compute PCA basis')

    parser.add_option('--pca_dir', action="store", dest="pca_dir")
    parser.add_option('--train_fraction', action="store",
                      dest="train_fraction", type="float", default=0.0)
    options, args = parser.parse_args()

    pca_dir = options.pca_dir
    train_fraction = (options.train_fraction) / 10

    if not os.path.isdir(pca_dir + "/"):
        os.makedirs(pca_dir + "/")

    pca_dir = pca_dir + "/" + str(int(train_fraction * 100))
    if not os.path.isdir(pca_dir + "/"):
        os.makedirs(pca_dir + "/")

    start_time = time.time()

    batch.init_process("bvplNormalizePCATrainingErrorProcess")
    batch.set_input_string(0,  pca_dir)
    batch.run_process()

    print ("Runing time for bvplNormalizePCATrainingErrorProcess:")
    print(time.time() - start_time)
コード例 #28
0
    nblocks_x = options.nblocks_x
    nblocks_y = options.nblocks_y
    nblocks_z = options.nblocks_z
    num_cores = options.num_cores

    if not os.path.isdir(model_dir + "/"):
        print "Invalid Model Dir"
        sys.exit(-1)

    if not os.path.isdir(taylor_dir + "/"):
        print "Invalid Taylor Dir"
        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 taylor scenes
    print("Loading Taylor Scenes")
    bvpl_octree_batch.init_process("bvplLoadTaylorScenesProcess")
    bvpl_octree_batch.set_input_string(0, taylor_dir)
    bvpl_octree_batch.set_input_int(1, -2)  # min and max points of the kernel
    bvpl_octree_batch.set_input_int(2, -2)
    bvpl_octree_batch.set_input_int(3, -2)
    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.run_process()
コード例 #29
0
output_dirs = ["/Users/isa/Experiments/tests/gauss_x/x_alpha","/Users/isa/Experiments/tests/gauss_x/y_alpha","/Users/isa/Experiments/tests/gauss_x/z_alpha"];


sigma1 = 1;
sigma2 = 1;
sigma3 = 1;

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;

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

for i in range(1,len(output_dirs)) :

  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];
  
コード例 #30
0
  options, args = parser.parse_args();

  model_dir = options.model_dir;
  nblocks_x = options.nblocks_x;
  nblocks_y = options.nblocks_y;
  nblocks_z = options.nblocks_z;
  num_cores = options.num_cores;

  if not os.path.isdir(model_dir +"/"):
      print "Invalid Model Dir"
      sys.exit(-1);


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

  #Begin multiprocessing
  t1=time.time();
  job_list=[];


  blocks_x = [i for i in range(0,nblocks_x)];
  blocks_y = [i for i in range(0,nblocks_y)];
  blocks_z = [i for i in range(0,nblocks_z)];
  
  random.shuffle(blocks_x);
  random.shuffle(blocks_y);
コード例 #31
0
  nblocks_z = options.nblocks_z;
  num_cores = options.num_cores;
  dimension = options.dimension;

  if not os.path.isdir(model_dir +"/"):
      print "Invalid Model Dir";
      sys.exit(-1);

  if not os.path.isdir(pca_dir +"/"):
      print "Invalid PCA Dir";
      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);
コード例 #32
0
min_x = -1;
max_x = 0;
min_y = 0;
max_y = 0;
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;

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

for i in range(0,len(output_dirs)) :

  output_dir = output_dirs[i];
  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");
コード例 #33
0
ファイル: add_taylor_error.py プロジェクト: thewtex/vxl
    nblocks_y = options.nblocks_y
    nblocks_z = options.nblocks_z
    num_cores = options.num_cores
    fraction = options.fraction

    if not os.path.isdir(model_dir + "/"):
        print "Invalid Model Dir"
        sys.exit(-1)

    if not os.path.isdir(taylor_dir + "/"):
        print "Invalid Taylor Dir"
        sys.exit(-1)

    print("Loading Error Scene")
    batch.init_process("boxmCreateSceneProcess")
    batch.set_input_string(0,  taylor_dir + "/error_scene.xml")
    batch.run_process()
    (scene_id, scene_type) = batch.commit_output(0)
    error_scene = dbvalue(scene_id, scene_type)

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

    blocks_x = [i for i in range(0, nblocks_x)]
    blocks_y = [i for i in range(0, nblocks_y)]
    blocks_z = [i for i in range(0, nblocks_z)]

    random.shuffle(blocks_x)
    random.shuffle(blocks_y)
    random.shuffle(blocks_y)
コード例 #34
0
#model_dir = "/Users/isa/Experiments/helicopter_providence/boxm_scenes/site12"
#output_dir = "/Users/isa/Experiments/helicopter_providence/boxm_scenes/site12/steerable_filters_alpha";

model_dir="/Users/isa/Experiments/boxm_scili_full"
output_dir="/Users/isa/Experiments/boxm_scili_full/steerable_filters_alpha";

#model_dir = "/Users/isa/Experiments/boxm_cit_only_filtered"
#output_dir = "/Users/isa/Experiments/boxm_cit_only_filtered/steerable_filters_alpha";

if not os.path.isdir( output_dir + "/"):
    os.mkdir( output_dir + "/");

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

print("Init responses scene");
bvpl_octree_batch.init_process("bvplInitSFResponseSceneProcess");
bvpl_octree_batch.set_input_from_db(0, scene);
bvpl_octree_batch.set_input_string(1,  output_dir);
bvpl_octree_batch.run_process();
(scene_id, scene_type) = bvpl_octree_batch.commit_output(0);
response_scene= dbvalue(scene_id, scene_type);
(scene_id, scene_type) = bvpl_octree_batch.commit_output(1);
valid_scene= dbvalue(scene_id, scene_type);

print("Compute responses scene");
コード例 #35
0
kernel_list.append("I0");
kernel_list.append("Ix");
kernel_list.append("Iy");
kernel_list.append("Iz");
kernel_list.append("Ixx");
kernel_list.append("Iyy");
kernel_list.append("Izz");
kernel_list.append("Ixy");
kernel_list.append("Ixz");
kernel_list.append("Iyz");

blocks_x = 1; blocks_y = 1; blocks_z=1;

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()

#for curr_kernel in range(0, len(kernel_list)):
for curr_kernel in range(0, 1):
    #curr_kernel = 1;
    for i in range(0, blocks_x):
        for j in range(0, blocks_y):
            for k in range(0, blocks_z):
                curr_kernel_path = kernel_path + "/" + kernel_list[curr_kernel]+ ".txt";
                output_path = output_dir + "/" + kernel_list[curr_kernel];
                if not os.path.isdir( output_path + "/"):
コード例 #36
0
  temp_results_dir = pca_dir + "/temp";
  pca_info_file = pca_dir + "/pca_global_info.xml";

  if not os.path.isdir(pca_dir +"/"):
    print "Invalid PCA Dir"
    sys.exit(-1);
    
  if not os.path.isdir(temp_results_dir +"/"):
    print "Invalid temp Dir"
    sys.exit(-1);
  
  
  #Begin multiprocessing
  start_time = time.time();


  nfiles_pass0 = len(glob.glob1(temp_results_dir, 'stats_pass_0*'));
  
  #Number of leyers in the binary (pairing) tree
  nlevels = int(ceil(log(nfiles_pass0)/log(2)))
    
  final_stats_file = temp_results_dir + "/stats_pass_" + str(nlevels)+ "_0.txt";
  bvpl_octree_batch.init_process("bvplGlobalPCAProcess");
  bvpl_octree_batch.set_input_string(0,pca_dir);
  bvpl_octree_batch.set_input_string(1,final_stats_file);
  bvpl_octree_batch.run_process();

  print ("Total running time: ");
  print(time.time() - start_time);
    
コード例 #37
0
  print("**********Executing init_global_taylor.py **********")
  
  bvpl_octree_batch.register_processes();
  bvpl_octree_batch.register_datatypes();

  #Parse inputs
  parser = optparse.OptionParser(description='Init taylor');

  parser.add_option('--taylor_dir', action="store", dest="taylor_dir");
  parser.add_option('--dimension', action="store", dest="dimension", type ="int", default=10);

  options, args = parser.parse_args();

  taylor_dir = options.taylor_dir;
  dimension = options.dimension;

  temp_results_dir = taylor_dir + "/temp";

  if not os.path.isdir(taylor_dir +"/"):
    print "Invalid taylor Dir"
    sys.exit(-1);
  
  start_time = time.time();
   
  bvpl_octree_batch.init_process("bvplInitGlobalTaylorProcess");
  bvpl_octree_batch.set_input_string(0,taylor_dir);
  bvpl_octree_batch.set_input_int(1, dimension);
  bvpl_octree_batch.run_process();

  print ("Total running time: ");
  print(time.time() - start_time);
コード例 #38
0
    nblocks_x = options.nblocks_x
    nblocks_y = options.nblocks_y
    nblocks_z = options.nblocks_z
    num_cores = options.num_cores

    if not os.path.isdir(model_dir + "/"):
        print "Invalid Model Dir"
        sys.exit(-1)

    if not os.path.isdir(taylor_dir + "/"):
        print "Invalid Taylor Dir"
        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 taylor scenes
    print("Loading Taylor Scenes")
    bvpl_octree_batch.init_process("bvplLoadTaylorScenesProcess")
    bvpl_octree_batch.set_input_string(0, taylor_dir)
    bvpl_octree_batch.set_input_int(1, -2)  # min and max points of the kernel
    bvpl_octree_batch.set_input_int(2, -2)
    bvpl_octree_batch.set_input_int(3, -2)
    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.run_process()