Commit a0127bf7 authored by Daniel Scheffler's avatar Daniel Scheffler
Browse files
parent 6ef40c33
Pipeline #4101 failed with stage
in 2 minutes and 12 seconds
......@@ -327,7 +327,7 @@ class kNN_SAM_Classifier(SAM_Classifier):
# type: (np.ndarray, int, Union[int, None]) -> None
super(kNN_SAM_Classifier, self).__init__(train_spectra, CPUs=CPUs)
self.clf_name = 'k-nearest neighbour spectral angle mapper (SAM)'
self.clf_name = 'k-nearest neighbour spectral angle mapper (SAM) - %d neighbors' % n_neighbors
self.n_neighbors = n_neighbors
def _predict(self, tilepos):
......@@ -337,8 +337,9 @@ class kNN_SAM_Classifier(SAM_Classifier):
tileimdata = global_shared_im2classify[rS: rE + 1, cS: cE + 1, :]
angles = self._calc_sam(tileimdata, global_shared_endmembers)
cmap = np.argpartition(angles, self.n_neighbors, axis=2)[:, :, :self.n_neighbors].astype(np.int16)
angles_min_k = np.partition(angles, self.n_neighbors, axis=2)[:, :, :self.n_neighbors].astype(np.float32)
k = self.n_neighbors if self.n_neighbors <= angles.shape[2] else angles.shape[2]
cmap = np.argpartition(angles, k, axis=2)[:, :, :k].astype(np.int16)
angles_min_k = np.partition(angles, k, axis=2)[:, :, :k].astype(np.float32)
if global_shared_im2classify.nodata is not None and self._cmap_nodataVal is not None:
cmap = self.overwrite_cmap_at_nodata_positions(cmap, tileimdata,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment