semiautomaticgit / SemiAutomaticClassificationPlugin

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

UnboundLocalError: local variable 'reml' referenced before assignment #27

Closed sebastianfrey closed 6 years ago

sebastianfrey commented 6 years ago

Hi,

When I use the accuracy functionality in the post processing menu of Semi-Automatic Classification Plugin, the following python error occurs:

Traceback (most recent call last):

File "C:/Users/user/.qgis2/python/plugins\SemiAutomaticClassificationPlugin\maininterface\accuracy.py", line 48, in calculateErrorMatrix
                self.errorMatrix(self.clssfctnNm, cfg.referenceLayer)

File "C:/Users/user/.qgis2/python/plugins\SemiAutomaticClassificationPlugin\maininterface\accuracy.py", line 123, in errorMatrix
                cfg.utls.removeLayerByLayer(reml)

UnboundLocalError: local variable 'reml' referenced before assignment

I have the following configuration running on my system:

QGIS 2.18.14 64bit Version Semi-Automatic Classification Plugin 5.3.11 - Kourou

Any ideas what might go wrong?

I attached a zip file, which contains the classified image and the corresponding training input.

Thank you very much in advance for your feedback.

semiautomaticgit commented 6 years ago

Hi, thank you for reporting this. It seems an issue with the .scp file. I'll try to fix this. In the meantime, if you export the .scp file as shapefile you should be able to perform the accuracy assessment.

sebastianfrey commented 6 years ago

Exporting the .scp file as shape did the trick. Thank your very much.

semiautomaticgit commented 6 years ago

You are very welcome

semiautomaticgit commented 6 years ago

It should be fixed in version 6. Please reopen this if you get the same error.

SurveyorSamuel commented 5 years ago

Still having the same problem pasted down here: An error has occurred while executing Python code: UnboundLocalError: local variable 'reml' referenced before assignment Traceback (most recent call last): File "C:/Users/Admin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\accuracy.py", line 124, in errorMatrix cfg.utls.repojectShapefile(l.source(), int(vEPSG), reprjShapefile, int(rEPSG)) ValueError: invalid literal for int() with base 10: 'No'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:/Users/Admin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\accuracy.py", line 48, in calculateErrorMatrix self.errorMatrix(self.clssfctnNm, cfg.referenceLayer) File "C:/Users/Admin/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\SemiAutomaticClassificationPlugin\maininterface\accuracy.py", line 127, in errorMatrix cfg.utls.removeLayerByLayer(reml) UnboundLocalError: local variable 'reml' referenced before assignment