RegressionPlotOptions#

Note

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

pydantic model RegressionPlotOptions[source]#

Show JSON schema
{
   "title": "RegressionPlotOptions",
   "description": "Config related to plotting.",
   "type": "object",
   "properties": {
      "transform": {
         "title": "Transform",
         "description": "An Albumentations transform serialized as a dict that will be applied to each image before it is plotted. Mainly useful for undoing any data transformation that you do not want included in the plot, such as normalization. The default value will shift and scale the image so the values range from 0.0 to 1.0 which is the expected range for the plotting function. This default is useful for cases where the values after normalization are close to zero which makes the plot difficult to see.",
         "default": {
            "__version__": "1.4.1",
            "transform": {
               "__class_fullname__": "rastervision.pytorch_learner.utils.utils.MinMaxNormalize",
               "always_apply": false,
               "p": 1.0,
               "min_val": 0.0,
               "max_val": 1.0,
               "dtype": 5
            }
         },
         "type": "object"
      },
      "channel_display_groups": {
         "title": "Channel Display Groups",
         "description": "Groups of image channels to display together as a subplot when plotting the data and predictions. Can be a list or tuple of groups (e.g. [(0, 1, 2), (3,)]) or a dict containing title-to-group mappings (e.g. {\"RGB\": [0, 1, 2], \"IR\": [3]}), where each group is a list or tuple of channel indices and title is a string that will be used as the title of the subplot for that group.",
         "anyOf": [
            {
               "type": "object",
               "additionalProperties": {
                  "type": "array",
                  "items": {
                     "type": "integer",
                     "minimum": 0
                  }
               }
            },
            {
               "type": "array",
               "items": {
                  "type": "array",
                  "items": {
                     "type": "integer",
                     "minimum": 0
                  }
               }
            }
         ]
      },
      "type_hint": {
         "title": "Type Hint",
         "default": "regression_plot_options",
         "enum": [
            "regression_plot_options"
         ],
         "type": "string"
      },
      "max_scatter_points": {
         "title": "Max Scatter Points",
         "description": "Maximum number of datapoints to use in scatter plot. Useful to avoid running out of memory and cluttering.",
         "default": 5000,
         "type": "integer"
      },
      "hist_bins": {
         "title": "Hist Bins",
         "description": "Number of bins to use for histogram.",
         "default": 30,
         "type": "integer"
      }
   },
   "additionalProperties": false
}

Config
  • extra: str = forbid

  • validate_assignment: bool = True

Fields
Validators
field channel_display_groups: Optional[Union[Dict[str, ChannelInds], Sequence[ChannelInds]]] = None#

Groups of image channels to display together as a subplot when plotting the data and predictions. Can be a list or tuple of groups (e.g. [(0, 1, 2), (3,)]) or a dict containing title-to-group mappings (e.g. {“RGB”: [0, 1, 2], “IR”: [3]}), where each group is a list or tuple of channel indices and title is a string that will be used as the title of the subplot for that group.

Validated by
  • validate_channel_display_groups

field hist_bins: int = 30#

Number of bins to use for histogram.

field max_scatter_points: int = 5000#

Maximum number of datapoints to use in scatter plot. Useful to avoid running out of memory and cluttering.

field transform: Optional[dict] = {'__version__': '1.4.1', 'transform': {'__class_fullname__': 'rastervision.pytorch_learner.utils.utils.MinMaxNormalize', 'always_apply': False, 'dtype': 5, 'max_val': 1.0, 'min_val': 0.0, 'p': 1.0}}#

An Albumentations transform serialized as a dict that will be applied to each image before it is plotted. Mainly useful for undoing any data transformation that you do not want included in the plot, such as normalization. The default value will shift and scale the image so the values range from 0.0 to 1.0 which is the expected range for the plotting function. This default is useful for cases where the values after normalization are close to zero which makes the plot difficult to see.

Validated by
field type_hint: Literal['regression_plot_options'] = 'regression_plot_options'#
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.

classmethod from_file(uri: str) Config#

Deserialize a Config from a JSON file, upgrading if possible.

Parameters

uri (str) – URI to load from.

Return type

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

to_file(uri: str, with_rv_metadata: bool = True) None#

Save a Config to a JSON file, optionally with RV metadata.

Parameters
  • uri (str) – URI to save to.

  • with_rv_metadata (bool) – If True, inject Raster Vision metadata such as plugin_versions, so that the config can be upgraded when loaded.

Return type

None

update(**kwargs) None#

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.

Return type

None

validator validate_channel_display_groups  »  channel_display_groups#
Parameters

v (Optional[Union[Dict[str, Sequence[ConstrainedIntValue]], Sequence[Sequence[ConstrainedIntValue]]]]) –

Return type

Optional[Dict[str, List[ConstrainedIntValue]]]

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