SemanticSegmentationChipOptions#

Note

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

pydantic model SemanticSegmentationChipOptions[source]#

Chipping options for semantic segmentation.

Show JSON schema
{
   "title": "SemanticSegmentationChipOptions",
   "description": "Chipping options for semantic segmentation.",
   "type": "object",
   "properties": {
      "window_method": {
         "description": "Window method to use for chipping.",
         "default": "sliding",
         "allOf": [
            {
               "$ref": "#/definitions/SemanticSegmentationWindowMethod"
            }
         ]
      },
      "target_class_ids": {
         "title": "Target Class Ids",
         "description": "List of class ids considered as targets (ie. those to prioritize when creating chips) which is only used in conjunction with the target_count_threshold and negative_survival_probability options. Applies to the random_sample window method.",
         "type": "array",
         "items": {
            "type": "integer"
         }
      },
      "negative_survival_prob": {
         "title": "Negative Survival Prob",
         "description": "Probability of keeping a negative chip.",
         "default": 1.0,
         "type": "number"
      },
      "chips_per_scene": {
         "title": "Chips Per Scene",
         "description": "Number of chips to generate per scene. Applies to the random_sample window method.",
         "default": 1000,
         "type": "integer"
      },
      "target_count_threshold": {
         "title": "Target Count Threshold",
         "description": "Minimum number of pixels covering target_classes that a chip must have. Applies to the random_sample window method.",
         "default": 1000,
         "type": "integer"
      },
      "stride": {
         "title": "Stride",
         "description": "Stride of windows across image. Defaults to half the chip size. Applies to the sliding_window method.",
         "type": "integer"
      },
      "type_hint": {
         "title": "Type Hint",
         "default": "semantic_segmentation_chip_options",
         "enum": [
            "semantic_segmentation_chip_options"
         ],
         "type": "string"
      }
   },
   "additionalProperties": false,
   "definitions": {
      "SemanticSegmentationWindowMethod": {
         "title": "SemanticSegmentationWindowMethod",
         "description": "Enum for window methods\n\nAttributes:\n    sliding: use a sliding window\n    random_sample: randomly sample windows",
         "enum": [
            "sliding",
            "random_sample"
         ]
      }
   }
}

Config
  • extra: str = forbid

  • validate_assignment: bool = True

Fields
field chips_per_scene: int = 1000#

Number of chips to generate per scene. Applies to the random_sample window method.

field negative_survival_prob: float = 1.0#

Probability of keeping a negative chip.

field stride: Optional[int] = None#

Stride of windows across image. Defaults to half the chip size. Applies to the sliding_window method.

field target_class_ids: Optional[List[int]] = None#

List of class ids considered as targets (ie. those to prioritize when creating chips) which is only used in conjunction with the target_count_threshold and negative_survival_probability options. Applies to the random_sample window method.

field target_count_threshold: int = 1000#

Minimum number of pixels covering target_classes that a chip must have. Applies to the random_sample window method.

field type_hint: Literal['semantic_segmentation_chip_options'] = 'semantic_segmentation_chip_options'#
field window_method: SemanticSegmentationWindowMethod = SemanticSegmentationWindowMethod.sliding#

Window method to use for chipping.

build()#

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(*args, **kwargs)#

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.

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