GRASS logo



Table of contents


Mask R-CNN tools allow the user to train his own model and use it for a detection of objects, or to use a model provided by someone else. It can be seen as a supervised classification using convolutional neural networks.

The training is done using module ann.maskrcnn.train. The user feeds the module with training data consisting of images and masks for each instance of intended classes, and gets a model. For difficult tasks and when not using a pretrained model, the training may take even weeks; in case of a good pretrained model and powerful PC with GPU support, the training could get good results after 1 day and even less.

When the user has a model, it can be used for the detection. ann.maskrcnn.detect detects classes learned during the training and extracts from given images vectors corresponding to detected objects. Objects can be extracted either as areas or points.


ann.maskrcnn.* modules contain a lot of external python dependencies. To run modules, it is necessary to have them installed. Modules use python3, so please install python3 versions.

After dependencies are fulfilled, modules can be installed using g.extension module:

g.extension extension=maskrcnn url=path/to/the/maskrcnn/folder


Unfortunately, python3 is not fully supported by GRASS GIS yet. To use environment setting flags like --overwrite, the user has to update his GRASS GIS with the following patch:

--- lib/python/script/	(revision 72644)
+++ lib/python/script/	(working copy)
@@ -746,7 +746,7 @@
         elif var.startswith(b'opt_'):
             options[var[4:]] = val
         elif var in [b'GRASS_OVERWRITE', b'GRASS_VERBOSE']:
-            os.environ[var] = val
+            os.environ[var.decode("utf-8")] = val.decode("utf-8")
             raise SyntaxError("invalid output from g.parser: %s" % line)


i.ann.maskrcnn.train, i.ann.maskrcnn.detect


Ondrej Pesek

Last changed: $Date: 2018-05-22 19:28:38 +0200 (Tue, 22 May 2018) $


Available at: i.ann.maskrcnn source code (history)

Main index | Imagery index | Topics index | Keywords index | Graphical index | Full index

© 2003-2018 GRASS Development Team, GRASS GIS 7.4.2svn Reference Manual