How to create AI train data with QGIS
In this how-to, we will use Areas to store our data in. Areas can overlap and be grouped together using a particular attribute, in this case FOLIAGE. The FOLIAGE attribute should contain a single integer number, which represents the classification. For example, we can use the following classification:
- Deciduous Tree
- Pine Tree
- Heath area
- Hedge
- Bush
- Reed
- Flower bed
- Leafless Tree Area
The areas are drawn on top of a particular Overlay or WMS Layer of your project. In this case we will use the original satellite background layer of a Project's WMS service.
How to create AI train data with QGIS:
Setup a Project with an attribute Area and copy the WFS link
How to Setup a Project with an attribute Area and copy the WFS link:
- Open your project in editor mode.
- Hover over Areas in the ribbon bar, and select Add new Empty Area.
- With the Area selected, select the Attribute tab in the Area Detail Panel.
- Under Add new Attribute, type FOLIAGE for name and 1 for value.
- Click Save New Attribute to add the FOLIAGE attribute.
- Click on the Group by Attribute button in the Area Overview Panel.
- Add the same Attribute name as added for the Area in the previous steps.
- Next, hover over Areas in the ribbon bar and select Export Geo Data
- For Filter, select Foliage
- Select any of the GeoJSON options.
- Click on the Copy the URL button next to Web Feature Service (WFS)
Setup QGIS with a Project's Area WFS and a Satellite Background
How to Setup QGIS with a Project's Area WFS and a Satellite Background:
- Open QGIS
- In QGIS, Hover over Layer in the ribbon bar, and under add new Layer, select add WFS / OGC API Feature Layer
- In the Data Source Manager panel, select New.
- Paste the copied WFS url from the Export Geo Data panel and paste it in the url field.
- Provide an appropriate name, for example Foliage - My Project Name and confirm.
- Click on the Connect button.
- Select the layer named Foliage Areas and click on Add.
- In the Tygron Application again, hover over Overlays and select Export Grid Data
- Click on the Copy URL
- In QGIS, hover over Layer again, and under add new Layer, select add WMS/WMTS.
- Click on add new.
- For the URL field, paste the copied Web Map Service (WMS) URL.
- For the name, write Satellite - My Project Name and click on OK to confirm.
- Click on connect and select the layer named SATELLITE ORIGINAL and click add.
- In the Layers panel in QGIS, drag and drop the Foliage Layer above the Satellite Layer.
Setup the QGIS WFS Layer with a classification and attribute form
How to Setup the QGIS WFS Layer with a classification and attribute form.:
- Right click on the Foliage Areas Layer, and select the Symbology Tab.
- Changed the type to Categorized.
- Click on the plus button to add 2 categories per type.
- Per type, do the following:
- Add an entry and provide it with an integer number, such as 1.
- Select a color
- Provide the name of the entry with the classification, for example Deciduous.
- With the entry selected, press ctrl+c to copy the entry and ctrl+v to paste the entry.
- Select the new entry and change the integer value to a floating point value, such as 1.0
- Finally, add a final entry with no value and a color that significantly different from the classification colors, such as pink or purple. Name it legend entry Invalid Classification.
- Click on the apply button.
- Next Select the tab Attributes Form:
- Change the option to Drag and Drop Editor.
- Under form Layout, remove all fields except the FOLIAGE field.
- Select the FOLIAGE field, and under general, select the Reuse last entered value option.
- Optionally, under Defaults, set the Default Value to 1.
Edit the WFS layer and add and edit features and saving the changes
{{howto|title=Edit the WFS layer and add and edit features and saving the changes.
Notes
- You can choose to change the Attribute Form of the WFS Feature Layer to use the Classification instead of a text field with a number, in case the classification numbers are hard to remember.