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#
GeoDataWIndowConfighas been refactored toWindowSamplingConfig.GeoDataWIndowMethodhas been refactored toWindowSamplingMethod.ObjectDetectionWindowMethodhas been removed.Object detection options such as
neg_ratio,ioa_thresh,clip, andneg_ioa_threshhave been moved fromObjectDetectionChipOptionsandObjectDetectionGeoDataWindowConfigtoObjectDetectionWindowSamplingConfig.train_chip_szandchip_nodata_thresholdhave been moved toChipOptions.In
GeoDataConfig,window_optshas 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_szandpredict_batch_szhave been moved toPredictOptionswhich also provides the newstridefield.ChipClassificationConfignow 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#
GeoJSONVectorSourceandGeoJSONVectorSourceConfignow support GeoJSONs with a CRS field and no longer takeignore_crs_field.DataConfignow takes aclass_configinstead ofclass_namesandclass_colorsseparately.SolverConfigno longer takestest_batch_sz,test_num_epochs, oroverfit_num_steps.PyTorchLearnerBackendConfigno longer takestest_mode.LearnerConfigno longer takesoverfit_mode,predict_mode, ortest_mode.Backend.predict_scene()now takesPredictOptionsinstead ofchip_sz,strideetc.