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

            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();
            
            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("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();
      #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("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()
Beispiel #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();
            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);
  #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();

        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"
    lowest_sse_file = k_means_dir + "/lowest_sse_means.txt"
    print "In Python output string: " + str(best_fm_file)

    shutil.copy(best_fm_file, lowest_sse_file)

    best_fm_info_file = FM_path + "/" + best_mean_file + ".xml"
    lowest_sse_info_file = k_means_dir + "/lowest_sse_means_info.xml"
    shutil.copy(best_fm_info_file, lowest_sse_info_file)