semiautomaticgit / SemiAutomaticClassificationPlugin

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

AttributeError: 'str' object has no attribute 'dataProvider' #169

Closed van543 closed 9 months ago

van543 commented 3 years ago

Hi,

when i want to classify a Image with Random Forrest, i always become this error. Classifying with minimum distance is working. AttributeError: 'str' object has no attribute 'dataProvider'

AttributeError: 'str' object has no attribute 'dataProvider' Traceback (most recent call last): File "C:/Users/Vanessa/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\randomForestTab.py", line 224, in performRandomForest self.randomForestClassification(bandSetNumber = bs, classPath = cfg.classRF) File "C:/Users/Vanessa/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\randomForestTab.py", line 420, in randomForestClassification cfg.classTab.applyClassSymbology(r, macroclass, cfg.qmlFl, sL) File "C:/Users/Vanessa/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\classificationTab.py", line 280, in applyClassSymbology cfg.utls.rasterSymbol(classificationRaster, signatureList, macroclassCheck) File "C:/Users/Vanessa/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\core\utils.py", line 644, in rasterSymbol lR = cfg.qgisCoreSCP.QgsPalettedRasterRenderer(classLayer.dataProvider(), cLB, cL) AttributeError: 'str' object has no attribute 'dataProvider'

Python-Version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] QGIS-Version: 3.10.14-A Coruña A Coruña, 8374282d2a

semiautomaticgit commented 3 years ago

Hello, the error could be related to SNAP. Please copy the log file following these steps https://semiautomaticclassificationmanual.readthedocs.io/en/latest/faq.html#how-can-i-report-an-error

carlosgmv19 commented 3 years ago

I have the exact same problem and I can give you my log file, would be great if you could check it out Log1.txt

carlosgmv19 commented 3 years ago

I can always open a new issue tab if necessary, thanks for your time

semiautomaticgit commented 3 years ago

Thank you for the log file @carlosgmv19 . It seems that the error is on the SNAP side ('str' object has no attribute 'dataProvider' is because no output is created from Random Forest). Please check that the training input doesn't include ROIs created with the region growing algorithm (apparently SNAP doesn't use those polygons). Also you could check if launching Random Forest directly in SNAP works with the same input data.

vardhanindraganti commented 2 years ago

AttributeError: 'str' object has no attribute 'dataProvider' how to solve this error

vardhanindraganti commented 2 years ago

log file log file.txt

semiautomaticgit commented 2 years ago

AttributeError: 'str' object has no attribute 'dataProvider' how to solve this error

Please update the plugin. Also please check if SNAP software is correctly installed.

nicolas-aumercier commented 2 years ago

Hi Luca, First thanks for the plugin it'is very usefull !! I have usually the same error (str error) when I try to do a random forest classification. Today I have a new one... errorLog.txt When I follow and use the tutorial, it's working. So I assume that the snap software is correctly installed. It's more about the data I think. Do you have any idea to solve it ?

semiautomaticgit commented 2 years ago

Hi @nicolas-aumercier , you are very welcome. About your issue, please update the plugin to the latest version. Also, please check that the training input doesn't include ROIs created with the region growing algorithm, but only polygons that were drawn manually.

vardhanindraganti commented 2 years ago

After Random forest Classification The classified file showing only two Classifications Out of 6 i given classes for classification Please solve this problem

semiautomaticgit commented 9 months ago

I'm closing this because of the new version 8 of SCP. Please reopen it if it is still relevant in the new version. Thank you!