## Motivation
Supports inference for ultra-large-scale remote sensing images.
## Modification
Add RSImageInference.py in demo.
## Use cases
Taking the inference of Vaihingen dataset images using PSPNet as an
example, the following settings are required:
**img**: Specify the path of the image.
**model**: Provide the configuration file for the model.
**checkpoint**: Specify the weight file for the model.
**out**: Set the output path for the results.
**batch_size**: Determine the batch size used during inference.
**win_size**: Specify the width and height(512x512) of the sliding
window.
**stride**: Set the stride(400x400) for sliding the window.
**thread(default: 1)**: Specify the number of threads to be used for
inference.
**Inference device (default: cuda:0)**: Specify the device for inference
(e.g., cuda:0 for CPU).
```shell
python demo/rs_image_inference.py demo/demo.png projects/pp_mobileseg/configs/pp_mobileseg/pp_mobileseg_mobilenetv3_2x16_80k_ade20k_512x512_tiny.py pp_mobileseg_mobilenetv3_2xb16_3rdparty-tiny_512x512-ade20k-a351ebf5.pth --batch-size 8 --device cpu --thread 2
```
---------
Co-authored-by: xiexinch <xiexinch@outlook.com>
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.
## Motivation
Please describe the motivation of this PR and the goal you want to
achieve through this PR.
Support metrics for the depth estimation task, including RMSE, ABSRel,
and etc.
## Modification
Please briefly describe what modification is made in this PR.
## BC-breaking (Optional)
Does the modification introduce changes that break the
backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the
downstream projects should modify their code to keep compatibility with
this PR.
## Use cases (Optional)
Using the following configuration to compute depth metrics on NYU
```python
dataset_type = 'NYUDataset'
data_root = 'data/nyu'
test_pipeline = [
dict(type='LoadImageFromFile'),
dict(dict(type='LoadDepthAnnotation', depth_rescale_factor=1e-3)),
dict(
type='PackSegInputs',
meta_keys=('img_path', 'depth_map_path', 'ori_shape', 'img_shape',
'pad_shape', 'scale_factor', 'flip', 'flip_direction',
'category_id'))
]
val_dataloader = dict(
batch_size=1,
num_workers=4,
persistent_workers=True,
sampler=dict(type='DefaultSampler', shuffle=False),
dataset=dict(
type=dataset_type,
data_root=data_root,
test_mode=True,
data_prefix=dict(
img_path='images/test', depth_map_path='annotations/test'),
pipeline=test_pipeline))
test_dataloader = val_dataloader
val_evaluator = dict(type='DepthMetric', max_depth_eval=10.0, crop_type='nyu')
test_evaluator = val_evaluator
```
Example log:

## Checklist
1. Pre-commit or other linting tools are used to fix the potential lint
issues.
2. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
3. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
4. The documentation has been modified accordingly, like docstring or
example tutorials.
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.
## Motivation
It's OpenMMLab Codecamp task.
## Modification
Implementd Kullback-Leibler divergence loss and also added tests for it.
## Checklist
1. Pre-commit or other linting tools are used to fix the potential lint
issues.
2. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
3. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
4. The documentation has been modified accordingly, like docstring or
example tutorials.
---------
Co-authored-by: xiexinch <xiexinch@outlook.com>
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.
## Motivation
Please describe the motivation of this PR and the goal you want to
achieve through this PR.
## Modification
Please briefly describe what modification is made in this PR.
1. add `NYUDataset`class
2. add script to process NYU dataset
3. add transforms for loading depth map
4. add docs & unittest
## BC-breaking (Optional)
Does the modification introduce changes that break the
backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the
downstream projects should modify their code to keep compatibility with
this PR.
## Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases
here, and update the documentation.
## Checklist
1. Pre-commit or other linting tools are used to fix the potential lint
issues.
5. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
6. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
7. The documentation has been modified accordingly, like docstring or
example tutorials.
Added ignore_index param to forward(),
also implemented one hot encoding to ensure the dims of target matches
pred.
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.
## Motivation
Please describe the motivation of this PR and the goal you want to
achieve through this PR.
Attempted to solve the problems mentioned by #3172
## Modification
Please briefly describe what modification is made in this PR.
Added ignore_index into forward function (although the dice loss itself
does not actually take account for it for some reason).
Added _expand_onehot_labels_dice, which takes the target with shape [N,
H, W] into [N, num_classes, H, W].
## BC-breaking (Optional)
Does the modification introduce changes that break the
backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the
downstream projects should modify their code to keep compatibility with
this PR.
## Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases
here, and update the documentation.
## Checklist
1. Pre-commit or other linting tools are used to fix the potential lint
issues.
2. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
3. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
4. The documentation has been modified accordingly, like docstring or
example tutorials.
This is my first time contributing to open-source code, so I might have
made some stupid mistakes. Please don't hesitate to point it out.
## Motivation
- 'PascalContextDataset' object has no attribute 'file_client', it will
cause an error.
- The attribute ‘ann_file’ is not allowed to be empty, otherwise, an
error will be reported.
## Modification
- Replace file_client with fileio
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.
## Motivation
https://github.com/open-mmlab/mmsegmentation/issues/3181https://github.com/open-mmlab/mmsegmentation/issues/2965https://github.com/open-mmlab/mmsegmentation/issues/2644https://github.com/open-mmlab/mmsegmentation/issues/1645https://github.com/open-mmlab/mmsegmentation/issues/1444https://github.com/open-mmlab/mmsegmentation/issues/1370https://github.com/open-mmlab/mmsegmentation/issues/125
## Modification
Remove the assertion at data_preprocessor
## BC-breaking (Optional)
Does the modification introduce changes that break the
backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the
downstream projects should modify their code to keep compatibility with
this PR.
## Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases
here, and update the documentation.
## Checklist
1. Pre-commit or other linting tools are used to fix the potential lint
issues.
2. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
3. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
4. The documentation has been modified accordingly, like docstring or
example tutorials.
## Motivation
When using the - tta command for multi-scale prediction, and the test
set is not annotated, although format_only has been set true in
test_evaluator, but SegTTAModel class still threw error 'AttributeError:
'SegDataSample' object has no attribute '_gt_sem_seg''.
## Modification
The reason is SegTTAModel didn't determine if there were annotations in
the dataset, so I added the code to make the judgment and let the
program run normally on my computer.
## Motivation
In encode_decoder.py , assertion logic is not working correctly if user
modifes cfg.test_cfg and defines it in a dictionary format. See:
https://github.com/open-mmlab/mmsegmentation/issues/3011
## Modification
Slight change to assertion behaviour to change assertion depending on if
received test_cfg object is a dict or not.
## BC-breaking (Optional)
Unsure - I believe this will not break any downstream tasks as the
previous logic is still included
## Use cases (Optional)
n/a
---------
Co-authored-by: xiexinch <xiexinch@outlook.com>
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.
## Motivation
Add Huasdorff distance loss
---------
Co-authored-by: xiexinch <xiexinch@outlook.com>
## Motivation
Suppose an image is named `jpg.jpg` and its corresponding segmap is
named `jpg.png`.
The original implementation will try to read segmap from `png.png` and
causes FileNotfoundError
## Modification
Only replace the suffix, instead of full string search and replacement.
## BC-breaking (Optional)
Probably no.
## Use cases (Optional)
## Checklist
1. Pre-commit or other linting tools are used to fix the potential lint
issues.
2. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
3. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
4. The documentation has been modified accordingly, like docstring or
example tutorials.
---------
Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
Co-authored-by: CSH <40987381+csatsurnh@users.noreply.github.com>
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.
## Motivation
Enhance pretrained SwinTransformer loading when setting non-standard
backbone `depths`.
## Modification
Enhance pretrained SwinTransformer loading when setting non-standard
backbone `depths`.
## BC-breaking (Optional)
Does the modification introduce changes that break the
backward-compatibility of the downstream repos?
If so, please describe how it breaks the compatibility and how the
downstream projects should modify their code to keep compatibility with
this PR.
## Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases
here, and update the documentation.
## Checklist
1. Pre-commit or other linting tools are used to fix the potential lint
issues.
2. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
3. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
4. The documentation has been modified accordingly, like docstring or
example tutorials.
---------
Co-authored-by: SheffieldCao <1751899@tongji.edu.cn>
## Motivation
Fix bug cannot use both '--tta' and '--out' while testing.
For details, please refer to #3064 .
## Modification
Add 'img_path' in TTA predictions.
---------
Co-authored-by: xiexinch <xiexinch@outlook.com>
## Motivation
While customizing the number of samples using `ann_file` for Cityscapes,
I noticed that when the `ann_file` name is incorrect, it will silently
resort to loading the dataset from the directory.
I think when the user intends to load using `ann_file`, it should not
silently fail, but give some sort of error message or warning.
## Modification
I added assertion to check whether the `ann_file` exists instead of
silently resorting to loading from the directory.
Since `ann_file` is set to `''` by default and joined with
`self.data_root`, I used `osp.isdir` to first check if `self.ann_dir` is
a directory or text file.
## BC-breaking (Optional)
Not that I am aware of.
## Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases
here, and update the documentation.
---------
Co-authored-by: 谢昕辰 <xiexinch@outlook.com>
Co-authored-by: CSH <40987381+csatsurnh@users.noreply.github.com>
## Motivation
For support with reading multiple remote sensing image formats, please
refer to https://gdal.org/drivers/raster/index.html.
Byte, UInt16, Int16, UInt32, Int32, Float32, Float64, CInt16, CInt32,
CFloat32 and CFloat64 are supported for reading and writing.
Support input of two images for change detection tasks, and support the
LEVIR-CD dataset.
## Modification
Add LoadSingleRSImageFromFile in 'mmseg/datasets/transforms/loading.py'.
Load a single remote sensing image for object segmentation tasks.
Add LoadMultipleRSImageFromFile in
'mmseg/datasets/transforms/loading.py'.
Load two remote sensing images for change detection tasks.
Add ConcatCDInput in 'mmseg/datasets/transforms/transforms.py'.
Combine images that have been separately augmented for data enhancement.
Add BaseCDDataset in 'mmseg/datasets/basesegdataset.py'
Base class for datasets used in change detection tasks.
---------
Co-authored-by: xiexinch <xiexinch@outlook.com>
## Motivation
1. It is used to save the segmentation predictions as files and upload
these files to a test server
## Modification
1. Add output_file and format only in `IoUMetric`
## BC-breaking (Optional)
No
## Use cases (Optional)
If this PR introduces a new feature, it is better to list some use cases
here, and update the documentation.
## Checklist
1. Pre-commit or other linting tools are used to fix the potential lint
issues.
3. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
4. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
5. The documentation has been modified accordingly, like docstring or
example tutorials.
## Modification
I changed the hardcoded 3 channel length to dynamic channel length in
`np.full` function arguments.
This modification enables `RandomMosaic` transform to support
multispectral image (e.g. RGB image with NIR band) or bi-temporal image
pairs for change detection task.
## Checklist
1. Pre-commit or other linting tools are used to fix the potential lint
issues.
2. The modification is covered by complete unit tests. If not, please
add more unit test to ensure the correctness.
3. If the modification has potential influence on downstream projects,
this PR should be tested with downstream projects, like MMDet or
MMDet3D.
4. The documentation has been modified accordingly, like docstring or
example tutorials.
Thanks for your contribution and we appreciate it a lot. The following
instructions would make your pull request more healthy and more easily
get feedback. If you do not understand some items, don't worry, just
make the pull request and seek help from maintainers.
## Motivation
fix#2593
## Modification
1. Only when gt seg map is 2D, extend its shape to 3D PixelData
2. If seg map is not 2D, we raised warning for users.
---------
Co-authored-by: xiexinch <xiexinch@outlook.com>
## Motivation
Make MMSeginferencer easier to be used
## Modification
1. Add `_load_weights_to_model` to MMSeginferencer, it is for get
`dataset_meta` from ckpt
2. Modify and remove some parameters of `__call__`, `visualization` and
`postprocess`
3. Add function of save seg mask, remove dump pkl.
4. Refine docstring of MMSeginferencer and SegLocalVisualizer
5. Add the user documentation of MMSeginferencer
## BC-breaking (Optional)
yes, remove some parameters, we need to discuss whether keep them with
deprecated waring or just remove them as the MMSeginferencer just merged
in mmseg a few days.
Co-authored-by: xiexinch <xiexinch@outlook.com>
## Motivation
Support `MMSegInferencer` for providing an easy and clean interface for
single or multiple images inferencing.
Ref: https://github.com/open-mmlab/mmengine/pull/773https://github.com/open-mmlab/mmocr/pull/1608
## Modification
- mmseg/apis/mmseg_inferencer.py
- mmseg/visualization/local_visualizer.py
- demo/image_demo_with_inferencer.py
## Use cases (Optional)
Based on https://github.com/open-mmlab/mmengine/tree/inference
Add a new image inference demo with `MMSegInferencer`
- demo/image_demo_with_inferencer.py
```shell
python demo/image_demo_with_inferencer.py demo/demo.png fcn_r50-d8_4xb2-40k_cityscapes-512x1024
```
---------
Co-authored-by: MeowZheng <meowzheng@outlook.com>
## Motivation
In MMEngine >= 0.2.0, it might directly determine what the backend is by
using the `data_root` path.
## Modification
Set all default `backend_args` values are `None`.