From 447a398c24f76be71b8851183a347ff181e5a1c1 Mon Sep 17 00:00:00 2001 From: Junhwa Song Date: Wed, 15 Mar 2023 00:56:40 +0900 Subject: [PATCH] [Typo] Change indexes to indices (#2747) ## Modification I just replaced the `indexes` variable name with `indices` for naming consistency. --- mmseg/datasets/dataset_wrappers.py | 8 ++++---- mmseg/datasets/transforms/transforms.py | 8 ++++---- .../tools/dataset_converters/mapillary.py | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mmseg/datasets/dataset_wrappers.py b/mmseg/datasets/dataset_wrappers.py index 933eb50d9..082c116ff 100644 --- a/mmseg/datasets/dataset_wrappers.py +++ b/mmseg/datasets/dataset_wrappers.py @@ -106,11 +106,11 @@ class MultiImageMixDataset: continue if hasattr(transform, 'get_indices'): - indexes = transform.get_indices(self.dataset) - if not isinstance(indexes, collections.abc.Sequence): - indexes = [indexes] + indices = transform.get_indices(self.dataset) + if not isinstance(indices, collections.abc.Sequence): + indices = [indices] mix_results = [ - copy.deepcopy(self.dataset[index]) for index in indexes + copy.deepcopy(self.dataset[index]) for index in indices ] results['mix_results'] = mix_results diff --git a/mmseg/datasets/transforms/transforms.py b/mmseg/datasets/transforms/transforms.py index ef4e78dd8..4f5316026 100644 --- a/mmseg/datasets/transforms/transforms.py +++ b/mmseg/datasets/transforms/transforms.py @@ -1029,17 +1029,17 @@ class RandomMosaic(BaseTransform): return results def get_indices(self, dataset: MultiImageMixDataset) -> list: - """Call function to collect indexes. + """Call function to collect indices. Args: dataset (:obj:`MultiImageMixDataset`): The dataset. Returns: - list: indexes. + list: indices. """ - indexes = [random.randint(0, len(dataset)) for _ in range(3)] - return indexes + indices = [random.randint(0, len(dataset)) for _ in range(3)] + return indices @cache_randomness def generate_mosaic_center(self): diff --git a/projects/mapillary_dataset/tools/dataset_converters/mapillary.py b/projects/mapillary_dataset/tools/dataset_converters/mapillary.py index 3ccb2d67b..a881564ca 100644 --- a/projects/mapillary_dataset/tools/dataset_converters/mapillary.py +++ b/projects/mapillary_dataset/tools/dataset_converters/mapillary.py @@ -106,7 +106,7 @@ def mapillary_colormap2label(colormap: np.ndarray) -> list: Returns: list: values are mask labels, - indexes are palette's convert results.、 + indices are palette's convert results. """ colormap2label = np.zeros(256**3, dtype=np.longlong) for i, colormap_ in enumerate(colormap):