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
def image_to_features(self, img): c_feat = utils.color_feat(img) #Iron thres_iron = np.linspace(0.3, 1.0, 14, endpoint=False) iron_feat = np.array([self.get_threshold_features(img, self.iron_temp, thres) for thres in thres_iron]) #Grass thres_grass = np.linspace(0.8, 1.0, 14, endpoint=False) grass_feat = np.array([self.get_threshold_features(img, self.grass_temp, thres) for thres in thres_grass]) #Total features features = np.concatenate([iron_feat, grass_feat, c_feat]).tolist() return features
def image_to_features(self, img): if self.roof_model is None: return np.zeros((80,)) c_feat = utils.color_feat(img) #Iron thres_iron = np.linspace(0.3, 1.0, 14, endpoint=False) iron_feat = np.array([self.get_threshold_features(img, self.iron_temp, thres, self.roof_model) for thres in thres_iron]) iron_feat = np.concatenate(np.transpose(iron_feat)) #Grass thres_grass = np.linspace(0.8, 1.0, 14, endpoint=False) grass_feat = np.array([self.get_threshold_features(img, self.grass_temp, thres, self.roof_model) for thres in thres_grass]) grass_feat = np.concatenate(np.transpose(grass_feat)) #Total features features = np.concatenate([iron_feat, grass_feat, c_feat]).tolist() return features
def image_to_features(self, img): features = utils.color_feat(img) return self.clf.predict_proba(features)