Esempio n. 1
0
 def build_epoch(self, cut=False):
     """
     Perform Uniform Sampling per epoch to create a new list for training such that it
     uniformly samples all classes
     """
     if self.class_uniform_pct > 0:
         if self.is_additional:
             if cut:
                 # after max_cu_epoch, we only fine images to fine tune
                 self.imgs_uniform = uniform.build_epoch(self.imgs,
                                                         self.fine_centroids,
                                                         num_classes,
                                                         cfg.CLASS_UNIFORM_PCT_ADD)
             else:
                 self.imgs_uniform = uniform.build_epoch(self.imgs + self.aug_imgs,
                                                         self.centroids,
                                                         num_classes,
                                                         cfg.CLASS_UNIFORM_PCT_ADD)
         else:
             if cut:
                 # after max_cu_epoch, we only fine images to fine tune
                 self.imgs_uniform = uniform.build_epoch(self.imgs,
                                                         self.fine_centroids,
                                                         num_classes,
                                                         cfg.CLASS_UNIFORM_PCT)
             else:
                 self.imgs_uniform = uniform.build_epoch(self.imgs + self.aug_imgs,
                                                         self.centroids,
                                                         num_classes,
                                                         cfg.CLASS_UNIFORM_PCT)
     else:
         self.imgs_uniform = self.imgs
 def build_epoch(self, cut=False):
     if self.class_uniform_pct > 0:
         self.imgs_uniform1 = uniform.build_epoch(self.imgs1,
                                                  self.centroids1,
                                                  num_classes1,
                                                  cfg.CLASS_UNIFORM_PCT)
         self.imgs_uniform2 = uniform.build_epoch(self.imgs2,
                                                  self.centroids2,
                                                  num_classes2,
                                                  cfg.CLASS_UNIFORM_PCT)
     else:
         self.imgs_uniform1 = self.imgs1
         self.imgs_uniform2 = self.imgs2
Esempio n. 3
0
    def build_epoch(self, cut=False):

        if self.class_uniform_pct > 0:
            if cut:
                self.imgs_uniform = uniform.build_epoch(
                    self.imgs, self.fine_centroids, num_classes,
                    cfg.CLASS_UNIFORM_PCT)
            else:
                self.imgs_uniform = uniform.build_epoch(
                    self.imgs, self.centroids, num_classes,
                    cfg.CLASS_UNIFORM_PCT)
        else:
            self.imgs_uniform = self.imgs
Esempio n. 4
0
 def build_epoch(self):
     if self.class_uniform_pct != 0:
         self.imgs_uniform = uniform.build_epoch(self.imgs, self.centroids,
                                                 num_classes,
                                                 self.class_uniform_pct)
     else:
         self.imgs_uniform = self.imgs
 def build_epoch(self):
     """
     For class uniform sampling ... every epoch, we want to recompute
     which tiles from which images we want to sample from, so that the
     sampling is uniformly random.
     """
     self.imgs = uniform.build_epoch(self.all_imgs, self.centroids,
                                     self.num_classes, self.train)
Esempio n. 6
0
 def build_epoch(self):
     if self.uniform_sampling:
         self.data = uniform.build_epoch(self.all_data, self.records,
                                         self.num_classes, self.mode)
     elif self.filter_data:
         self.data = filter.build_epoch(self.all_data, self.records,
                                        self.num_classes, self.mode)
     else:
         pass