Esempio n. 1
0
 def row_to_features(self, img, row):
     labels = list()
     features = list()
     for roof in row.roofs:
         labels.append(type_dict[roof['type']])
         roof_patch = utils.crop_from_center(img, roof['x'], roof['y'])
         features.append(utils.color_feat(roof_patch))
     return labels, features
Esempio n. 2
0
 def get_threshold_features(self, img, template, thres, roof_classifier):
     moments = self.detect_objects(img, template, thres)
     num_obj = moments.shape[0]
     if num_obj == 0:
         return num_obj, 0
     else:
         #Get classfication scores
         patches = [utils.crop_from_center(img, x, y) for x, y in zip(moments['x'], moments['y'])]
         #Probabilities of being iron
         scores = [roof_classifier.image_to_features(patch)[0][1] for patch in patches]
         mean_sc = np.mean(scores)
         return num_obj, mean_sc