deephyp.data.HypImg

class deephyp.data.HypImg(spectralInput, labels=None, wavelengths=None, bands=None)[source]

Class for handling data. Stores meta-data and contains attributes for pre-processing the data. If passed labels, samples with label zero are considered as a background class. This class is not included in numClasses and data samples with this label have a one-hot vector label of all zeros.

Parameters:
  • spectralInput (np.array float) – Spectral dataset. Shape can be [numRows x numCols x numBands] or [numSamples x numBands].
  • wavelengths (np.array float) – Vector of wavelengths that spectralInput wavelengths lie within.
  • bands (np.array int) – Wavelength indexes for each band of spectralInput. Shape [numBands].
  • labels (np.array int) – Class labels for each spectral sample in spectralInput. Shape can be [numRows x numCols] or [numSamples].
spectra

Un-pre-processed spectral data with shape [numSamples x numBands].

Type:np.array float
spectraCube

If data passed as image - un-pre-processed spectral datacube with shape [numSamples x numBands]. Else None.

Type:np.array float
spectraPrep

Pre-processed spectral data with shape [numSamples x numBands].

Type:np.array float
numSamples

The number of spectra.

Type:int
numRows

If data passed as image - the number of image rows. Else None.

Type:int
numCols

If data passed as image - the number of image columns. Else None.

Type:int
wavelengths

If provided - vector of wavelengths that spectra wavelengths lie within. Else None.

Type:np.array float
bands

If provided - wavelength indexes for each band of spectra with shape [numBands]. Else None.

Type:np.array int
labels

If provided - class labels for each spectral sample with shape [numSamples]. Else None.

Type:np.array int
labelsOnehot

If labels provided - the one-hot label vector for each sample. Samples with label zero (background class) have a one-hot vector of all zeros. Else None.

Type:np.array int
pre_process(method='minmax')[source]

Pre-process data for input into the network. Stores in the spectraPrep attribute.

Parameters:method (str) – Method of pre-processing. Current options: ‘minmax’