nkarasiak / dzetsaka Goto Github PK
View Code? Open in Web Editor NEWdzetsaka : classification plugin for Qgis
License: GNU General Public License v3.0
dzetsaka : classification plugin for Qgis
License: GNU General Public License v3.0
Hi all,
I'm using this classification tool on MacOS with QGIS3.1 and it worked well with the Gaussian, RF and KNN methods but it remains stuck always at 83% for the SVM classification.
I also tried with the samples but same issue...
Does anyone has the same issue ?
Thank you !
Trying to run random forest for qgis2 on osx with your plugin. Says it needs scikit-learn. Following instructions with pip I get
Requirement already satisfied: scikit-learn in ./anaconda2/lib/python2.7/site-packages
Yet the plugin doesn't recognize the installation.
I use Predict model (classification map)
algorithm in my model and noticed very strange behavior. Algorithm added to the model, connected to inputs. But when model executed, next step failed because output from Predict model (classification map)
algorithm does not passed correctly to the next algorithm.
Here is the model log execution log
Processing algorithm…
Algorithm 'test' starting…
Input parameters:
{ 'inputraster' : '/home/alex/datasets/test/raster.tif', 'dzetsakamodel' : '/home/alex/datasets/tree-inventory/RF-model.model', 'vectorzones' : '/home/alex/datasets/test/polygons.shp' }
Prepare algorithm: dzetsaka:Predict model (classification map)_1
Running Predict model (classification map) [1/2]
Input Parameters:
{ INPUT_MASK: , INPUT_MODEL: '/home/alex/datasets/tree-inventory/RF-model.model', INPUT_RASTER: '/home/alex/datasets/test/raster.tif', OUTPUT_RASTER: '/tmp/processing_8ecfcdea23904a36b83d2d6aeddfece2/caf41486cd744fd7b1212e0c35736a88/OUTPUT_RASTER.tif' }
OK. Execution took 23.972 s (1 outputs).
Prepare algorithm: qgis:zonalstatistics_1
Running Zonal statistics [2/2]
Input Parameters:
{ COLUMN_PREFIX: '_', INPUT_RASTER: None, INPUT_VECTOR: '/home/alex/datasets/test/polygons.shp', RASTER_BAND: 1, STATS: 9 }
Traceback (most recent call last):
File "/tmp/build/qgis/output/python/plugins/processing/algs/qgis/ZonalStatistics.py", line 132, in prepareAlgorithm
self.raster_interface = rasterLayer.dataProvider().clone()
AttributeError: 'NoneType' object has no attribute 'dataProvider'
Error encountered while running Zonal statistics
Error encountered while running Zonal statistics
Execution failed after 24.08 seconds
Loading resulting layers
Algorithm 'test' finished
As you can see, Zonal statistics
algorithm gets None
as input raster instead of raster layer/path. At the same time, output from dzetsaka exists and contains valid raster.
Test data (layers, project and model) attached. Any ideas what can be wrong here and how to fix it?
test.zip
i tried to install scikit-leart but it failed, message was :
C:\Windows\System32>pip install scikit-learn
Fatal error in launcher: Unable to create process using '"c:\osgeo41\bin\python3.exe" "C:\PROGRA1\QGIS3~1.4\apps\Python37\Scripts\pip.exe" install scikit-learn'
how to solve this problem, thank you
QGIS on macOS uses GDAL 3.2.1 that removed the deprecated import of GDAL, please see https://pypi.org/project/GDAL/
To support macOS 3.16 LTR and macOS 3.18, please fix the code with:
try:
from osgeo import gdal
except ImportError:
import gdal
detto for from ogr, osr,gdal_array and gdalconst imports
details: qgis/QGIS-Mac-Packager#114
...but not on Linux.
If you have an idea to solve it, you're welcome !
edit : solved in qgis3
Thats what it sais. Raster and polygon layer are on EPSG 31468. What could be the reason, or better, the solution ?
Linux Mint, QGIS 2.18.16
Cheers
Bernd
Params:
$ uname -a
Linux ipee251 4.9.228-gentoo-x86_64-Shu #1 SMP PREEMPT Fri Jun 26 12:15:46 MSK 2020 x86_64 Intel(R) Core(TM) i5-3450 CPU @ 3.10GHz GenuineIntel GNU/Linux
$ eselect python list
Available Python interpreters, in order of preference:
[1] python3.7
[2] python2.7
[3] python3.8 (fallback)
$ eix -I learn
[I] sci-libs/scikits_learn
Available: ~0.19.0-r1^t ~0.20.2^t ~0.20.4^t 0.22.2_p1^t {examples test PYTHON_TARGETS="python3_6 python3_7 python3_8"}
Installed: 0.22.2_p1^t(15:26:24 15.07.2020)(-examples -test PYTHON_TARGETS="python3_7 -python3_6 -python3_8")
The library scikit-learn
is installed. Python by itself recognized it: when I tried to install scikit-learn
via pip
it warned me that '...already installed'. No error/warning messages in QGIS.
I'm absolutely nub in Python, so was stuck for a day. But then I simply copypasted line
Line 881 in 7929567
ModuleNotFoundError: no module named 'joblib'
And yes, dev-python/joblib
wasn't installed! Installation of it and restarting QGIS allowed me to select Random Forest and others.
So it is not a real bug, but it will be nice just to write in README/greeting/etc about that requirement.
http://www.karasiak.net doesn't work:
This Account has been suspended.
Contact your hosting provider for more information.
When i try to classify a raster file with a trained kNN model and i don't have at least one shapefile available i get the following error:
2019-05-20T09:54:03 WARNING Traceback (most recent call last):
File "C:/Users/USER/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\dzetsaka\dzetsaka.py", line 536, in runMagic
inShape=inShape.dataProvider().dataSourceUri().split('|')[0] # Remove layerid=0 from SHP Path
AttributeError: 'NoneType' object has no attribute 'dataProvider'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/USER/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\dzetsaka\dzetsaka.py", line 556, in runMagic
QgsMessageLog.logMessage('inShape is : '+inShape)
TypeError: can only concatenate str (not "NoneType") to str
Having one shapefile available, even if not related to the classification, fixes this somehow.
Hi all,
Sorry in advance, I am pretty new to programming in general. For my research project, I am working on a SAR image, and I want to do supervised classifications on it to assess areas of water and non-water using training data I created in QGIS Lima. The image is quite big, so I Have broken it into smaller sample areas. I am currently running QGIS on mac OSX.
When running either the RF or SVM algorithm using the plugin. I receive these messages. Not sure where to go from here. If anyone has any advice, I would be deeply grateful.
Cheers,
Tim
When we install scitkit-learn library and then the Dzetsaka plugin, QGIS opens several replicas, without ending, and we have to force quit them all. If we uninstall scitkit-learn library, the instalation of the plugin goes flawlessly. However, without the scitkit-learn library it will not work, as expected.
Using the Tool with a 4 band RGBI Image does not cause an error but the tool runs endlessly.
Would a 4 bandsupport be possible?
When I tried to run SVM in qgis using the plugin, I got the library missing message "Scikit-learn library is missing on your computer." Although I have scikit-learn in my system:
Requirement already satisfied: scikit-learn in ./.local/lib/python3.6/site-packages (0.20.3)
Requirement already satisfied: scipy>=0.13.3 in ./.local/lib/python3.6/site-packages (from scikit-learn) (1.2.1)
Requirement already satisfied: numpy>=1.8.2 in ./.local/lib/python3.6/site-packages (from scikit-learn) (1.16.2)
How to let QGIS recognize the library?
System: ubuntu 18.04.
Try type:import sklearn in python console in qgis, it seems the scikit-learn is not installed in qgis.
Someone found a bug in the addAlgorithm loop : https://gis.stackexchange.com/questions/345163/runtimeerror-wrapped-c-c-object-of-type-x-has-been-deleted-in-qgis-plugin
This is the error I am receiving:
2019-02-18T16:28:21 1 Traceback (most recent call last):
File "/Users/user/.qgis2/python/plugins/dzetsaka/dzetsaka.py", line 1114, in runMagic
temp.initPredict(inRaster,model,outRaster,inMask,confidenceMap,inClassifier)
File "/Users/user/.qgis2/python/plugins/dzetsaka/scripts/mainfunction.py", line 314, in initPredict
predictedImage=self.predict_image(inRaster,outRaster,tree,inMask,confidenceMap,-10000,SCALE=[M,m],classifier=classifier)
UnboundLocalError: local variable 'tree' referenced before assignment
Hi, Nicolas
I'm trying to run RF and I keep getting an error message asking me to make sure that my classes column has only integer values and that both my shapefile and raster have the same projection (EPSG:32616). However, both of these conditions are met by my files.
Where might the source of the problem be?
The output matrix would be enhanced by headers for (what I assume?) is the user and producer accuracy statistics generated. As it stands, there is uncertainty over exactly what the matrix values are reporting.
So it will be easier to test & understand the plugin.
Hey thanks for the plugin! I'm trying to test out the functionality of a few of the algorithms in QGIS 3.10, and am getting some strange results from my prediction map. I'm thinking it may be related to my output model from the train algorithm. What file format is the output model (in the train algorithm tool) supposed to be saved as?
Thanks,
Rob
Thanks for your valuable work. Really user-friendly and useful plugin for remote sensing users. I want to ask a question. Can we change the parameters of classification algorithms? For example, can we change the number of threes for the Random Forest algorithm? It is important for experiments. Because sometimes changing these parameters is increasing the accuracy of the final results. Thanks.
Bonjour Nicolas,
is your tool compatible with QGIS 3?
Hi
I'm running the demo dataset (https://github.com/lennepkade/dzetsaka/archive/docs.zip) with all the classifier.
Everything works well but SVM classifier.
Any parameter to touch in order to make working fine?
OS: Win10 - 64 bits
Thxs in advance
Update - I'm a newbie using QGIS and down the road I found the new parameters to be touched in SVM Classifier through the Processing Toolbox Panel. Sorry to bother you.
You'll save coding the interface, and the user will be able to integrate this into more complex workflows, having iterations, and much more.
Ask @volaya for howto, or have a look to other Processing plugins.
How can I find out which were the parameters values used to do the classification, looking at the scripts, it seems to me that the program tests some values and choose the best suitable:
elif inClassifier == 'KNN':
from sklearn import neighbors
**param_grid = dict(n_neighbors=np.arange(1, 20, 4))**
if 'param_algo' in locals():
classifier = neighbors.KNeighborsClassifier(
**param_algo)
else:
classifier = neighbors.KNeighborsClassifier()
How can I find out which value was used in my classification? I made it by default
I hope this is the right place to ask - my apologies if it is not: I am currently running a QGIS Enhancement Proposal (QEP) for turning plugin management into actual package management. As part of this process, I am looking for existing QGIS plugins and plugin developers who could significantly benefit from the proposed ideas and concepts. In a nutshell, I am proposing to allow to package QGIS plugins as regular Python wheels and/or conda packages - with all relevant packaging features such as proper Python package dependencies and binary extensions. Looking at this project's source code, it appears to be a good candidate for greatly benefiting from such features. If you find this work interesting and potentially relevant for your plugin, I am rather curious about your opinion. Among other issues, there appears to be some serious doubt about the existence of actual use cases for the proposed changes in QGIS among its core developers. Besides, the proposed work may also "confuse plugin developers". Feedback is therefore highly welcome.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.