Skip to content

Parser

[source]

Parser

icevision.parsers.Parser(class_map=None, idmap=None)

Base class for all parsers, implements the main parsing logic.

The actual fields to be parsed are defined by the mixins used when defining a custom parser. The only required fields for all parsers are image_id and image_width_height.

Arguments

  • idmap Optional[icevision.core.id_map.IDMap]: Maps from filenames to unique ids, pass an IDMap() if you need this information.

Examples

Create a parser for image filepaths.

class FilepathParser(Parser, FilepathParserMixin):
    # implement required abstract methods


[source]

parse

Parser.parse(data_splitter=None, autofix=True, show_pbar=True, cache_filepath=None)

Loops through all data points parsing the required fields.

Arguments

  • data_splitter icevision.data.DataSplitter: How to split the parsed data, defaults to a [0.8, 0.2] random split.
  • show_pbar bool: Whether or not to show a progress bar while parsing the data.
  • cache_filepath Union[str, pathlib.Path]: Path to save records in pickle format. Defaults to None, e.g. if the user does not specify a path, no saving nor loading happens.

Returns

A list of records for each split defined by data_splitter.


[source]

FasterRCNN

icevision.parsers.FasterRCNN(class_map=None, idmap=None)

Parser with required mixins for Faster RCNN.


[source]

MaskRCNN

icevision.parsers.MaskRCNN(class_map=None, idmap=None)

Parser with required mixins for Mask RCNN.


[source]

ImageidMixin

icevision.parsers.mixins.ImageidMixin(*args, **kwargs)

Adds imageid method to parser


[source]

FilepathMixin

icevision.parsers.mixins.FilepathMixin(*args, **kwargs)

Adds filepath method to parser


[source]

SizeMixin

icevision.parsers.mixins.SizeMixin(*args, **kwargs)

Adds image_width_height method to parser


[source]

LabelsMixin

icevision.parsers.mixins.LabelsMixin(*args, **kwargs)

Adds labels method to parser


[source]

BBoxesMixin

icevision.parsers.mixins.BBoxesMixin(*args, **kwargs)

Adds bboxes method to parser


[source]

MasksMixin

icevision.parsers.mixins.MasksMixin(*args, **kwargs)

Adds masks method to parser


[source]

AreasMixin

icevision.parsers.mixins.AreasMixin(*args, **kwargs)

Adds areas method to parser


[source]

IsCrowdsMixin

icevision.parsers.mixins.IsCrowdsMixin(*args, **kwargs)

Adds iscrowds method to parser