SemanticSegmentationLabelStoreConfig#

Note

All Configs are derived from rastervision.pipeline.config.Config, which itself is a pydantic Model.

pydantic model SemanticSegmentationLabelStoreConfig[source]#

Configure a SemanticSegmentationLabelStore.

Stores class raster as GeoTIFF, and can optionally vectorizes predictions and stores them in GeoJSON files.

Show JSON schema
{
   "title": "SemanticSegmentationLabelStoreConfig",
   "description": "Configure a :class:`.SemanticSegmentationLabelStore`.\n\nStores class raster as GeoTIFF, and can optionally vectorizes predictions and stores\nthem in GeoJSON files.",
   "type": "object",
   "properties": {
      "type_hint": {
         "title": "Type Hint",
         "default": "semantic_segmentation_label_store",
         "enum": [
            "semantic_segmentation_label_store"
         ],
         "type": "string"
      },
      "uri": {
         "title": "Uri",
         "description": "URI of file with predictions. If None, and this Config is part of a SceneConfig inside an RVPipelineConfig, this fiend will be auto-generated.",
         "type": "string"
      },
      "vector_output": {
         "title": "Vector Output",
         "default": [],
         "type": "array",
         "items": {
            "$ref": "#/definitions/VectorOutputConfig"
         }
      },
      "rgb": {
         "title": "Rgb",
         "description": "If True, save prediction class_ids in RGB format using the colors in class_config.",
         "default": false,
         "type": "boolean"
      },
      "smooth_output": {
         "title": "Smooth Output",
         "description": "If True, expects labels to be continuous values representing class scores and stores both scores and discrete labels.",
         "default": false,
         "type": "boolean"
      },
      "smooth_as_uint8": {
         "title": "Smooth As Uint8",
         "description": "If True, stores smooth scores as uint8, resulting in loss of precision, but reduced file size. Only used if smooth_output=True.",
         "default": false,
         "type": "boolean"
      },
      "rasterio_block_size": {
         "title": "Rasterio Block Size",
         "description": "blockxsize and blockysize params in rasterio.open() will be set to this.",
         "default": 256,
         "type": "integer"
      }
   },
   "additionalProperties": false,
   "definitions": {
      "VectorOutputConfig": {
         "title": "VectorOutputConfig",
         "description": "Config for vectorized semantic segmentation predictions.",
         "type": "object",
         "properties": {
            "uri": {
               "title": "Uri",
               "description": "URI of vector output. If None, and this Config is part of a SceneConfig and RVPipeline, this field will be auto-generated.",
               "type": "string"
            },
            "class_id": {
               "title": "Class Id",
               "description": "The prediction class that is to turned into vectors.",
               "type": "integer"
            },
            "denoise": {
               "title": "Denoise",
               "description": "Radius of the structural element used to remove high-frequency signals from the image. Smaller values will reduce less noise and make vectorization slower (especially for large images). Larger values will remove more noise and make vectorization faster but might also remove legitimate detections.",
               "default": 8,
               "type": "integer"
            },
            "type_hint": {
               "title": "Type Hint",
               "default": "vector_output",
               "enum": [
                  "vector_output"
               ],
               "type": "string"
            }
         },
         "required": [
            "class_id"
         ],
         "additionalProperties": false
      }
   }
}

Config
  • extra: str = forbid

  • validate_assignment: bool = True

Fields
field rasterio_block_size: int = 256#

blockxsize and blockysize params in rasterio.open() will be set to this.

field rgb: bool = False#

If True, save prediction class_ids in RGB format using the colors in class_config.

field smooth_as_uint8: bool = False#

If True, stores smooth scores as uint8, resulting in loss of precision, but reduced file size. Only used if smooth_output=True.

field smooth_output: bool = False#

If True, expects labels to be continuous values representing class scores and stores both scores and discrete labels.

field type_hint: Literal['semantic_segmentation_label_store'] = 'semantic_segmentation_label_store'#
field uri: Optional[str] = None#

URI of file with predictions. If None, and this Config is part of a SceneConfig inside an RVPipelineConfig, this fiend will be auto-generated.

field vector_output: List[VectorOutputConfig] = []#
build(class_config, crs_transformer, extent, tmp_dir)[source]#

Build an instance of the corresponding type of object using this config.

For example, BackendConfig will build a Backend object. The arguments to this method will vary depending on the type of Config.

recursive_validate_config()#

Recursively validate hierarchies of Configs.

This uses reflection to call validate_config on a hierarchy of Configs using a depth-first pre-order traversal.

revalidate()#

Re-validate an instantiated Config.

Runs all Pydantic validators plus self.validate_config().

Adapted from: https://github.com/samuelcolvin/pydantic/issues/1864#issuecomment-679044432

update(pipeline: Optional[RVPipelineConfig] = None, scene: Optional[SceneConfig] = None)[source]#

Update any fields before validation.

Subclasses should override this to provide complex default behavior, for example, setting default values as a function of the values of other fields. The arguments to this method will vary depending on the type of Config.

Parameters
validate_config()#

Validate fields that should be checked after update is called.

This is to complement the builtin validation that Pydantic performs at the time of object construction.

validate_list(field: str, valid_options: List[str])#

Validate a list field.

Parameters
  • field (str) – name of field to validate

  • valid_options (List[str]) – values that field is allowed to take

Raises

ConfigError – if field is invalid