diff --git a/docs/changelog.rst b/docs/changelog.rst index d131a9acb..7d7c1e4e4 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -409,7 +409,7 @@ Raster Vision 0.11 Features ~~~~~~~~ -- Added the possibility for chip classification to use data augmentors from the albumentations libary to enhance the training data. `#859 `__ +- Added the possibility for chip classification to use data augmentors from the albumentations library to enhance the training data. `#859 `__ - Updated the Quickstart doc with pytorch docker image and model `#863 `__ - Added the possibility to deal with class imbalances through oversampling. `#868 `__ diff --git a/docs/conf.py b/docs/conf.py index f2f9660fb..92fedb7c5 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -283,7 +283,7 @@ def setup(app: 'Sphinx') -> None: # The name of the Pygments (syntax highlighting) style to use. # -# To see all availabel values: +# To see all available values: # >>> from pygments.styles import get_all_styles # >>> styles = list(get_all_styles()) # diff --git a/docs/setup/gpu.rst b/docs/setup/gpu.rst index b36de59c0..86cabb52b 100644 --- a/docs/setup/gpu.rst +++ b/docs/setup/gpu.rst @@ -51,7 +51,7 @@ or use the ``--gpu`` option with the ``docker/run`` script. Running on AWS EC2 ------------------ -The simplest way to run Raster Vision on an AWS GPU is by starting a GPU-enabled EC2 instance such as a p3.2xlarge using the `Deep Learning AMI `_. We have tested this using the "Deep Learning AMI GPU PyTorch 1.11.0 (Ubuntu 20.04)" with id ``ami-0c968d7ef8a4b0c34``. After SSH'ing into the instance, Raster Vision can be installed with ``pip``, and code can be transfered to this instance with a tool such as ``rsync``. +The simplest way to run Raster Vision on an AWS GPU is by starting a GPU-enabled EC2 instance such as a p3.2xlarge using the `Deep Learning AMI `_. We have tested this using the "Deep Learning AMI GPU PyTorch 1.11.0 (Ubuntu 20.04)" with id ``ami-0c968d7ef8a4b0c34``. After SSH'ing into the instance, Raster Vision can be installed with ``pip``, and code can be transferred to this instance with a tool such as ``rsync``. .. _aws batch setup: diff --git a/docs/usage/tutorials/reading_vector_data.ipynb b/docs/usage/tutorials/reading_vector_data.ipynb index e87d2ce22..31f0bf6ca 100644 --- a/docs/usage/tutorials/reading_vector_data.ipynb +++ b/docs/usage/tutorials/reading_vector_data.ipynb @@ -533,7 +533,7 @@ "tags": [] }, "source": [ - "Just like we can tansform rasters by specifying a series of :class:`RasterTransformers `, we can specify :class:`VectorTransformers ` to transform vector data." + "Just like we can transform rasters by specifying a series of :class:`RasterTransformers `, we can specify :class:`VectorTransformers ` to transform vector data." ] }, { diff --git a/rastervision_core/rastervision/core/box.py b/rastervision_core/rastervision/core/box.py index 7c97e33b1..dcd01410b 100644 --- a/rastervision_core/rastervision/core/box.py +++ b/rastervision_core/rastervision/core/box.py @@ -369,7 +369,7 @@ def get_windows(self, padding. Each of size, stride, and padding can be either a positive int or - a tuple `(vertical-componet, horizontal-component)` of positive ints. + a tuple `(vertical-component, horizontal-component)` of positive ints. Padding currently only applies to the right and bottom edges. @@ -379,14 +379,14 @@ def get_windows(self, stride (Union[PosInt, Tuple[PosInt, PosInt]]): Step size between windows. Can be 2-tuple (h_step, w_step) or positive int. padding (Optional[Union[PosInt, Tuple[PosInt, PosInt]]], optional): - Optional padding to accomodate windows that overflow the + Optional padding to accommodate windows that overflow the extent. Can be 2-tuple (h_pad, w_pad) or non-negative int. If None, will be set to (size[0]//2, size[1]//2). Defaults to None. pad_direction (Literal['both', 'start', 'end']): If 'end', only pad ymax and xmax (bottom and right). If 'start', only pad ymin and xmin (top and left). If 'both', pad all sides. Has no effect if - paddiong is zero. Defaults to 'end'. + padding is zero. Defaults to 'end'. Returns: List[Box]: List of Box objects. diff --git a/rastervision_core/rastervision/core/data/class_config.py b/rastervision_core/rastervision/core/data/class_config.py index d0381b3e4..3f63de66d 100644 --- a/rastervision_core/rastervision/core/data/class_config.py +++ b/rastervision_core/rastervision/core/data/class_config.py @@ -92,7 +92,7 @@ def ensure_null_class(self) -> None: null_class_name = DEFAULT_NULL_CLASS_NAME null_class_color = DEFAULT_NULL_CLASS_COLOR - # This might seeem redundant given the null class validator above, but + # This might seem redundant given the null class validator above, but # is actually important. Sometimes there can be multiple ClassConfig # instances that reference the same list objects for names and colors # (not clear why this happens). This means that diff --git a/rastervision_core/rastervision/core/data/label/semantic_segmentation_labels.py b/rastervision_core/rastervision/core/data/label/semantic_segmentation_labels.py index 64d488809..473f80fa7 100644 --- a/rastervision_core/rastervision/core/data/label/semantic_segmentation_labels.py +++ b/rastervision_core/rastervision/core/data/label/semantic_segmentation_labels.py @@ -129,7 +129,7 @@ def transform_shape(x, y, z=None): window_aoi = transform(transform_shape, window_aoi) window_aois.append(window_aoi) - # If window does't overlap with any AOI, then it won't be in + # If window doesn't overlap with any AOI, then it won't be in # new_labels. if window_aois: # If window intersects with AOI, set pixels outside the diff --git a/rastervision_core/rastervision/core/data/label/tfod_utils/np_box_list.py b/rastervision_core/rastervision/core/data/label/tfod_utils/np_box_list.py index 5f8fee8a4..fc69d873c 100644 --- a/rastervision_core/rastervision/core/data/label/tfod_utils/np_box_list.py +++ b/rastervision_core/rastervision/core/data/label/tfod_utils/np_box_list.py @@ -113,7 +113,7 @@ def get_coordinates( return tuple(boxes.T) def _is_valid_boxes(self, data: np.ndarray) -> bool: - """Check whether data fullfills the format of N*[ymin, xmin, ymax, xmin]. + """Check whether data fulfills the format of N*[ymin, xmin, ymax, xmin]. Args: data (np.ndarray): Box coords as a [N, 4] numpy array. diff --git a/rastervision_core/rastervision/core/data/label_source/object_detection_label_source.py b/rastervision_core/rastervision/core/data/label_source/object_detection_label_source.py index 13532c1c7..13bb7cb4c 100644 --- a/rastervision_core/rastervision/core/data/label_source/object_detection_label_source.py +++ b/rastervision_core/rastervision/core/data/label_source/object_detection_label_source.py @@ -27,7 +27,7 @@ def __init__(self, bbox (Optional[Box], optional): User-specified crop of the extent. If None, the full extent available in the source file is used. ioa_thresh (Optional[float], optional): IOA threshold to apply when - retieving labels for a window. Defaults to None. + retrieving labels for a window. Defaults to None. clip (bool, optional): Clip bounding boxes to window limits when retrieving labels for a window. Defaults to False. """ @@ -52,7 +52,7 @@ def get_labels(self, Returns: ObjectDetectionLabels: Labels with sufficient overlap with the - window. The returned labels are in global coods (i.e. coords wihtin + window. The returned labels are in global coods (i.e. coords within the full extent of the source). """ if window is None: diff --git a/rastervision_core/rastervision/core/data/label_store/label_store.py b/rastervision_core/rastervision/core/data/label_store/label_store.py index 35b0de7e7..2b1471cf3 100644 --- a/rastervision_core/rastervision/core/data/label_store/label_store.py +++ b/rastervision_core/rastervision/core/data/label_store/label_store.py @@ -14,7 +14,7 @@ def save(self, labels): """Save. Args: - labels - Labels to be saved, the type of which will be dependant on the type + labels - Labels to be saved, the type of which will be dependent on the type of pipeline. """ pass diff --git a/rastervision_core/rastervision/core/data/raster_source/rasterio_source.py b/rastervision_core/rastervision/core/data/raster_source/rasterio_source.py index f53f6b94b..2061838b7 100644 --- a/rastervision_core/rastervision/core/data/raster_source/rasterio_source.py +++ b/rastervision_core/rastervision/core/data/raster_source/rasterio_source.py @@ -134,7 +134,7 @@ def crs_transformer(self) -> RasterioCRSTransformer: return self._crs_transformer def _set_info_from_chip(self): - """Read 1x1 chip to get info not statically inferrable.""" + """Read 1x1 chip to get info not statically inferable.""" test_chip = self.get_chip(Box(0, 0, 1, 1)) self._dtype = test_chip.dtype self._num_channels = test_chip.shape[-1] @@ -183,7 +183,7 @@ def get_chip(self, channel_order (if specified). So if this is an RGB image and channel_order=[2, 1, 0], then using bands=[0] will return the B-channel. Defaults to None. - out_shape (Optional[Tuple[int, ...]], optional): (hieght, width) of + out_shape (Optional[Tuple[int, ...]], optional): (height, width) of the output chip. If None, no resizing is done. Defaults to None. diff --git a/rastervision_core/rastervision/core/data/raster_source/xarray_source.py b/rastervision_core/rastervision/core/data/raster_source/xarray_source.py index 6762fea73..c6144cd9f 100644 --- a/rastervision_core/rastervision/core/data/raster_source/xarray_source.py +++ b/rastervision_core/rastervision/core/data/raster_source/xarray_source.py @@ -121,7 +121,7 @@ def crs_transformer(self) -> RasterioCRSTransformer: return self._crs_transformer def _set_info_from_chip(self): - """Read 1x1 chip to get info not statically inferrable.""" + """Read 1x1 chip to get info not statically inferable.""" test_chip = self.get_chip(Box(0, 0, 1, 1)) self._dtype = test_chip.dtype self._num_channels = test_chip.shape[-1] @@ -168,7 +168,7 @@ def get_chip(self, channel_order (if specified). So if this is an RGB image and channel_order=[2, 1, 0], then using bands=[0] will return the B-channel. Defaults to None. - out_shape (Optional[Tuple[int, ...]], optional): (hieght, width) of + out_shape (Optional[Tuple[int, ...]], optional): (height, width) of the output chip. If None, no resizing is done. Defaults to None. diff --git a/rastervision_core/rastervision/core/data/utils/factory.py b/rastervision_core/rastervision/core/data/utils/factory.py index c9b5ba8b5..f0b447e75 100644 --- a/rastervision_core/rastervision/core/data/utils/factory.py +++ b/rastervision_core/rastervision/core/data/utils/factory.py @@ -41,7 +41,7 @@ def make_ss_scene(image_uri: Union[str, List[str]], label_vector_default_class_id (Optional[int], optional): If using label_vector_uri and all polygons in that file belong to the same class and they do not contain a `class_id` property, then use this - argument to map all of the polgons to the appropriate class ID. + argument to map all of the polygons to the appropriate class ID. See docs for ClassInferenceTransformer for more details. Defaults to None. image_raster_source_kw (dict, optional): Additional arguments to pass @@ -152,7 +152,7 @@ def make_cc_scene(image_uri: Union[str, List[str]], label_vector_default_class_id (Optional[int], optional): If using label_vector_uri and all polygons in that file belong to the same class and they do not contain a `class_id` property, then use this - argument to map all of the polgons to the appropriate class ID. + argument to map all of the polygons to the appropriate class ID. See docs for ClassInferenceTransformer for more details. Defaults to None. image_raster_source_kw (dict, optional): Additional arguments to pass @@ -243,7 +243,7 @@ def make_od_scene(image_uri: Union[str, List[str]], label_vector_default_class_id (Optional[int], optional): If using label_vector_uri and all polygons in that file belong to the same class and they do not contain a `class_id` property, then use this - argument to map all of the polgons to the appropriate class ID. + argument to map all of the polygons to the appropriate class ID. See docs for ClassInferenceTransformer for more details. Defaults to None. image_raster_source_kw (dict, optional): Additional arguments to pass diff --git a/rastervision_core/rastervision/core/data/utils/geojson.py b/rastervision_core/rastervision/core/data/utils/geojson.py index 4ff2cd2aa..6df3452b3 100644 --- a/rastervision_core/rastervision/core/data/utils/geojson.py +++ b/rastervision_core/rastervision/core/data/utils/geojson.py @@ -118,9 +118,9 @@ def geoms_to_geojson(geoms: Iterable['BaseGeometry'], def geom_to_feature(geom: 'BaseGeometry', properties: Optional[dict] = None) -> dict: - """Serialize a single shapely geomety to a GeoJSON Feature.""" - geomety = mapping(geom) - feature = geometry_to_feature(geomety, properties=properties) + """Serialize a single shapely geometry to a GeoJSON Feature.""" + geometry = mapping(geom) + feature = geometry_to_feature(geometry, properties=properties) return feature @@ -251,7 +251,7 @@ def pixel_to_map_coords(geojson: dict, def simplify_polygons(geojson: dict) -> dict: """Simplify polygon geometries by applying ``.buffer(0)``. - For Polygon geomtries, ``.buffer(0)`` can do the following: + For Polygon geometries, ``.buffer(0)`` can do the following: 1. *Sometimes* break up a polygon with "bowties" into multiple polygons. (See https://github.com/shapely/shapely/issues/599.) diff --git a/rastervision_core/rastervision/core/data/utils/raster.py b/rastervision_core/rastervision/core/data/utils/raster.py index e13205392..e55071b13 100644 --- a/rastervision_core/rastervision/core/data/utils/raster.py +++ b/rastervision_core/rastervision/core/data/utils/raster.py @@ -13,7 +13,7 @@ def fill_overflow(bbox: Box, bbox (Box): Bounding box. window (Box): Window corresponding to the ``chip``. chip (np.ndarray): (H, W, C) array. - fill_value (int, optional): Value to set oveflowing pixels to. + fill_value (int, optional): Value to set overflowing pixels to. Defaults to 0. Returns: diff --git a/rastervision_core/rastervision/core/data/utils/rasterio.py b/rastervision_core/rastervision/core/data/utils/rasterio.py index 3c54ef407..466f74154 100644 --- a/rastervision_core/rastervision/core/data/utils/rasterio.py +++ b/rastervision_core/rastervision/core/data/utils/rasterio.py @@ -47,7 +47,7 @@ def write_bbox(path: str, arr: np.ndarray, bbox: Box, crs_wkt: str, **kwargs): Args: path (str): GeoTiff path. arr (np.ndarray): (H, W[, C]) Array to write. - bbox (Box): Bouding box in map coords to georeference the GeoTiff to. + bbox (Box): Bounding box in map coords to georeference the GeoTiff to. crs_wkt (str): CRS in WKT format. """ if arr.ndim == 2: @@ -182,7 +182,7 @@ def read_window( Defaults to None. is_masked (bool): If True, read a masked array from rasterio. Defaults to False. - out_shape (Optional[Tuple[int, int]]): (hieght, width) of the output + out_shape (Optional[Tuple[int, int]]): (height, width) of the output chip. If None, no resizing is done. Defaults to None. Returns: diff --git a/rastervision_core/rastervision/core/data/utils/vectorization.py b/rastervision_core/rastervision/core/data/utils/vectorization.py index 9e836a20e..377232014 100644 --- a/rastervision_core/rastervision/core/data/utils/vectorization.py +++ b/rastervision_core/rastervision/core/data/utils/vectorization.py @@ -23,7 +23,7 @@ def mask_to_polygons(mask: np.ndarray, transform: Optional[rio.Affine] = None Args: mask (np.ndarray): The mask containing buildings to polygonize. transform (Optional[rio.Affine]): Affine transform to use during - polygonization. Deafults to None (i.e. identity transform). + polygonization. Defaults to None (i.e. identity transform). Returns: Iterator[BaseGeometry]: Generator of shapely polygons. @@ -61,7 +61,7 @@ def mask_to_building_polygons( Args: mask (np.ndarray): The mask containing buildings to polygonize. transform (Optional[rio.Affine]): Affine transform to use during - polygonization. Deafults to None (i.e. identity transform). + polygonization. Defaults to None (i.e. identity transform). min_area (float): Minimum area (in pixels^2) of anything that can be considered to be a building or cluster of buildings. The goal is to distinguish between buildings and artifacts. Components with area diff --git a/rastervision_core/rastervision/core/evaluation/classification_evaluation.py b/rastervision_core/rastervision/core/evaluation/classification_evaluation.py index a8da03f7c..ef1f9eb1c 100644 --- a/rastervision_core/rastervision/core/evaluation/classification_evaluation.py +++ b/rastervision_core/rastervision/core/evaluation/classification_evaluation.py @@ -86,7 +86,7 @@ def merge(self, Args: other (ClassificationEvaluation): Evaluation to merge into this one scene_id (Optional[str], optional): ID of scene. If specified, - (a copy of) ``other`` will be saved and be availabel in + (a copy of) ``other`` will be saved and be available in ``to_json()``'s output. Defaults to None. """ if self.conf_mat is None: diff --git a/rastervision_core/rastervision/core/evaluation/object_detection_evaluation.py b/rastervision_core/rastervision/core/evaluation/object_detection_evaluation.py index d1d9ef9db..519be44c1 100644 --- a/rastervision_core/rastervision/core/evaluation/object_detection_evaluation.py +++ b/rastervision_core/rastervision/core/evaluation/object_detection_evaluation.py @@ -16,7 +16,7 @@ def compute_metrics( pred_labels: 'ObjectDetectionLabels', num_classes: int, iou_thresh: float = 0.5) -> Tuple[np.ndarray, np.ndarray, np.ndarray]: - """Compute per-class true positves, false positives, and false negatives. + """Compute per-class true positives, false positives, and false negatives. Does the following: diff --git a/rastervision_core/rastervision/core/rv_pipeline/rv_pipeline.py b/rastervision_core/rastervision/core/rv_pipeline/rv_pipeline.py index bff0a9a67..2b05c4818 100644 --- a/rastervision_core/rastervision/core/rv_pipeline/rv_pipeline.py +++ b/rastervision_core/rastervision/core/rv_pipeline/rv_pipeline.py @@ -177,7 +177,7 @@ def predict(self, split_ind=0, num_splits=1): This uses a sliding window. """ - # Cache backend so subsquent calls will be faster. This is useful for + # Cache backend so subsequent calls will be faster. This is useful for # the predictor. if self.backend is None: self.backend = self.config.backend.build(self.config, self.tmp_dir) diff --git a/rastervision_core/rastervision/core/utils/stac.py b/rastervision_core/rastervision/core/utils/stac.py index 852cc79b1..2719d864e 100644 --- a/rastervision_core/rastervision/core/utils/stac.py +++ b/rastervision_core/rastervision/core/utils/stac.py @@ -74,7 +74,7 @@ def parse_stac(stac_uri: str, item_limit: Optional[int] = None) -> List[dict]: stac_uri (str): Path to the STAC catalog JSON file. Returns: - List[dict]: A lsit of dicts with keys: "label_uri", "image_uris", + List[dict]: A list of dicts with keys: "label_uri", "image_uris", "label_bbox", "image_bbox", "bboxes_intersect", and "aoi_geometry". Each dict corresponds to one label item and its associated image assets in the STAC catalog. @@ -145,7 +145,7 @@ def read_stac(uri: str, extract_dir: Optional[str] = None, Exception: If multiple catalog.json's are found inside the zip file. Returns: - List[dict]: A lsit of dicts with keys: "label_uri", "image_uris", + List[dict]: A list of dicts with keys: "label_uri", "image_uris", "label_bbox", "image_bbox", "bboxes_intersect", and "aoi_geometry". Each dict corresponds to one label item and its associated image assets in the STAC catalog. diff --git a/rastervision_pipeline/rastervision/pipeline/version.py b/rastervision_pipeline/rastervision/pipeline/version.py index 33edbba08..b9674ba00 100644 --- a/rastervision_pipeline/rastervision/pipeline/version.py +++ b/rastervision_pipeline/rastervision/pipeline/version.py @@ -1,2 +1,2 @@ -"""Library verison""" +"""Library version""" __version__ = '0.21.4-dev' diff --git a/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/README.md b/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/README.md index da43cc52d..a142be6f2 100644 --- a/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/README.md +++ b/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/README.md @@ -4,7 +4,7 @@ The `test.py` script provides some useful commands for running the examples and It supports the following commands: - `run` - run an example either remotely or locally - `compare` - compare the outputs of the `eval` stage of two runs of the same example -- `collect` - dowload the output of one or more commands (like `train`, `eval`, `bundle`, etc.) produced by a run of an example +- `collect` - download the output of one or more commands (like `train`, `eval`, `bundle`, etc.) produced by a run of an example - `predict` - download the model bundle produced by a run of an example and use it to make predictions on a sample image - `upload` - upload model bundle, eval, sample image, sample predictions, and training logs to the model zoo diff --git a/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/chip_classification/spacenet_rio_data_prep.ipynb b/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/chip_classification/spacenet_rio_data_prep.ipynb index 51c6886ea..a660f658e 100644 --- a/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/chip_classification/spacenet_rio_data_prep.ipynb +++ b/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/chip_classification/spacenet_rio_data_prep.ipynb @@ -85,7 +85,7 @@ "source": [ "## Use the AOI to determine what images are inside the training set\n", "\n", - "Here we compare the AOI to the image extents to deteremine which images we can use for training and validation. We're using `rasterio`'s ability to read the metadata from raster data on S3 without downloading the whole image" + "Here we compare the AOI to the image extents to determine which images we can use for training and validation. We're using `rasterio`'s ability to read the metadata from raster data on S3 without downloading the whole image" ] }, { diff --git a/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/test.py b/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/test.py index 18c0590be..3f7e8f70c 100644 --- a/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/test.py +++ b/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/test.py @@ -147,7 +147,7 @@ def test(): @click.option('--remote', is_flag=True, default=False) @click.option( '--commands', - help='Space-separated string with RV commansd to run.', + help='Space-separated string with RV command to run.', default=None) @click.option( '--overrides', diff --git a/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/tiny_spacenet.py b/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/tiny_spacenet.py index 4fb37a104..74f6ec5b9 100644 --- a/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/tiny_spacenet.py +++ b/rastervision_pytorch_backend/rastervision/pytorch_backend/examples/tiny_spacenet.py @@ -71,7 +71,7 @@ def make_scene(scene_id: str, image_uri: str, label_uri: str, ignore_crs_field=True, # The geoms in the label GeoJSON do not have a "class_id" property, so # classes must be inferred. Since all geoms are for the building class, - # this is easy to do: we just assing the building class ID to all of + # this is easy to do: we just assign the building class ID to all of # them. transformers=[ ClassInferenceTransformerConfig( diff --git a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/classification_dataset.py b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/classification_dataset.py index 8897f3df4..5cd9b5f78 100644 --- a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/classification_dataset.py +++ b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/classification_dataset.py @@ -65,7 +65,7 @@ def make_cc_geodataset(cls, label_vector_default_class_id (Optional[int], optional): If using label_vector_uri and all polygons in that file belong to the same class and they do not contain a `class_id` property, then use this - argument to map all of the polgons to the appropriate class ID. + argument to map all of the polygons to the appropriate class ID. See docs for ClassInferenceTransformer for more details. Defaults to None. image_raster_source_kw (dict, optional): Additional arguments to pass diff --git a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/dataset.py b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/dataset.py index 4705e296a..b2cb8dba3 100644 --- a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/dataset.py +++ b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/dataset.py @@ -83,8 +83,8 @@ def __getitem__(self, key) -> Tuple[torch.Tensor, torch.Tensor]: y = torch.from_numpy(y) if y is None: - # Ideally, y should be None to semantically convery the absence of - # any label, but PyTorch's defauult collate function doesn't handle + # Ideally, y should be None to semantically convey the absence of + # any label, but PyTorch's default collate function doesn't handle # None values. y = torch.tensor(np.nan) diff --git a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/object_detection_dataset.py b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/object_detection_dataset.py index 3ec53329c..0ae8a08b8 100644 --- a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/object_detection_dataset.py +++ b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/object_detection_dataset.py @@ -115,7 +115,7 @@ def make_od_geodataset(cls, label_vector_default_class_id (Optional[int], optional): If using label_vector_uri and all polygons in that file belong to the same class and they do not contain a `class_id` property, then use this - argument to map all of the polgons to the appropriate class ID. + argument to map all of the polygons to the appropriate class ID. See docs for ClassInferenceTransformer for more details. Defaults to None. image_raster_source_kw (dict, optional): Additional arguments to pass @@ -253,7 +253,7 @@ def _sample_pos_window(self) -> Box: bbox: Box = np.random.choice(self.bboxes) box_h, box_w = bbox.size - # check if it is possible to sample a containing widnow + # check if it is possible to sample a containing window hmax, wmax = self.max_size if box_h > hmax or box_w > wmax: raise ValueError( diff --git a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/semantic_segmentation_dataset.py b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/semantic_segmentation_dataset.py index 352b677e7..d41aa991d 100644 --- a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/semantic_segmentation_dataset.py +++ b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/semantic_segmentation_dataset.py @@ -120,7 +120,7 @@ def make_ss_geodataset( label_vector_default_class_id (Optional[int], optional): If using label_vector_uri and all polygons in that file belong to the same class and they do not contain a `class_id` property, then use this - argument to map all of the polgons to the appropriate class ID. + argument to map all of the polygons to the appropriate class ID. See docs for ClassInferenceTransformer for more details. Defaults to None. image_raster_source_kw (dict, optional): Additional arguments to pass diff --git a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/utils/utils.py b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/utils/utils.py index c46420804..369f9d172 100644 --- a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/utils/utils.py +++ b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/utils/utils.py @@ -58,7 +58,7 @@ def make_image_folder_dataset(data_dir: str, """Initializes and returns an ImageFolder. If classes is specified, ImageFolder's default class-to-index mapping - behavior is overriden to use the indices of classes instead. + behavior is overridden to use the indices of classes instead. """ if classes is None: return DatasetFolder( diff --git a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/visualizer/visualizer.py b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/visualizer/visualizer.py index 0866da8b2..b69e051ae 100644 --- a/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/visualizer/visualizer.py +++ b/rastervision_pytorch_learner/rastervision/pytorch_learner/dataset/visualizer/visualizer.py @@ -197,7 +197,7 @@ def get_batch(self, dataset: 'Dataset', batch_sz: int = 4, This is a convenience method for generating a batch of data to plot. Args: - dataset (Dataset): A Pytorch Datset. + dataset (Dataset): A Pytorch Dataset. batch_sz (int): Batch size. Defaults to 4. **kwargs: Extra args for :class:`~torch.utils.data.DataLoader`. diff --git a/rastervision_pytorch_learner/rastervision/pytorch_learner/learner.py b/rastervision_pytorch_learner/rastervision/pytorch_learner/learner.py index 5d9a1d146..c2b227543 100644 --- a/rastervision_pytorch_learner/rastervision/pytorch_learner/learner.py +++ b/rastervision_pytorch_learner/rastervision/pytorch_learner/learner.py @@ -448,7 +448,7 @@ def on_train_start(self): def train_end(self, outputs: List[Dict[str, Union[float, Tensor]]] ) -> MetricDict: - """Aggregate the ouput of train_step at the end of the epoch. + """Aggregate the output of train_step at the end of the epoch. Args: outputs: a list of outputs of train_step @@ -506,7 +506,7 @@ def validate_step(self, batch: Any, batch_ind: int) -> MetricDict: def validate_end(self, outputs: List[Dict[str, Union[float, Tensor]]] ) -> MetricDict: - """Aggregate the ouput of validate_step at the end of the epoch. + """Aggregate the output of validate_step at the end of the epoch. Args: outputs: a list of outputs of validate_step diff --git a/rastervision_pytorch_learner/rastervision/pytorch_learner/learner_config.py b/rastervision_pytorch_learner/rastervision/pytorch_learner/learner_config.py index 49ed31b10..ca60e7de8 100644 --- a/rastervision_pytorch_learner/rastervision/pytorch_learner/learner_config.py +++ b/rastervision_pytorch_learner/rastervision/pytorch_learner/learner_config.py @@ -228,7 +228,7 @@ class ModelConfig(Config): init_weights: Optional[str] = Field( None, description=('URI of PyTorch model weights used to initialize model. ' - 'If set, this supercedes the pretrained option.')) + 'If set, this supersedes the pretrained option.')) load_strict: bool = Field( True, description=( @@ -414,7 +414,7 @@ def build_optimizer(self, model: nn.Module, **kwargs) -> optim.Adam: **kwargs: Extra args for the optimizer constructor. Returns: - An Adam optimzer instance. + An Adam optimizer instance. """ return optim.Adam(model.parameters(), lr=self.lr, **kwargs) @@ -464,7 +464,7 @@ def build_epoch_scheduler(self, optimizer: optim.Optimizer, last_epoch: int = -1, **kwargs) -> Optional[_LRScheduler]: - """Returns an LR scheduler tha changes the LR each epoch. + """Returns an LR scheduler that changes the LR each epoch. This is used to divide the learning rate by 10 at certain epochs. @@ -705,7 +705,7 @@ def get_custom_albumentations_transforms(self) -> List[dict]: a 'lambda_transforms_path' field contained in this config or in any of its members no matter how deeply neseted. - The pupose is to make it easier to adjust their paths all at once while + The purpose is to make it easier to adjust their paths all at once while saving to or loading from a bundle. """ transforms_all = [ @@ -809,7 +809,7 @@ class ImageDataConfig(DataConfig): None, description='One of the following:\n' '(1) a URI of a directory containing "train", "valid", and ' - '(optinally) "test" subdirectories;\n' + '(optionally) "test" subdirectories;\n' '(2) a URI of a zip file containing (1);\n' '(3) a list of (2);\n' '(4) a URI of a directory containing zip files containing (1).') @@ -1016,18 +1016,18 @@ def get_data_dirs(self, uri: Union[str, List[str]], """Extract data dirs from uri. Data dirs are directories containing "train", "valid", and - (optinally) "test" subdirectories. + (optionally) "test" subdirectories. Args: uri (Union[str, List[str]]): A URI or a list of URIs of one of the following: (1) a URI of a directory containing "train", "valid", and - (optinally) "test" subdirectories + (optionally) "test" subdirectories (2) a URI of a zip file containing (1) (3) a list of (2) (4) a URI of a directory containing zip files containing (1) - unzip_dir (str): Directory where zip files will be extrated to, if + unzip_dir (str): Directory where zip files will be extracted to, if needed. Returns: @@ -1076,7 +1076,7 @@ def unzip_data(self, zip_uris: List[str], unzip_dir: str) -> List[str]: Args: zip_uris (List[str]): A list of URIs of zip files: - unzip_dir (str): Directory where zip files will be extrated to. + unzip_dir (str): Directory where zip files will be extracted to. Returns: List[str]: Paths to directories that each contain contents of one diff --git a/rastervision_pytorch_learner/rastervision/pytorch_learner/utils/utils.py b/rastervision_pytorch_learner/rastervision/pytorch_learner/utils/utils.py index 276b5829a..7c1f39fa7 100644 --- a/rastervision_pytorch_learner/rastervision/pytorch_learner/utils/utils.py +++ b/rastervision_pytorch_learner/rastervision/pytorch_learner/utils/utils.py @@ -368,7 +368,7 @@ def log_metrics_to_csv(csv_path: str, metrics: Dict[str, Any]): def aggregate_metrics( outputs: List[Dict[str, Union[float, torch.Tensor]]], exclude_keys: Container[str] = set('conf_mat')) -> Dict[str, float]: - """Aggregate the ouput of validate_step at the end of the epoch. + """Aggregate the output of validate_step at the end of the epoch. Args: outputs: A list of outputs of Learner.validate_step(). diff --git a/tests/pytorch_learner/test_data_config.py b/tests/pytorch_learner/test_data_config.py index 2a6a0e62c..17f7ee392 100644 --- a/tests/pytorch_learner/test_data_config.py +++ b/tests/pytorch_learner/test_data_config.py @@ -308,7 +308,7 @@ def assertNoError(self, fn: Callable, msg: str = ''): self.fail(msg) def test_window_config(self): - # update() corrrectly initializes size_lims + # update() correctly initializes size_lims args = dict(method=GeoDataWindowMethod.random, size=10) self.assertNoError(lambda: GeoDataWindowConfig(**args)) self.assertEqual(GeoDataWindowConfig(**args).size_lims, (10, 11))