v0.21 to v0.30#
v0.30 makes a number of breaking API changes, most of which are described below. You should also check out the updated examples and tutorials. Note that despite these changes, v0.30 is still backward compatible with model-bundles produced via older versions.
If something has been missed or you are unsure how to migrate a particular piece of code, please do not hesitate to open a new discussion.
Chip sampling configuration#
GeoDataWIndowConfig
has been refactored toWindowSamplingConfig
.GeoDataWIndowMethod
has been refactored toWindowSamplingMethod
.ObjectDetectionWindowMethod
has been removed.Object detection options such as
neg_ratio
,ioa_thresh
,clip
, andneg_ioa_thresh
have been moved fromObjectDetectionChipOptions
andObjectDetectionGeoDataWindowConfig
toObjectDetectionWindowSamplingConfig
.train_chip_sz
andchip_nodata_threshold
have been moved toChipOptions
.In
GeoDataConfig
,window_opts
has been replaced bysampling
.SemanticSegmentationLabelSource.enough_target_pixels()
has been refactored toSemanticSegmentationChipOptions.enough_target_pixels()
.RVPipeline.get_train_windows()
andRVPipeline.get_train_labels()
have been removed.RVPipeline.chip()
now callsBackend.chip_dataset()
.
Sample code changes (also applies to chip classification and object detection):
v0.21:
window_opts = GeoDataWindowConfig(
method=GeoDataWindowMethod.sliding, stride=chip_sz, size=chip_sz)
data = SemanticSegmentationGeoDataConfig(
...,
window_opts=window_opts,
...,
)
pipeline = SemanticSegmentationConfig(
...,
train_chip_sz=chip_sz,
)
v0.30:
from rastervision.core.rv_pipeline import (
SemanticSegmentationChipOptions, WindowSamplingConfig, WindowSamplingMethod)
chip_options = SemanticSegmentationChipOptions(
sampling=WindowSamplingConfig(
method=WindowSamplingMethod.sliding, stride=chip_sz, size=chip_sz))
data = SemanticSegmentationGeoDataConfig(
...,
sampling=chip_options.sampling,
...,
)
pipeline = SemanticSegmentationConfig(
...,
chip_options=chip_options,
)
Note
See ChipOptions
, ObjectDetectionChipOptions
, and SemanticSegmentationChipOptions
.
PredictOptions
#
predict_chip_sz
andpredict_batch_sz
have been moved toPredictOptions
which also provides the newstride
field.ChipClassificationConfig
now also expects apredict_options
. Previously, this was only true for semantic segmentation and object detection.
Sample code changes (also applies to chip classification and object detection):
v0.21:
pipeline = SemanticSegmentationConfig(
...,
predict_chip_sz=chip_sz,
predict_batch_sz=batch_sz,
)
v0.30:
predict_options = SemanticSegmentationPredictOptions(
chip_sz=chip_sz, batch_sz=batch_sz)
pipeline = SemanticSegmentationConfig(
...,
predict_options=predict_options,
)
Other changes#
GeoJSONVectorSource
andGeoJSONVectorSourceConfig
now support GeoJSONs with a CRS field and no longer takeignore_crs_field
.DataConfig
now takes aclass_config
instead ofclass_names
andclass_colors
separately.SolverConfig
no longer takestest_batch_sz
,test_num_epochs
, oroverfit_num_steps
.PyTorchLearnerBackendConfig
no longer takestest_mode
.LearnerConfig
no longer takesoverfit_mode
,predict_mode
, ortest_mode
.Backend.predict_scene()
now takesPredictOptions
instead ofchip_sz
,stride
etc.