QGIS Map Segmentation
A Quant Civil product
Welcome!
Ever needed to intelligently divide your map into different sections? Have you been drawing polygons for days?
Not anymore! Introducing the machine learning powered qgis plugin that will change your workflow.
Dependencies
The tool should automatically try to install the required dependencies. To manually install the dependencies required by the tool, open your python console in QGIS and enter the following lines:
import pip
pip.main(["install", "scikit-learn"])
pip.main(["install", "torch", "--index-url", "https://download.pytorch.org/whl/cu121"])
If the above install does not work, or if you have other questions, please contact help@quantcivil.ai.
Instructions
Below are the steps for a basic segmentation:
- Choose a raster. Make sure the raster is in RGB format with 3 channels. The tool will process everything within the raster, so if you find your device running out of RAM, try using a smaller section of the raster or reducing the resolution. If you are using a web generated map (Google satelite), please convert the map to a raster first with the "Convert map to raster" tool available in QGIS.
- Choose a model. CNN will provide better results but requires more processing power, see images below.
- Choose a resolution. Higher resolutions will result in a more detailed segmentation map. Lower resolutions will be less noisy.
- Choose number of segments. This will determine how many segments are generated. You should choose the number based on how "complex" the raster is. That is, if there 4 different kinds of land cover on your map (trees, roads, buildings, water, etc.), you should set the number of segments to something slightly higher than 4, between 6 and 8.
- Segment! A raster layer will be produced overlaying the input with the different segments.
Example Images
Below are some examples from the tool. First, a sample map, rendered at 0.5 map units per pixel:
Then, the K-Means segmentation map at high resolution with 8 segments:
Finally, a CNN segmentation map at high resolution with 8 segments:
As you can see, CNN provides cleaner results while K-Means is quick and easy.