def __init__(self, haar_filters, data, labels, num_chosen_wc, num_bins,
                 visualizer, num_cores, style, save_dir):
        self.filters = haar_filters
        self.data = data
        self.labels = labels
        self.num_chosen_wc = num_chosen_wc
        self.num_bins = num_bins
        self.visualizer = visualizer
        self.num_cores = num_cores
        self.style = style
        self.chosen_wcs = None
        if style == 'Ada':
            self.weak_classifiers = [Ada_Weak_Classifier(i, filt[0], filt[1], self.num_bins) \
                                     for i, filt in enumerate(self.filters)]
        elif style == 'Real':
            if save_dir is not None and os.path.exists(save_dir):
                print(
                    '[Loading chosen weak classifiers from Adaboost, %s loading...]'
                    % save_dir)
                self.load_trained_wcs(save_dir)
            else:
                print("Chosen classifiers not found")
                return

            self.chosen_classifiers_from_AB = np.array(self.chosen_wcs)[:, 1]

            self.weak_classifiers = [
                Real_Weak_Classifier(
                    i, self.chosen_classifiers_from_AB[i].plus_rects,
                    self.chosen_classifiers_from_AB[i].minus_rects,
                    self.num_bins)
                for i in range(len(self.chosen_classifiers_from_AB))
            ]
 def __init__(self, haar_filters, data, labels, num_chosen_wc, num_bins,
              visualizer, num_cores, style):
     self.filters = haar_filters
     self.data = data
     self.labels = labels
     self.num_chosen_wc = num_chosen_wc
     self.num_bins = num_bins
     self.visualizer = visualizer
     self.num_cores = num_cores
     self.style = style
     self.chosen_wcs = []
     if style == 'Ada':
         self.weak_classifiers = [Ada_Weak_Classifier(i, filt[0], filt[1], self.num_bins)\
                                  for i, filt in enumerate(self.filters)]
     elif style == 'Real':
         self.weak_classifiers = [Real_Weak_Classifier(i, filt[0], filt[1], self.num_bins)\
                                  for i, filt in enumerate(self.filters)]