Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【Hackathon No.153】PaddleRS 英文文档 #113

Merged
merged 19 commits into from
Mar 30, 2023

Conversation

lizechng
Copy link
Contributor

PR types

Others

PR changes

Others

Description

  • 将 PaddleRS docs 目录中包含的文档内容翻译为英文,并形成相应英文文档
  • 为 PaddleRS tutorials 目录中的示例脚本添加英文注释

Copy link
Member

@Bobholamovic Bobholamovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

感谢你为PaddleRS贡献文档。我留了一些小建议,请先看看~ 目前的review还不完整,待这次修改完成后我会进一步进行review。


## Contribute code

This guide starts with the steps necessary to contribute code to PaddleRS, and then goes into detail on new file self-review, code style specification, and testing steps.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

steps necessary -> necessary steps


## Contribute code

This guide starts with the steps necessary to contribute code to PaddleRS, and then goes into detail on new file self-review, code style specification, and testing steps.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new file self-review -> self-inspection on newly added files


This guide starts with the steps necessary to contribute code to PaddleRS, and then goes into detail on new file self-review, code style specification, and testing steps.

### 1 Code contribution steps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

标题每个实词的首字母需要大写。
请同步修改PR中其他部分。


### 1 Code contribution steps

PaddleRS uses [git](https://git-scm.com/doc) as a version control tool and is hosted on GitHub. This means that you need to be familiar with git before contributing code, and understand [pull request (PR)](https://docs.github.com/cn/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) based on the GitHub workflow.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

, and understand这半句建议拆成一个独立的句子。

docs/CONTRIBUTING_en.md Outdated Show resolved Hide resolved
|Parameter Name|Type|Parameter Description|Default Value|
|-------|----|--------|-----|
|`data_dir`|`str`|Dataset storage directory.||
|`file_list`|`str`|file list path. file list is a text file, in which each line contains the path infomation of sample.The specific requirements of `CDDataset` on the file list are listed below.||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请注意标点符号之后空一格。
请同步检查PR中的其它部分。后续不再重复。

|`file_list`|`str`|file list path. file list is a text file, in which each line contains the path infomation of sample.The specific requirements of `CDDataset` on the file list are listed below.||
|`transforms`|`paddlers.transforms.Compose`|Data transformation operator applied to input data.||
|`label_list`|`str` \| `None`|label list file. label list is a text file, in which each line contains the name of class.|`None`|
|`num_workers`|`int` \| `str`|The number of worker processes used when loading data. If it is set to `'auto'`, the following rules determine the number of processes to use:When the number of CPU cores is greater than 16, 8 data read helper processes are used; Otherwise, use CPU cores to count half as many worker processes.|`'auto'`|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里翻译好像不太对,请检查。另外请同步检查PR中其它涉及num_workers解释的部分。

|`label_list`|`str` \| `None`|label list file. label list is a text file, in which each line contains the name of class.|`None`|
|`num_workers`|`int` \| `str`|The number of worker processes used when loading data. If it is set to `'auto'`, the following rules determine the number of processes to use:When the number of CPU cores is greater than 16, 8 data read helper processes are used; Otherwise, use CPU cores to count half as many worker processes.|`'auto'`|
|`shuffle`|`bool`|Whether to randomly shuffle the samples in the dataset.|`False`|
|`with_seg_labels`|`bool`|Specify this option as `True` when the dataset contains split labels for each phase.|`False`|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

split labels翻译是否准确?

|`num_workers`|`int` \| `str`|The number of worker processes used when loading data. If it is set to `'auto'`, the following rules determine the number of processes to use:When the number of CPU cores is greater than 16, 8 data read helper processes are used; Otherwise, use CPU cores to count half as many worker processes.|`'auto'`|
|`shuffle`|`bool`|Whether to randomly shuffle the samples in the dataset.|`False`|
|`with_seg_labels`|`bool`|Specify this option as `True` when the dataset contains split labels for each phase.|`False`|
|`binarize_labels`|`bool`|If it is `True`, the change label (and split label) is binarized after all data transformation operators except `Arrange` are processed. For example, binarize a tag with the value {0, 255} to {0, 1}.|`False`|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

一个像素点为一个label,所以label应该是复数(或者用label image)。

|`with_seg_labels`|`bool`|Specify this option as `True` when the dataset contains split labels for each phase.|`False`|
|`binarize_labels`|`bool`|If it is `True`, the change label (and split label) is binarized after all data transformation operators except `Arrange` are processed. For example, binarize a tag with the value {0, 255} to {0, 1}.|`False`|

The requirments of `CDDataset` for the file list are as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: requirments,请同步检查PR中其他部分。

@lizechng
Copy link
Contributor Author

您好,已进行修改

@Bobholamovic
Copy link
Member

我注意到好像还没有修改完全~ 建议可以逐条回复review意见,以免遗漏。

@lizechng
Copy link
Contributor Author

这两个不知道目前的翻译是否可以?其余均已按照意见完成修改~

@lizechng
Copy link
Contributor Author

Copy link
Member

@Bobholamovic Bobholamovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

留了一些意见


## Contribute Code

This guide starts with the necessary steps to contribute code to PaddleRS, and then goes into detail on self-inspection on newly added files, code style specification, and testing steps.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

detail -> details


The steps to contribute code to PaddleRS are as follows:

1. Fork the official PaddleRS repository on GitHub, clone the code locally, and pull up the latest version of the develop branch.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pull up -> pull

2. Write code according to [dev Guide](dev/dev_guide.md) (it is recommended to develop on a new feature branch).
3. Install pre-commit hooks to perform code style checks before each commit. Refer to [Code style specification](#3-Code style specification).
4. Write unit tests for the new code and make sure all the tests are successful. Refer to [Test related steps](#4-Test related steps)。
5. Create a new PR for your branch to ensure that the CLA protocol is signed and the CI/CE passes. After that, a PaddleRS team member will review the code you contributed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to ensure -> and ensure

5. Create a new PR for your branch to ensure that the CLA protocol is signed and the CI/CE passes. After that, a PaddleRS team member will review the code you contributed.
6. Modify the code according to the review and resubmit it until PR is merged or closed.

If you contribute code that uses a third-party library that PaddleRS does not currently rely on, please explain when you submit your PR and explain why you need to use this third-party library.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

`your PR. Also, you should explain why this third-party library should be used.


#### 2.2 The Order of Module Import

All global import statements must be at the beginning of the module, after the copyright information. Import packages or modules in the following order:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

after -> right after

|`allow_empty`|`bool`|Whether to add negative samples to the dataset.|`False`|
|`empty_ratio`|`float`|Negative sample ratio, take effect only if `allow_empty` is `True`. If `empty_ratio` is negative or greater than or equal to 1, all negative samples generated are retained.|`1.0`|

The requirments of `VOCDetDataset` for the file list are as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requirments拼写错误。

请同步检查并修改PR中其它位置。

|`transforms`|`paddlers.transforms.Compose`|Data transformation operator applied to input data.||
|`num_workers`|`int` \| `str`|The number of auxiliary processes used when loading data. If it is set to `'auto'`, the following rules determine the number of processes to use:When the number of CPU cores is greater than 16, 8 data read auxiliary processes are used; Otherwise, use CPU cores to count half as many auxiliary processes.|`'auto'`|
|`shuffle`|`bool`|Whether to randomly shuffle the samples in the dataset.|`False`|
|`sr_factor`|`int` \| `None`|For super resolution reconstruction task, specify as super resolution multiple; For other tasks, specify as `None`.|`None`|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For super resolution reconstruction tasks, this is the scaling factor. For other tasks, please specify sr_factor as None.


Remote sensing images come from various sources and their data formats are very complicated. PaddleRS provides a unified interface for reading remote sensing images of different types and formats. At present, PaddleRS can read common file formats such as .png, .jpg, .bmp and .npy, as well as handle GeoTiff, img and other image formats commonly used in remote sensing.

According to the actual demand, the user can choose `paddlers.transforms.decode_image()` or `paddlers.transforms.DecodeImg` to read data. `DecodeImg` is one of[Data transformation operators](#Data transformation operators), can be combined with other operators. `decode_image` is the encapsulation of `DecodeImg` operator, which is convenient use in the way of function calls.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the actual demand -> Depending on the practical demands


Remote sensing images come from various sources and their data formats are very complicated. PaddleRS provides a unified interface for reading remote sensing images of different types and formats. At present, PaddleRS can read common file formats such as .png, .jpg, .bmp and .npy, as well as handle GeoTiff, img and other image formats commonly used in remote sensing.

According to the actual demand, the user can choose `paddlers.transforms.decode_image()` or `paddlers.transforms.DecodeImg` to read data. `DecodeImg` is one of[Data transformation operators](#Data transformation operators), can be combined with other operators. `decode_image` is the encapsulation of `DecodeImg` operator, which is convenient use in the way of function calls.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ofData transformation operators之间缺少空格


According to the actual demand, the user can choose `paddlers.transforms.decode_image()` or `paddlers.transforms.DecodeImg` to read data. `DecodeImg` is one of[Data transformation operators](#Data transformation operators), can be combined with other operators. `decode_image` is the encapsulation of `DecodeImg` operator, which is convenient use in the way of function calls.

The argument lish of `decode_image()` function is as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo:lish

@lizechng
Copy link
Contributor Author

已按照上述意见修改~

Copy link
Member

@Bobholamovic Bobholamovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现先前轮次已接受的review意见并未完全得到落实。例如,

标题每个实词的首字母需要大写。

分号后面的单词首字母无需大写。

保证PR质量是最重要的,因此,请确认对先前轮次的review意见已经完全修改完毕后再请求review,否则我们可能会花费更多时间。为避免遗漏,后续将在先前review意见均已收到回复或完全得到落实的前提下继续给出新的review意见,感谢理解~

#### 4.1 model Single Test

1. Find the test case definition file corresponding to the task of the model in `tests/rs_models/`, for example, the change detection task corresponding to `tests/rs_models/test_cd_models.py`.
2. Define a Test class for the new Model that inherits from `Test{task name}Model` and sets its `MODEL_CLASS` property to the new model, following the example already in the file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

此处尚未修改或回复

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
这句话里的TM需要小写哈


If your contribution includes TIPC, please submit your PR with a log indicating successful execution of the TIPC basic training chain.

## Contribution an Example
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contribution -> Contribute


### Scenario Classification Dataset `ClasDataset`

`ClasDataset` is define in: https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/datasets/clas_dataset.py
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: defined
请同步检查并修改PR中其它位置。

The return format is as follows:

- If `read_geo_info` is `False`, the image data ([h, w, c] arrangement) is returned in the format of np.ndarray.
- If `read_geo_info` is `True`, a binary group is returned, in which the first element is the image data read, the second element is a dictionary, in which the key-value pair is the geographic information of the image, such as geographic transformation information, geographic projection information, etc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

binary group -> two-tuple

|`decode_bgr`|`bool`|If `True`, automatically parses non-geo format images (such as jpeg images) into BGR format.|`True`|
|`decode_sar`|`bool`|If `True`, single-channel geo-format images (such as GeoTiff images) are automatically parsed as SAR images.|`True`|
|`read_geo_info`|`bool`|If `True`, the geographic information is read from the image.|`False`|
|`use_stretch`|`bool`|Whether to stretch the image brightness by 2% linear. Take effect only if `to_uint8` is `True`.|`False`|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whether to apply a linear stretch to image brightness (with 2% max and min values removed).

T.Resize(target_size=512),
# Perform a random horizontal flip with a 50% probability
T.RandomHorizontalFlip(prob=0.5),
# Normalized data to [-1,1]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

无需过去式

])
```

Generally, in the list of `Compose` object accepted data transform operators, the first element is `paddlers.Transforms.DecodeImg` object, used to read image data; The last element is [`Arrange` Operator](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/transforms/operators.py, used to extract and arrange information from the `sample` dictionary.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the list of Compose object accepted data transform operators -> in the list of data transform operators accepted by a Compose object


Generally, in the list of `Compose` object accepted data transform operators, the first element is `paddlers.Transforms.DecodeImg` object, used to read image data; The last element is [`Arrange` Operator](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/transforms/operators.py, used to extract and arrange information from the `sample` dictionary.

For the verification set of image segmentation task and change detection task, the `ReloadMask` operator can be inserted before the `Arrange` operator to reload the GT label. The following is an example:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

『验证集』的翻译为『validation dataset』
请同步检查并修改PR中其它位置


Generally, in the list of `Compose` object accepted data transform operators, the first element is `paddlers.Transforms.DecodeImg` object, used to read image data; The last element is [`Arrange` Operator](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/transforms/operators.py, used to extract and arrange information from the `sample` dictionary.

For the verification set of image segmentation task and change detection task, the `ReloadMask` operator can be inserted before the `Arrange` operator to reload the GT label. The following is an example:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外之前好像没有出现过GT的全称

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

表格标题的大小写风格不统一,如:link是实词,也需要首字母大写

@lizechng
Copy link
Contributor Author

感谢您的审阅~

Copy link
Member

@Bobholamovic Bobholamovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

请根据review意见修改或回复意见。

#### 4.1 model Single Test

1. Find the test case definition file corresponding to the task of the model in `tests/rs_models/`, for example, the change detection task corresponding to `tests/rs_models/test_cd_models.py`.
2. Define a Test class for the new Model that inherits from `Test{task name}Model` and sets its `MODEL_CLASS` property to the new model, following the example already in the file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image
这句话里的TM需要小写哈

python setup.py install
```

If the download dependence is slow or times out when using `python setup.py install`, you can create `setup.cfg` in the same directory as `setup.py` and input the following content, then the download can be accelerated through Tsinghua source:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the download dependence -> the downloading of dependencies

and input the following content -> with the following content


+ (Optional) GDAL installation

PaddleRS supports reading of various types of satellite data. To fully use PaddleRS remote sensing data reading function, you need to install GDAL as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To fully use PaddleRS remote sensing data reading function -> To use the full data reading functionality of PaddleRS


- Windows

Windows users can download the Python and system version corresponding to the .whl format installation package from [this](https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal) to local, take *GDAL‑3.3.3‑cp39‑cp39‑win_amd64.whl* as an example, use the pip tool installation:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Windows users can download GDAL wheels from this site. Please choose the wheel according to the Python version and the platform. Take GDAL‑3.3.3‑cp39‑cp39‑win_amd64.whl as an example, run the following command to install:

docker pull paddlepaddle/paddlers:1.0.0
```

- (Optional) Build from scratch. Multiple base images for PaddlePaddle can be selected by setting `PPTAG` to build cpus or different GPU environments:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Select the base image for PaddlePaddle by setting PPTAG. You can build the image in a CPU-only environment or in GPU environments

|`model_dir`|`str`|Model path (must be an exported deployed or quantified model).||
|`use_gpu`|`bool`|Whether to use GPU.|`False`|
|`gpu_id`|`int`|ID of the GPU used.|`0`|
|`cpu_thread_num`|`int`|The number of threads when inference is performed using the CPU.|`1`|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the CPU -> CPUs


|Parameter Name|Type|Parameter Description|Default Value|
|-------|----|--------|-----|
|`img_file`|`list[str\|tuple\|np.ndarray]` \| `str` \| `tuple` \| `np.ndarray`|For scene classification, object detection, image restoration and image segmentation tasks, this parameter can be a single image path, or a decoded image data in [h, w, c] with a float32 type (expressed as NumPy array), or a list of image paths or np.ndarray objects. For the change detection task, the parameter can be a binary group of image path (representing the two time phase image paths respectively), or a binary group composed of two decoded images, or a list composed of one of the above two binary groups.||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

binary group -> two-tuple

|-------|----|--------|-----|
|`img_file`|`list[str\|tuple\|np.ndarray]` \| `str` \| `tuple` \| `np.ndarray`|For scene classification, object detection, image restoration and image segmentation tasks, this parameter can be a single image path, or a decoded image data in [h, w, c] with a float32 type (expressed as NumPy array), or a list of image paths or np.ndarray objects. For the change detection task, the parameter can be a binary group of image path (representing the two time phase image paths respectively), or a binary group composed of two decoded images, or a list composed of one of the above two binary groups.||
|`topk`|`int`|It is used in scenario classification model prediction, indicating that the category with the top `topk` in the output probability of the model is selected as the final result.|`1`|
|`transforms`|`paddlers.transforms.Compose`\|`None`|Apply data transformation operator to input data. If `None`, the operators read from 'model.yml' is used.|`None`|
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

operator加复数。


### `Predictor.slider_predict()`

Realize the sliding window inference function. It is used in the same way as `BaseSegmenter` and `slider_predict()` of `BaseChangeDetector`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realize -> Implements

|-------|----|--------|-----|
|`img_file`|`str`|Input image path.||
|`save_dir`|`str`|Predict results output path.||
|`block_size`|`list[int]` \| `tuple[int]` \| `int`|The size of the slide window (specifying the width, height in a list or tuple, or the same width and height in an integer).||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

各个文档中表格里的description,有的时候省略句首的定冠词,有的时候没有。请统一一下风格吧

@lizechng
Copy link
Contributor Author

@Bobholamovic
Copy link
Member

  1. 嗯嗯,这样的话这两处可以改成完成时~

Copy link
Member

@Bobholamovic Bobholamovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

发现先前轮次已接受的review意见并未完全得到落实,如:

各个文档中表格里的description,有的时候省略句首的定冠词,有的时候没有。

请在完成修改后再request review~


+ PaddleRS installation

The PaddleRS code will be updated as the development progresses. You can install code for the develop branch to use the latest features as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

install code for the develop branch -> install the develop branch


All trainers support default parameter construction (that is, no parameters are passed in when the object is constructed), in which case the constructed trainer object applies to three-channel RGB data.

### Initialize `BaseChangeDetector` Sub-Class Object
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sub-Class中间建议不添加连字符(添加连字符的写法很少见),写为Subclass。请同步检查并修改PR中的其它位置。

@@ -0,0 +1,420 @@
# PaddleRS Training API Description

**Trainer** encapsulates model training, validation, quantization, and dynamic graph inference, defined in files of `paddlers/tasks/` directory. For user convenience, PaddleRS provides trainer that inherits from the parent class [`BaseModel`](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/base.py) for all supported models, and provides several apis externally. The types of trainers corresponding to change detection, scene classification, target detection, image restoration and image segmentation tasks are respectively `BaseChangeDetector`、`BaseClassifier`、`BaseDetector`、`BaseRestorer` and `BaseSegmenter`。This document describes the initialization function of the trainer and `train()`、`evaluate()` API。
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

provides trainer -> provides trainers

- The `num_classes`、`use_mixed_loss` and `in_channels` parameters are generally supported, indicating the number of model output categories, whether to use preset mixing losses, and the number of input channels, respectively. Some sub-classes, such as `DSIFN`, do not yet support `in_channels`.
- `use_mixed_loss` will be deprecated in the future, so it is not recommended.
- Specify the loss function used during model training through the `losses` parameter. `losses` needs to be a dictionary, where the values for the keys `types` and `coef` are two equal-length lists representing the loss function object (a callable object) and the weight of the loss function, respectively. For example: `losses={'types': [LossType1(), LossType2()], 'coef': [1.0, 0.5]}`. It is equivalent to calculating the following loss function in the training process: `1.0*LossType1()(logits, labels)+0.5*LossType2()(logits, labels)`, where `logits` and `labels` are model output and GT labels, respectively.
- Different sub-classes support model-related input parameters, for details, refer to [Model definition](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/rs_models/cd) and [Trainer definition](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

refer to [model definitions](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/rs_models/cd) and [trainer definitions](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py)


### Initialize `BaseDetector` Sub-Class Object

- Generally, the `num_classes` and `backbone` parameters can be set to indicate the number of output categories of the model and the type of backbone network used respectively. Compared with other tasks, the trainer of object detection task supports more initialization parameters, including network structure, loss function, post-processing strategy and so on.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

respectively之前需要加逗号


- Generally, the `num_classes` and `backbone` parameters can be set to indicate the number of output categories of the model and the type of backbone network used respectively. Compared with other tasks, the trainer of object detection task supports more initialization parameters, including network structure, loss function, post-processing strategy and so on.
- Different from tasks such as segmentation, classification and change detection, detection tasks do not support the loss function specified through the `losses` parameter. However, for some trainers such as `PPYOLO`, the loss function can be customized by `use_iou_loss` and other parameters.
- Different sub-classes support model-related input parameters, for details, refer to [Model definition](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/rs_models/det) and [Trainer definition](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/object_detector.py).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里需要拆成两句话写,或者使用从句,要不然有语法错误(一个句子无连词两个谓语)。
请同步检查并修改PR中的其它位置。


### Initialize `BaseRestorer` Sub-Class Object

- Generally support setting `sr_factor` parameter, representing super resolution multiple; for models that do not support super resolution rebuild tasks, `sr_factor` is set to `None`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

super resolution multiple -> the scaling factor in image super resolution

@lizechng
Copy link
Contributor Author

发现先前轮次已接受的review意见并未完全得到落实,如:

各个文档中表格里的description,有的时候省略句首的定冠词,有的时候没有。

请在完成修改后再request review~

  • 文档中表格里的description已统一为省略句首的定冠词
  • 其他意见已修改~

Copy link
Member

@Bobholamovic Bobholamovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

留了一些意见

"""
```

### 1.3 Edit Trainer
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Write Trainer Definitions


4. Add the class name of the new trainer to the global variable `__all__`.

It should be noted that for the image restoration task, the forward and reverse logic of the model are implemented in the trainer definition. For GAN and other models that need to use multiple networks, please refer to the following specifications for the preparation of the trainer:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverse -> backward

- Override the `default_loss()` method to build the loss function. If more than one loss function is required in the training process, it is recommended to organize in the form of a dictionary.
- Override the `default_optimizer()` method to build one or more optimizers. When `build_net()` returns a value of type `GANAdapter`, `parameters` is a dictionary. Where, `parameters['params_g']` is a list containing the state dict of the various generators in order; `parameters['params_d']` is a list that contains the state dict of the individual discriminators in order. If you build more than one optimizer, you should use the `OptimizerAdapter` wrapper on return.
- Override the `run_gan()` method that accepts four parameters: `net`, `inputs`, `mode`, and `gan_mode` for one of the subtasks in the training process, e.g. forward calculation of generator, forward calculation of discriminator, etc.
- Rewrite `train_step()` method to write the specific logic of one iteration during model training. The usual approach is to call `run_gan()` over and over again, constructing different `inputs` to work in different `gan_mode` as needed each time, extracting useful fields (e.g. losses) from the `outputs` dictionary returned each time and summarizing them into the final result.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

over and over again -> multiple times


### 2.2 Add Data Preprocessing/Data Augmentation Operators

Define new operators in `paddlers/transforms/operators.py`, all operators are inherited from `paddlers.transforms.Transform`. The operator's `apply()` method receives a dictionary `sample` as input, takes out the related objects stored in it, and makes in-place modifications to the dictionary after processing, and finally returns the modified dictionary. Only in rare cases do we need to override the `apply()` method when defining an operator. In most cases, you just need to override the `apply_im()`, `apply_mask()`, `apply_bbox()`, and `apply_segm()` methods to handle the image, split label, target box, and target polygon, respectively.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are inherited from -> inherit from


If processing logic is more complicated, it is recommended that the encapsulated in the first function, added to the `paddlers/transforms/functions.py`, then call the function in the `apply*()` of operators.

After writing the implementation of the operator, **must write docstring and add the class name in `__all__`.**
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

must前面加you


Band combination refers to the result obtained by selecting three band data in MSI/HSI to combine and replace the three RGB channels, which is called the color graph (*The result synthesized using the real RGB three bands is called the true color graph, otherwise it is called the false color graph*). The combination of different bands can highlight different features of ground objects. The following figure shows the visual effects of several different combinations:

![图片3](../images/band_combination.jpg)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

可以替换一下中文。


## 1 Tool Description

coco_tools is a set of tools provided by PaddleRS for handling COCO annotated files. It is located in the `tools/coco_tools/` directory. Because [pycocotools library] (https://pypi.org/project/pycocotools/) can't install in some environment, PaddleRS provides coco_tools as an alternative for some simple file processing.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COCO annotated files -> COCO annotation files

```
Among them,

- The `info` key is a dictionary, there are 6 key-value pairs, the output shows the first 5 pairs;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的表述好像有些歧义,key本身应该不是字典,应该是key对应的值为字典。可以考虑改成:
info: A dictionary. There are...
这样的格式。

| `--json_path` | (Optional) Path of the json file whose statistics you want to collect. | |
| `--csv_path` | (Optional) Save path for the statistics table. | `None` |
| `--png_shape_path` | (Optional) png image saving path. The image content is the two-dimensional distribution of the shape of all target detection frames.| `None` |
| `--png_shapeRate_path` | (Optional) png Image saving path. The image content is a one-dimensional distribution of shape ratio (width/height) of all target detection boxes.| `None` |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

句中不要随意进行首字母大写


#### 3.2.3 Result Presentation

After the preceding command is executed, the following information is displayed:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是不是该用一般将来时?

@lizechng
Copy link
Contributor Author

Copy link
Member

@Bobholamovic Bobholamovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

留了一些意见。另外发现PR中仍存在句中无需大写的单词首字母大写的情况,请着重检查并修改。

@@ -8,7 +8,7 @@ Compared with aerial images, satellite images cover a wider area, so they are us

## 2 Characteristics of Remote Sensing Images

Remote sensing technology has the characteristics of macro, multi-band, periodicity and economy. Macro refers to that the higher the remote sensing platform is, the wider the perspective will be, and the wider the ground can be synchronously detected. The multi-band property means that the sensor can detect and record information in different bands such as ultraviolet, visible light, near infrared and microwave. Periodicity means that the remote sensing satellite has the characteristic of acquiring images repeatedly in a certain period, which can carry out repeated observation of the same area in a short time. Economic means that remote sensing technology can be used as a way to obtain large area of surface information without spending too much manpower and material resources.
Remote sensing technology has the characteristics of macro, multi-band, periodicity and economic. Macro refers to that the higher the remote sensing platform is, the wider the perspective will be, and the wider the ground can be synchronously detected. The multi-band property means that the sensor can detect and record information in different bands such as ultraviolet, visible light, near infrared and microwave. Periodicity means that the remote sensing satellite has the characteristic of acquiring images repeatedly in a certain period, which can carry out repeated observation of the same area in a short time. Economic means that remote sensing technology can be used as a way to obtain large area of surface information without spending too much manpower and material resources.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remote sensing technology has the characteristics of macroscopic, multi-band, periodic and economic
Macro -> Macroscoptic

- The `images` key is a list with 5000 elements, and the output shows the first 5;
- The `annotations` key is a list with 36,781 elements, and the output shows the first five;
- The `categories` key is a list of 80 elements, with the output showing the first five.
- `info`: A dictionary. There are 6 key-value pairs, the output shows the first 5 pairs;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the output 前加and

- The `categories` key is a list of 80 elements, with the output showing the first five.
- `info`: A dictionary. There are 6 key-value pairs, the output shows the first 5 pairs;
- `licenses`: A list with eight elements, and the output shows the first five;
- `images`: A list with 5000 elements, and the output shows the first 5;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first 5 -> first five
与其他句子统一~


In order to introduce the imaging principle of remote sensing image, the concept of raster should be introduced first. Raster is a pixel-based data format that effectively represents continuous surfaces. The information in the raster is stored in a grid structure, and each information cell or pixel has the same size and shape, but different values. Digital photographs, orthophoto images and satellite images can all be stored in this format.

Raster formats are ideal for analysis that looks at spatial and temporal changes because each data value has a grid-based accessible location. This allows us to access the same geographic location in two or more different grids and compare their values.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks at -> concentrates on


Raster formats are ideal for analysis that looks at spatial and temporal changes because each data value has a grid-based accessible location. This allows us to access the same geographic location in two or more different grids and compare their values.

When the Earth observation satellite takes a picture, the sensor will record the DN value (Digital Number) of different wavelength electromagnetic wave in the grid pixel. Through DN value, the irradiance rate and reflectance of ground objects can be inversely calculated. The relationship between them is shown in the following formula, where $gain$ and $bias$ refer to the gain and offset of the sensor respectively; $L$ is irradiance, also known as radiant brightness value; $\rho$ is the reflectance of ground objects; $d_{s}$、$E_{0}$ and $\theta$ respectively represent the distance between solar and earth astronomical units, solar irradiance and solar zenith Angle.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Digital Number 是DN的缩写,所以这个括号应该在DN之后。
另外英文中时候number已有value之意,所以直接说DN就可以,不必写DN value。


- `image_path`: Path of the image to be split.
- `mask_path`: Path of the label image to be split together, default is `None`.
- `block_size`: Size of the split image blocks, default is 512.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里的512好像忘记用反引号圈起来了,也辛苦一并修改一下中文文档吧~

- `image_path`: Path of the image to be split.
- `mask_path`: Path of the label image to be split together, default is `None`.
- `block_size`: Size of the split image blocks, default is 512.
- `save_dir`: folder path to save the split results, default is `output`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

首字母需要大写。另外,Folder path -> Directory

- `max_level`: The maximum level of scale to retrieve. If it is `None`, it means that there is no limit to the level. Default is `None`.
- `include_bg`: If specified, also save the image blocks that only contain the background class and do not contain the target class.
- `--nonzero_ratio`: Specify a threshold. For any source image, if the ratio of nonzero pixels in the image block is less than this threshold, the image block will be discarded. If it is `None`, no filtering will be performed. Default is `None`.
- `--visualize`: If specified, after the program is executed, the image `./vis_quadtree.png` will be generated, which contains the visualization result of the node situation in the quadtree. An example is shown in the following figure:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

contains the visualization result of the node situation -> visualizes the nodes


Among them:

- `im_paths`: Path of the source image(s), can specify multiple paths.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这句有语病,请修改一下

Among them:

- `im_paths`: Path of the source image(s), can specify multiple paths.
- `mask_path`: Path to the Ground-truth label.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

句中G不用大写,请同步检查并修改PR中的其它位置。

@lizechng
Copy link
Contributor Author

Copy link
Member

@Bobholamovic Bobholamovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

剩余一些小意见~

@@ -152,7 +152,7 @@ In PaddleRS a series of classes are defined that, when instantiated, perform cer

### `Transform`

The `__call__` method of the `Transform` object takes a unique argument `sample`. `sample` must be a dictionary or a sequence of dictionaries. When `sample` is a sequence, perform data transformations for each dictionary in `sample` and return the results sequentially stored in a Python build-in list; when `sample` is a dictionary, the `Transform` object extracts input from some of its key-value pairs (these keys are called "input keys"), performs the transformation, and writes the results as key-value pairs into `sample`(these keys are called "output keys"). It should be noted that many of the `Transform` objects in PaddleRS overwrite key-value pairs, that is, there is an intersection between the input key and the output key. The common keys in `sample` and their meanings are as follows:
The `__call__` method of the `Transform` object takes a unique argument `sample`. `sample` must be a dictionary or a sequence of dictionaries. When `sample` is a sequence, perform data transformations for each dictionary in `sample` and return the results sequentially stored in a python build-in list; when `sample` is a dictionary, the `Transform` object extracts input from some of its key-value pairs (these keys are called "input keys"), performs the transformation, and writes the results as key-value pairs into `sample`(these keys are called "output keys"). It should be noted that many of the `Transform` objects in PaddleRS overwrite key-value pairs, that is, there is an intersection between the input key and the output key. The common keys in `sample` and their meanings are as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python的首字母P需要大写

@@ -145,7 +145,7 @@ Considering the large-scale nature of remote sensing image, PaddleRS provides sl
2. Users can customize the size and stride of the sliding window. Meanwhile, PaddleRS supports sliding window overlapping. For the overlapping parts between windows, PaddleRS will automatically fuse the model's predicted results.
3. The inference results can be saved in GeoTiff format, and the reading and writing of geographic transformation information and geographic projection information is supported.

Currently, the image segmentation trainer ([`BaseSegmenter`](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/segmenter.py) and subclasses) and change detection trainer ([`BaseChangeDetector`](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py) and subclasses)have dynamic graph sliding window inference API. Take the API of image segmentation task as an example, the explanation is as follows:
Currently, the image segmentation trainer ([`BaseSegmenter`](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/segmenter.py) and subclasses) and change detection trainer ([`BaseChangeDetector`](https://github.com/PaddlePaddle/PaddleRS/blob/develop/paddlers/tasks/change_detector.py) and subclasses)have dynamic graph sliding window inference api. Take the api of image segmentation task as an example, the explanation is as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api三个字母需要大写API

@@ -1,6 +1,6 @@
# Remote Sensing Open Source Dataset

PaddleRS has collected and summarized the most commonly used **open source** deep learning data sets in the field of remote sensing, providing the following information for each data set: dataset description, image information, annotation information, source address, and AI Studio backup link. According to the task type, these data sets can be divided into **image classification, image segmentation, change detection, object detection, object tracking, multi-label classification, image generation** and other types. Currently, the collected remote sensing datasets include:
PaddleRS has collected and summarized the most commonly used **open source** deep learning data sets in the field of remote sensing, providing the following information for each data set: dataset description, image information, annotation information, source address, and aistudio backup link. According to the task type, these data sets can be divided into **image classification, image segmentation, change detection, object detection, object tracking, multi-label classification, image generation** and other types. Currently, the collected remote sensing datasets include:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aistudio的正式写法为AI Studio

@@ -16,4 +16,4 @@ Visit [Remote Sensing Data Set Summary](./dataset_summary.md) for more informati

## Dataset of Special Contribution

* Sample data of typical urban roads in China of 2020(CHN6-CUG), provided by Professor [Qiqi Zhu](http://grzy.cug.edu.cn/zhuqiqi), China University of Geosciences. Please refer to [here](http://grzy.cug.edu.cn/zhuqiqi/zh_CN/yjgk/32368/content/1733.htm) for more information and download information.
* Sample data of typical urban roads in China of 2020(CHN6-CUG), provided by professor [Qiqi Zhu](http://grzy.cug.edu.cn/zhuqiqi), China University of Geosciences. Please refer to [here](http://grzy.cug.edu.cn/zhuqiqi/zh_CN/yjgk/32368/content/1733.htm) for more information and download information.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

根据英语语法,此处professor需要首字母大写


The main function of `geojson2mask.py` is to convert the geoJson-formatted labels to a .tif raster format. The usage is as follows:
The main function of `geojson2mask.py` is to convert the GeoJson-formatted labels to a .tif raster format. The usage is as follows:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GeoJson -> GeoJSON

@@ -97,4 +97,4 @@ After writing the implementation of the operator, **you must write docstring and

Remote sensing image processing tools are stored in the `tools/` directory. Each tool should be a relatively independent script, independent of the contents of the `paddlers/` directory, which can be executed by the user without installing PaddleRS.

When writing the script, use the Python standard library `argparse` to process the command-line arguments entered by the user and execute the specific logic in the `if __name__ == '__main__':` code block. If you have multiple tools that use the same function or class, define these common components in `tools/utils`.
When writing the script, use the python standard library `argparse` to process the command-line arguments entered by the user and execute the specific logic in the `if __name__ == '__main__':` code block. If you have multiple tools that use the same function or class, define these common components in `tools/utils`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@@ -166,7 +166,7 @@ Multi examples:

Examples 2:

# Use it as a Python decorator.
# Use it as a python decorator.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

@lizechng
Copy link
Contributor Author

剩余一些小意见~

已修改~

Copy link
Member

@Bobholamovic Bobholamovic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@Bobholamovic
Copy link
Member

我们将在CI通过后合入此PR。

再次感谢你为PaddleRS贡献文档,以及对PR review工作的配合。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants