semiautomaticgit / SemiAutomaticClassificationPlugin

https://fromgistors.blogspot.com/p/semi-automatic-classification-plugin.html
Other
136 stars 50 forks source link

Python memory error during PCA #85

Closed AuSpotter closed 3 years ago

AuSpotter commented 4 years ago

I have a fairly strong computer, but am receiving a memory error when trying to run PCA on a four-channel raster image. The file is not very large (<300MB). Can anyone suggest what the problem here is?

File "C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\pcaTab.py", line 46, in calculatePCAAction self.calculatePCA() File "C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\pcaTab.py", line 97, in calculatePCA self.PCACalculation(rD, bL, outF, numbComp, None, batch) File "C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\pcaTab.py", line 146, in PCACalculation o = cfg.utls.processRaster(rD, bL, None, "No", cfg.utls.calculatePCABands, "PCA", oMR, None, None, 0, None, cfg.NoDataVal, "No", comp, cfg.bandSetsList[bandSetNumber][6], "No") File "C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\core\utils.py", line 3991, in processRaster o = functionRaster(gdalBandList, c, bSX, bSY, x, y, outputRasterList, functionBandArgument, functionVariable) File "C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\core\utils.py", line 4506, in calculatePCABands rArray = rasterArray * functionVariableList[0][b] + functionVariableList[1][b] - cfg.rasterPixelCountPCA["MEAN_BAND_" + str(b)] MemoryError: Unable to allocate array with shape (2500, 2500, 4) and data type float32

semiautomaticgit commented 4 years ago

Hello, did you increase the RAM value in Settings? https://semiautomaticclassificationmanual.readthedocs.io/en/latest/main_interface_window.html#settings

semiautomaticgit commented 3 years ago

I'm closing this because of the new version 7. If you still get the same issue, please reopen it