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

[Feature] Add GDAL backend and Support LEVIR-CD Dataset #2903

Merged
merged 13 commits into from May 8, 2023
Merged

[Feature] Add GDAL backend and Support LEVIR-CD Dataset #2903

merged 13 commits into from May 8, 2023

Conversation

Zoulinx
Copy link
Contributor

@Zoulinx Zoulinx commented Apr 14, 2023

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.

@CLAassistant
Copy link

CLAassistant commented Apr 14, 2023

CLA assistant check
All committers have signed the CLA.

@vansin vansin changed the title add: [Feature] add LoadSingleRSImageFromFile Apr 14, 2023
@vansin vansin requested a review from xiexinch April 14, 2023 16:19
@vansin
Copy link
Collaborator

vansin commented Apr 14, 2023

Good Job!

@vansin vansin self-requested a review April 14, 2023 16:24
@KKIEEK
Copy link
Contributor

KKIEEK commented Apr 15, 2023

I don't think LoadSingleRSImageFromFile is necessary since as far as I know, mmcv already supports the TIFF format.
If you need advanced features of gdal, what do you think about contributing to this link instead?

@hzz12138
Copy link

I don't think LoadSingleRSImageFromFile is necessary since as far as I know, mmcv already supports the TIFF format. If you need advanced features of gdal, what do you think about contributing to this link instead?

Remote sensing images include more than tiff format files. For other files such as nc, hdf, img formats, the opencv library does not support reading and writing. GDAL library is the most comprehensive library for remote sensing field.

@KKIEEK
Copy link
Contributor

KKIEEK commented Apr 17, 2023

I don't think LoadSingleRSImageFromFile is necessary since as far as I know, mmcv already supports the TIFF format. If you need advanced features of gdal, what do you think about contributing to this link instead?

Remote sensing images include more than tiff format files. For other files such as nc, hdf, img formats, the opencv library does not support reading and writing. GDAL library is the most comprehensive library for remote sensing field.

I understand, but I'm not sure about the necessity of this implementation compared to adding a gdal backend to mmcv.

Copy link
Collaborator

@xiexinch xiexinch left a comment

Choose a reason for hiding this comment

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

Hi @Zoulinx,
Thanks for your contribution, we really appreciate it!
I think we might add a document to introduce the osgeo lib and show how to install it. Since this library is not necessary for most users, I think we should reduce the process of installing mmseg for other users, but for users interested in remote sensing image processing this documentation should be very important.

@@ -2,6 +2,7 @@
import warnings
from typing import Dict, Optional, Union

from osgeo import gdal
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since many users may not use this library, this library should not be forced to be installed by users.

mmseg/datasets/transforms/loading.py Show resolved Hide resolved
mmseg/datasets/transforms/loading.py Outdated Show resolved Hide resolved
LoadSingleRSImageFromFile()
LoadMultipleRSImageFromFile()
	modified:   mmseg/datasets/__init__.py
	modified:   mmseg/datasets/basesegdataset.py
	modified:   mmseg/datasets/transforms/__init__.py
	modified:   mmseg/datasets/transforms/loading.py
	modified:   mmseg/datasets/transforms/transforms.py
@Zoulinx Zoulinx changed the title [Feature] add LoadSingleRSImageFromFile [Feature] Add GDAL backend and Support LEVIR-CD Dataset May 4, 2023
modified:   docs/zh_cn/user_guides/2_dataset_prepare.md
modified:   tools/dataset_converters/levircd.py
@@ -195,6 +195,16 @@ Run it with
docker run --gpus all --shm-size=8g -it -v {DATA_DIR}:/mmsegmentation/data mmsegmentation
```

## Optional Dependencies
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
## Optional Dependencies
### Optional Dependencies

@xiexinch xiexinch merged commit 77591b9 into open-mmlab:dev-1.x May 8, 2023
11 checks passed
@likyoo
Copy link
Contributor

likyoo commented Jul 4, 2023

Hi, do you know about open-cd, a mmlab based change detection repo. 😄

@Zoulinx
Copy link
Contributor Author

Zoulinx commented Jul 7, 2023

Hi, do you know about open-cd, a mmlab based change detection repo. 😄

Yes, I am aware of this excellent community project. I noticed that open-cd has rewritten almost all the transforms in order to implement the change detection functionality. In fact, introducing the albu library can provide a more convenient solution for handling transformations on multiple images. I suggest referring to another change detection library https://github.com/shinianzhihou/ChangeDetection from the community that utilizes albu.

Furthermore, due to the diversity and complexity of remote sensing image data formats, using gdal instead of opencv as the raster driver can provide better compatibility for change detection tasks.

nahidnazifi87 pushed a commit to nahidnazifi87/mmsegmentation_playground that referenced this pull request Apr 5, 2024
)

## 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants