Skip to content

Commit

Permalink
[Fix] Fix a lot of typos (open-mmlab#6190)
Browse files Browse the repository at this point in the history
* pre-commit: Add codespell to look for typos

* fixup! Indentation

* Update lint

* Fix lint

* Fix typo

* Fix comments

Co-authored-by: Christian Clauss <[email protected]>
  • Loading branch information
AronLin and cclauss authored Oct 13, 2021
1 parent c44a058 commit 1a90fa8
Show file tree
Hide file tree
Showing 51 changed files with 95 additions and 95 deletions.
2 changes: 1 addition & 1 deletion configs/instaboost/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ InstaBoost have been already integrated in the data pipeline, thus all you need

## Results and Models

- All models were trained on `coco_2017_train` and tested on `coco_2017_val` for conveinience of evaluation and comparison. In the paper, the results are obtained from `test-dev`.
- All models were trained on `coco_2017_train` and tested on `coco_2017_val` for convenience of evaluation and comparison. In the paper, the results are obtained from `test-dev`.
- To balance accuracy and training time when using InstaBoost, models released in this page are all trained for 48 Epochs. Other training and testing configs strictly follow the original framework.
- For results and models in MMDetection V1.x, please refer to [Instaboost](https://github.com/GothicAi/Instaboost).

Expand Down
2 changes: 1 addition & 1 deletion configs/scnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ The results on COCO 2017val are shown in the below table. (results on test-dev a
### Notes

- Training hyper-parameters are identical to those of [HTC](https://github.com/open-mmlab/mmdetection/tree/master/configs/htc).
- TTA means Test Time Augmentation, which applies horizonal flip and multi-scale testing. Refer to [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/scnet/scnet_r50_fpn_1x_coco.py).
- TTA means Test Time Augmentation, which applies horizontal flip and multi-scale testing. Refer to [config](https://github.com/open-mmlab/mmdetection/tree/master/configs/scnet/scnet_r50_fpn_1x_coco.py).
2 changes: 1 addition & 1 deletion docs/3_exist_data_new_model.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 3: Train with customized models and standard datasets

In this note, you will know how to train, test and inference your own customized models under standard datasets. We use the cityscapes dataset to train a customized Cascade Mask R-CNN R50 model as an example to demonstrate the whole process, which using [`AugFPN`](https://github.com/Gus-Guo/AugFPN) to replace the defalut `FPN` as neck, and add `Rotate` or `Translate` as training-time auto augmentation.
In this note, you will know how to train, test and inference your own customized models under standard datasets. We use the cityscapes dataset to train a customized Cascade Mask R-CNN R50 model as an example to demonstrate the whole process, which using [`AugFPN`](https://github.com/Gus-Guo/AugFPN) to replace the default `FPN` as neck, and add `Rotate` or `Translate` as training-time auto augmentation.

The basic steps are as below:

Expand Down
6 changes: 3 additions & 3 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ In v2.12.0 MMDetection inevitably brings some BC-breakings, including the MMCV d
- Update documentations (#4642, #4650, #4620, #4630)
- Remove redundant code calling `import_modules_from_strings` (#4601)
- Clean deprecated FP16 API (#4571)
- Check whether `CLASSES` is correctly initialized in the intialization of `XMLDataset` (#4555)
- Check whether `CLASSES` is correctly initialized in the initialization of `XMLDataset` (#4555)
- Support batch inference in the inference API (#4462, #4526)
- Clean deprecated warning and fix 'meta' error (#4695)

Expand Down Expand Up @@ -579,7 +579,7 @@ Function `get_subset_by_classes` in dataset is refactored and only filters out i
- Fix the bug of training ATSS when there is no ground truth boxes (#3702)
- Fix the bug of using Focal Loss when there is `num_pos` is 0 (#3702)
- Fix the label index mapping in dataset browser (#3708)
- Fix Mask R-CNN training stuck problem when ther is no positive rois (#3713)
- Fix Mask R-CNN training stuck problem when their is no positive rois (#3713)
- Fix the bug of `self.rpn_head.test_cfg` in `RPNTestMixin` by using `self.rpn_head` in rpn head (#3808)
- Fix deprecated `Conv2d` from mmcv.ops (#3791)
- Fix device bug in RepPoints (#3836)
Expand All @@ -594,7 +594,7 @@ Function `get_subset_by_classes` in dataset is refactored and only filters out i

- Change to use `mmcv.utils.collect_env` for collecting environment information to avoid duplicate codes (#3779)
- Update checkpoint file names to v2.0 models in documentation (#3795)
- Update tutorials for changing runtime settings (#3778), modifing loss (#3777)
- Update tutorials for changing runtime settings (#3778), modifying loss (#3777)
- Improve the function of `simple_test_bboxes` in SABL (#3853)
- Convert mask to bool before using it as img's index for robustness and speedup (#3870)
- Improve documentation of modules and dataset customization (#3821)
Expand Down
4 changes: 2 additions & 2 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ We list some common troubles faced by many users and their corresponding solutio
2. You may also need to check the compatibility between the `setuptools`, `Cython`, and `PyTorch` in your environment.

- "Segmentation fault".
1. Check you GCC version and use GCC 5.4. This usually caused by the incompatibility between PyTorch and the environment (e.g., GCC < 4.9 for PyTorch). We also recommand the users to avoid using GCC 5.5 because many feedbacks report that GCC 5.5 will cause "segmentation fault" and simply changing it to GCC 5.4 could solve the problem.
1. Check you GCC version and use GCC 5.4. This usually caused by the incompatibility between PyTorch and the environment (e.g., GCC < 4.9 for PyTorch). We also recommend the users to avoid using GCC 5.5 because many feedbacks report that GCC 5.5 will cause "segmentation fault" and simply changing it to GCC 5.4 could solve the problem.

2. Check whether PyTorch is correctly installed and could use CUDA op, e.g. type the following command in your terminal.

Expand All @@ -73,7 +73,7 @@ We list some common troubles faced by many users and their corresponding solutio
1. Check if the dataset annotations are valid: zero-size bounding boxes will cause the regression loss to be Nan due to the commonly used transformation for box regression. Some small size (width or height are smaller than 1) boxes will also cause this problem after data augmentation (e.g., instaboost). So check the data and try to filter out those zero-size boxes and skip some risky augmentations on the small-size boxes when you face the problem.
2. Reduce the learning rate: the learning rate might be too large due to some reasons, e.g., change of batch size. You can rescale them to the value that could stably train the model.
3. Extend the warmup iterations: some models are sensitive to the learning rate at the start of the training. You can extend the warmup iterations, e.g., change the `warmup_iters` from 500 to 1000 or 2000.
4. Add gradient clipping: some models requires gradient clipping to stablize the training process. The default of `grad_clip` is `None`, you can add gradient clippint to avoid gradients that are too large, i.e., set `optimizer_config=dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))` in your config file. If your config does not inherits from any basic config that contains `optimizer_config=dict(grad_clip=None)`, you can simply add `optimizer_config=dict(grad_clip=dict(max_norm=35, norm_type=2))`.
4. Add gradient clipping: some models requires gradient clipping to stabilize the training process. The default of `grad_clip` is `None`, you can add gradient clippint to avoid gradients that are too large, i.e., set `optimizer_config=dict(_delete_=True, grad_clip=dict(max_norm=35, norm_type=2))` in your config file. If your config does not inherits from any basic config that contains `optimizer_config=dict(grad_clip=None)`, you can simply add `optimizer_config=dict(grad_clip=dict(max_norm=35, norm_type=2))`.
- ’GPU out of memory"
1. There are some scenarios when there are large amount of ground truth boxes, which may cause OOM during target assignment. You can set `gpu_assign_thr=N` in the config of assigner thus the assigner will calculate box overlaps through CPU when there are more than N GT boxes.
2. Set `with_cp=True` in the backbone. This uses the sublinear strategy in PyTorch to reduce GPU memory cost in the backbone.
Expand Down
2 changes: 1 addition & 1 deletion docs/get_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ If mmcv and mmcv-full are both installed, there will be `ModuleNotFoundError`.
conda install pytorch=1.3.1 cudatoolkit=9.2 torchvision=0.4.2 -c pytorch
```

If you build PyTorch from source instead of installing the prebuilt pacakge,
If you build PyTorch from source instead of installing the prebuilt package,
you can use more CUDA versions such as 9.0.

### Install MMDetection
Expand Down
2 changes: 1 addition & 1 deletion docs/robustness_benchmarking.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pip install imagecorruptions
```

Compared to imagenet-c a few changes had to be made to handle images of arbitrary size and greyscale images.
We also modfied the 'motion blur' and 'snow' corruptions to remove dependency from a linux specific library,
We also modified the 'motion blur' and 'snow' corruptions to remove dependency from a linux specific library,
which would have to be installed separately otherwise. For details please refer to the [imagecorruptions repository](https://github.com/bethgelab/imagecorruptions).

## Inference with pretrained models
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ test_pipeline = [
std=[58.395, 57.12, 57.375],
to_rgb=True),
dict(
type='Pad', # Padding config to pad images divisable by 32.
type='Pad', # Padding config to pad images divisible by 32.
size_divisor=32),
dict(
type='ImageToTensor', # convert image to tensor
Expand Down Expand Up @@ -387,7 +387,7 @@ evaluation = dict( # The config to build the evaluation hook, refer to https://
metric=['bbox', 'segm']) # Metrics used during evaluation
optimizer = dict( # Config used to build optimizer, support all the optimizers in PyTorch whose arguments are also the same as those in PyTorch
type='SGD', # Type of optimizers, refer to https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/optimizer/default_constructor.py#L13 for more details
lr=0.02, # Learning rate of optimizers, see detail usages of the parameters in the documentaion of PyTorch
lr=0.02, # Learning rate of optimizers, see detail usages of the parameters in the documentation of PyTorch
momentum=0.9, # Momentum
weight_decay=0.0001) # Weight decay of SGD
optimizer_config = dict( # Config used to build the optimizer hook, refer to https://github.com/open-mmlab/mmcv/blob/master/mmcv/runner/hooks/optimizer.py#L8 for implementation details.
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/customize_dataset.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ The annotation json files in COCO format has the following necessary keys:

There are three necessary keys in the json file:

- `images`: contains a list of images with their informations like `file_name`, `height`, `width`, and `id`.
- `images`: contains a list of images with their information like `file_name`, `height`, `width`, and `id`.
- `annotations`: contains the list of instance annotations.
- `categories`: contains the list of categories names and their ID.

Expand Down Expand Up @@ -157,7 +157,7 @@ We use this way to support CityScapes dataset. The script is in [cityscapes.py](
**Note**

1. For instance segmentation datasets, **MMDetection only supports evaluating mask AP of dataset in COCO format for now**.
2. It is recommanded to convert the data offline before training, thus you can still use `CocoDataset` and only need to modify the path of annotations and the training classes.
2. It is recommended to convert the data offline before training, thus you can still use `CocoDataset` and only need to modify the path of annotations and the training classes.

### Reorganize new data format to middle format

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/customize_runtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ custom_hooks = [dict(type='NumClassCheckHook')]

### Modify default runtime hooks

There are some common hooks that are not registerd through `custom_hooks`, they are
There are some common hooks that are not registered through `custom_hooks`, they are

- log_config
- checkpoint_config
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/onnx2tensorrt.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- [Prerequisite](#prerequisite)
- [Usage](#usage)
- [How to evaluate the exported models](#how-to-evaluate-the-exported-models)
- [List of supported models convertable to TensorRT](#list-of-supported-models-convertable-to-tensorrt)
- [List of supported models convertible to TensorRT](#list-of-supported-models-convertible-to-tensorrt)
- [Reminders](#reminders)
- [FAQs](#faqs)

Expand Down Expand Up @@ -73,9 +73,9 @@ Please refer to following links for more information.
- [how-to-evaluate-the-exported-models](pytorch2onnx.md#how-to-evaluate-the-exported-models)
- [results-and-models](pytorch2onnx.md#results-and-models)

## List of supported models convertable to TensorRT
## List of supported models convertible to TensorRT

The table below lists the models that are guaranteed to be convertable to TensorRT.
The table below lists the models that are guaranteed to be convertible to TensorRT.

| Model | Config | Dynamic Shape | Batch Inference | Note |
| :----------: | :--------------------------------------------------: | :-----------: | :-------------: | :---: |
Expand Down
2 changes: 1 addition & 1 deletion docs/useful_tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ curl -O curl -O https://raw.githubusercontent.com/pytorch/serve/master/docs/imag
curl http://127.0.0.1:8080/predictions/${MODEL_NAME} -T 3dogs.jpg
```

You should obtain a respose similar to:
You should obtain a response similar to:

```json
[
Expand Down
2 changes: 1 addition & 1 deletion docs_zh-CN/1_exist_data_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ bash tools/dist_test.sh \
- `--show-dir`: 如果指明,检测结果将会被绘制在图像上并保存到指定目录。它只适用于单 GPU 的测试,是用于调试和可视化的。即使你的环境中没有 GUI,这个选项也可使用。
- `--show-score-thr`: 如果指明,得分低于此阈值的检测结果将会被移除。
- `--cfg-options`: 如果指明,这里的键值对将会被合并到配置文件中。
- `--eval-options`: 如果指明,这里的键值对将会作为字典参数被传入 `dataset.evalutation()` 函数中,仅在测试阶段使用。
- `--eval-options`: 如果指明,这里的键值对将会作为字典参数被传入 `dataset.evaluation()` 函数中,仅在测试阶段使用。

### 样例

Expand Down
4 changes: 2 additions & 2 deletions docs_zh-CN/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

1. 检查您正常安装了 CUDA runtime (一般在`/usr/local/`),或者使用 `nvcc --version` 检查本地版本,有时安装 PyTorch 会顺带安装一个 CUDA runtime,并且实际优先使用 conda 环境中的版本,你可以使用 `conda list cudatoolkit` 查看其版本。

2. 编译 extention 的 CUDA Toolkit 版本与运行时的 CUDA Toolkit 版本是否相符,
2. 编译 extension 的 CUDA Toolkit 版本与运行时的 CUDA Toolkit 版本是否相符,

* 如果您从源码自己编译的,使用 `python mmdet/utils/collect_env.py` 检查编译编译 extention 的 CUDA Toolkit 版本,然后使用 `conda list cudatoolkit` 检查当前 conda 环境是否有 CUDA Toolkit,若有检查版本是否匹配, 如不匹配,更换 conda 环境的 CUDA Toolkit,或者使用匹配的 CUDA Toolkit 中的 nvcc 编译即可,如环境中无 CUDA Toolkit,可以使用 `nvcc -V`
* 如果您从源码自己编译的,使用 `python mmdet/utils/collect_env.py` 检查编译编译 extension 的 CUDA Toolkit 版本,然后使用 `conda list cudatoolkit` 检查当前 conda 环境是否有 CUDA Toolkit,若有检查版本是否匹配, 如不匹配,更换 conda 环境的 CUDA Toolkit,或者使用匹配的 CUDA Toolkit 中的 nvcc 编译即可,如环境中无 CUDA Toolkit,可以使用 `nvcc -V`

等命令查看当前使用的 CUDA runtime。

Expand Down
2 changes: 1 addition & 1 deletion docs_zh-CN/model_zoo.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
- 我们使用分布式训练。
- 所有 pytorch-style 的 ImageNet 预训练主干网络来自 PyTorch 的模型库,caffe-style 的预训练主干网络来自 detectron2 最新开源的模型。
- 为了与其他代码库公平比较,文档中所写的 GPU 内存是8个 GPU 的 `torch.cuda.max_memory_allocated()` 的最大值,此值通常小于 nvidia-smi 显示的值。
- 我们以网络 foward 和后处理的时间加和作为推理时间,不包含数据加载时间。所有结果通过 [benchmark.py](https://github.com/open-mmlab/mmdetection/blob/master/tools/analysis_tools/benchmark.py) 脚本计算所得。该脚本会计算推理 2000 张图像的平均时间。
- 我们以网络 forward 和后处理的时间加和作为推理时间,不包含数据加载时间。所有结果通过 [benchmark.py](https://github.com/open-mmlab/mmdetection/blob/master/tools/analysis_tools/benchmark.py) 脚本计算所得。该脚本会计算推理 2000 张图像的平均时间。

## ImageNet 预训练模型

Expand Down
4 changes: 2 additions & 2 deletions mmdet/core/anchor/anchor_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ def single_level_grid_anchors(self,
'Please use ``single_level_grid_priors`` ')

# keep featmap_size as Tensor instead of int, so that we
# can covert to ONNX correctly
# can convert to ONNX correctly
feat_h, feat_w = featmap_size
shift_x = torch.arange(0, feat_w, device=device) * stride[0]
shift_y = torch.arange(0, feat_h, device=device) * stride[1]
Expand Down Expand Up @@ -630,7 +630,7 @@ class LegacyAnchorGenerator(AnchorGenerator):
relative to the feature grid center in multiple feature levels.
By default it is set to be None and not used. It a list of float
is given, this list will be used to shift the centers of anchors.
center_offset (float): The offset of center in propotion to anchors'
center_offset (float): The offset of center in proportion to anchors'
width and height. By default it is 0.5 in V2.0 but it should be 0.5
in v1.x models.
Expand Down
2 changes: 1 addition & 1 deletion mmdet/core/bbox/assigners/grid_assigner.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def assign(self, bboxes, box_responsible_flags, gt_bboxes, gt_labels=None):

# 3. assign positive: falls into responsible cell and above
# positive IOU threshold, the order matters.
# the prior condition of comparision is to filter out all
# the prior condition of comparison is to filter out all
# unrelated anchors, i.e. not box_responsible_flags
overlaps[:, ~box_responsible_flags.type(torch.bool)] = -1.

Expand Down
4 changes: 2 additions & 2 deletions mmdet/core/bbox/coder/bucketing_bbox_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def bbox2bucket(proposals,
t_offsets = (t_buckets - gy1[:, None]) / bucket_h[:, None]
d_offsets = (d_buckets - gy2[:, None]) / bucket_h[:, None]

# select top-k nearset buckets
# select top-k nearest buckets
l_topk, l_label = l_offsets.abs().topk(
offset_topk, dim=1, largest=False, sorted=True)
r_topk, r_label = r_offsets.abs().topk(
Expand All @@ -212,7 +212,7 @@ def bbox2bucket(proposals,
offset_d_weights = d_offsets.new_zeros(d_offsets.size())
inds = torch.arange(0, proposals.size(0)).to(proposals).long()

# generate offset weights of top-k nearset buckets
# generate offset weights of top-k nearest buckets
for k in range(offset_topk):
if k >= 1:
offset_l_weights[inds, l_label[:,
Expand Down
2 changes: 1 addition & 1 deletion mmdet/core/evaluation/mean_ap.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def eval_map(det_results,
iou_thr (float): IoU threshold to be considered as matched.
Default: 0.5.
dataset (list[str] | str | None): Dataset name or dataset classes,
there are minor differences in metrics for different datsets, e.g.
there are minor differences in metrics for different datasets, e.g.
"voc07", "imagenet_det", etc. Default: None.
logger (logging.Logger | str | None): The way to print the mAP
summary. See `mmcv.utils.print_log()` for details. Default: None.
Expand Down
4 changes: 2 additions & 2 deletions mmdet/core/post_processing/matrix_nms.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ def mask_matrix_nms(masks,
- scores (Tensor): Updated scores, has shape (n,).
- labels (Tensor): Remained labels, has shape (n,).
- masks (Tensor): Remained masks, has shape (n, w, h).
- keep_inds (Tensor): The indexs number of
the remaining mask in the input mask, has shape (n,).
- keep_inds (Tensor): The indices number of
the remaining mask in the input mask, has shape (n,).
"""
assert len(labels) == len(masks) == len(scores)
if len(labels) == 0:
Expand Down
2 changes: 1 addition & 1 deletion mmdet/datasets/pipelines/test_time_aug.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def __init__(self,
flip_direction='horizontal'):
self.transforms = Compose(transforms)
assert (img_scale is None) ^ (scale_factor is None), (
'Must have but only one variable can be setted')
'Must have but only one variable can be set')
if img_scale is not None:
self.img_scale = img_scale if isinstance(img_scale,
list) else [img_scale]
Expand Down
Loading

0 comments on commit 1a90fa8

Please sign in to comment.