EnMAP-Box / enmap-box

EnMAP-Box source code repository. See https://enmap-box.readthedocs.io for documentation
GNU General Public License v3.0
35 stars 16 forks source link

ValueError: Found array with 0 sample(s) (shape = 0, 212) while a minimum of 1 is required by StandardScaler #550

Closed FReddig closed 11 months ago

FReddig commented 11 months ago

Hi,

I am struggling to execute a Spectral Unmixing in the EnMAP-Box. After inserting all the necessary data, I am getting the following error report:

QGIS version: 3.30.1-'s-Hertogenbosch QGIS code revision: 9035a01e Qt version: 5.15.3 Python version: 3.9.5 GDAL version: 3.6.3 GEOS version: 3.11.2-CAPI-1.17.2 PROJ version: Rel. 9.2.0, March 1st, 2023 PDAL version: 2.5.2 (git-version: 57c4e7) Algorithm started at: 2023-08-02T13:15:11 Algorithm 'Regression-based unmixing' starting… Input parameters: { 'allowWithinClassMixtures' : True, 'background' : 0, 'classProbabilities' : '', 'dataset' : 'C:/Users/Reddig/AppData/Local/Temp/processing_QGtXRX/0845ab74b16f4ed1b756776b3b5d64ff/outputClassificationDataset.pkl', 'ensembleSize' : 3, 'includeEndmember' : True, 'mixingProbabilities' : '0.4, 0.4, 0.2', 'n' : 1000, 'outputClassification' : 'Y:/CHILE23/Reddig/Spectral_library/ENDMEMBER_VALUES/FINALE/classification_layer.tif', 'outputFraction' : 'Y:/CHILE23/Reddig/Spectral_library/ENDMEMBER_VALUES/FINALE/class_fractional_layer.tif', 'outputFractionVariation' : 'Y:/CHILE23/Reddig/Spectral_library/ENDMEMBER_VALUES/FINALE/fraction_variation_layer.tif', 'raster' : 'Y:/CHILE23/Reddig/raw/enmap_export/enmap_oya_clipped.tif', 'regressor' : 'from sklearn.pipeline import make_pipeline\nfrom sklearn.preprocessing import StandardScaler\nfrom sklearn.linear_model import LinearRegression\n\nlinearRegression = LinearRegression()\nregressor = make_pipeline(StandardScaler(), linearRegression)', 'robustFusion' : False, 'sumToOne' : False }

Create ensemble Traceback (most recent call last): File "C:\Users\Reddig\AppData\Roaming\Python\Python39\site-packages\typeguard__init__.py", line 1033, in wrapper retval = func(*args, *kwargs) File "C:\Users/Reddig/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\enmapboxprocessing\algorithm\predictregressionalgorithm.py", line 96, in processAlgorithm y = dump.regressor.predict(np.transpose(X)) File "C:\Users\Reddig\AppData\Roaming\Python\Python39\site-packages\sklearn\pipeline.py", line 480, in predict Xt = transform.transform(Xt) File "C:\Users\Reddig\AppData\Roaming\Python\Python39\site-packages\sklearn\utils_set_output.py", line 140, in wrapped data_to_wrap = f(self, X, args, kwargs) File "C:\Users\Reddig\AppData\Roaming\Python\Python39\site-packages\sklearn\preprocessing_data.py", line 992, in transform X = self._validate_data( File "C:\Users\Reddig\AppData\Roaming\Python\Python39\site-packages\sklearn\base.py", line 565, in _validate_data X = check_array(X, input_name="X", check_params) File "C:\Users\Reddig\AppData\Roaming\Python\Python39\site-packages\sklearn\utils\validation.py", line 931, in check_array raise ValueError( ValueError: Found array with 0 sample(s) (shape=(0, 212)) while a minimum of 1 is required by StandardScaler.

Execution failed after 2.49 seconds

Loading resulting layers Algorithm 'Regression-based unmixing' finished

I really don't know what I am doing wrong. If you need additional information, I will deliver them instantly, since I dont know which information are needed to understand this problem.

Thank you for your help! Fabian

janzandr commented 11 months ago

Please share your input data (or a small subset), which can be used to reproduce the error.

FReddig commented 11 months ago

Yes of course, can I send you the link to a drive folder as PN?

janzandr commented 11 months ago

Sure andreas.janz@geo.hu-berlin.de

janzandr commented 11 months ago

The image that you want to unmix includes bad bands. You have to remove those first. image

FReddig commented 11 months ago

It worked, thank you so much!