-
Notifications
You must be signed in to change notification settings - Fork 2.7k
[Feature] add HSI-Drive dataset #3365
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
Merged
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
4366547
[Feature] add HSI-Drive dataset
jonGuti13 d927d5c
[Feature] add class LoadImageFromNpyFile to load image from .npy file
jonGuti13 643f7af
I have decided not to include any test in test_dataset.py as I don't …
jonGuti13 d38bcb5
--update=update pipeline settings
xiexinch 56e869a
--update=include docstring dataset
jonGuti13 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
train_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict(type='LoadAnnotations'), | ||
dict(type='PackSegInputs') | ||
] | ||
test_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
dict(type='LoadAnnotations'), | ||
dict(type='PackSegInputs') | ||
] | ||
|
||
train_dataloader = dict( | ||
batch_size=1, | ||
num_workers=1, | ||
xiexinch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
persistent_workers=True, | ||
sampler=dict(type='InfiniteSampler', shuffle=True), | ||
dataset=dict( | ||
type='HSIDrive20Dataset', | ||
data_root='/data', | ||
xiexinch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
data_prefix=dict( | ||
img_path='images/training', seg_map_path='annotations/training'), | ||
pipeline=train_pipeline)) | ||
|
||
val_dataloader = dict( | ||
batch_size=1, | ||
num_workers=1, | ||
persistent_workers=True, | ||
sampler=dict(type='DefaultSampler', shuffle=False), | ||
dataset=dict( | ||
type='HSIDrive20Dataset', | ||
data_root='/data', | ||
xiexinch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
data_prefix=dict( | ||
img_path='images/validation', | ||
seg_map_path='annotations/validation'), | ||
pipeline=test_pipeline)) | ||
|
||
test_dataloader = dict( | ||
batch_size=1, | ||
num_workers=1, | ||
persistent_workers=True, | ||
sampler=dict(type='DefaultSampler', shuffle=False), | ||
dataset=dict( | ||
type='HSIDrive20Dataset', | ||
data_root='/data', | ||
xiexinch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
data_prefix=dict( | ||
img_path='images/test', seg_map_path='annotations/test'), | ||
pipeline=test_pipeline)) | ||
|
||
val_evaluator = dict(type='IoUMetric', iou_metrics=['mIoU'], ignore_index=0) | ||
test_evaluator = val_evaluator |
53 changes: 53 additions & 0 deletions
53
configs/unet/unet-s5-d16_fcn_4xb4-160k_hsidrive-192x384.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
_base_ = [ | ||
'../_base_/models/fcn_unet_s5-d16.py', '../_base_/datasets/hsi_drive.py', | ||
'../_base_/default_runtime.py', '../_base_/schedules/schedule_160k.py' | ||
] | ||
crop_size = (192, 384) | ||
data_preprocessor = dict( | ||
type='SegDataPreProcessor', | ||
size=crop_size, | ||
mean=None, | ||
std=None, | ||
bgr_to_rgb=None, | ||
pad_val=0, | ||
seg_pad_val=255) | ||
|
||
model = dict( | ||
data_preprocessor=data_preprocessor, | ||
backbone=dict(in_channels=25), | ||
xiexinch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
decode_head=dict( | ||
ignore_index=0, | ||
num_classes=11, | ||
loss_decode=dict( | ||
type='CrossEntropyLoss', | ||
use_sigmoid=False, | ||
loss_weight=1.0, | ||
avg_non_ignore=True)), | ||
auxiliary_head=dict( | ||
ignore_index=0, | ||
num_classes=11, | ||
loss_decode=dict( | ||
type='CrossEntropyLoss', | ||
use_sigmoid=False, | ||
loss_weight=1.0, | ||
avg_non_ignore=True)), | ||
# model training and testing settings | ||
train_cfg=dict(), | ||
test_cfg=dict(mode='whole')) | ||
|
||
train_pipeline = [ | ||
dict(type='LoadImageFromNpyFile'), | ||
dict(type='LoadAnnotations'), | ||
dict(type='RandomCrop', crop_size=crop_size), | ||
dict(type='PackSegInputs') | ||
] | ||
|
||
test_pipeline = [ | ||
dict(type='LoadImageFromNpyFile'), | ||
dict(type='RandomCrop', crop_size=crop_size), | ||
dict(type='LoadAnnotations'), | ||
dict(type='PackSegInputs') | ||
] | ||
xiexinch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
train_dataloader = dict(dataset=dict(pipeline=train_pipeline)) | ||
test_dataloader = dict(dataset=dict(pipeline=test_pipeline)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,15 @@ mmsegmentation | |
│ │ ├── annotations | ||
│ │ │ ├── train | ||
│ │ │ ├── test | ||
│ ├── HSIDrive20 | ||
│ │ ├── images | ||
│ │ │ ├── train | ||
│ │ │ ├── validation | ||
│ │ │ ├── test | ||
│ │ ├── annotations | ||
│ │ │ ├── train | ||
│ │ │ ├── validation | ||
│ │ │ ├── test | ||
``` | ||
|
||
## Download dataset via MIM | ||
|
@@ -752,3 +761,46 @@ mmsegmentation | |
```bash | ||
python tools/dataset_converters/nyu.py nyu.zip | ||
``` | ||
|
||
## HSI Drive 2.0 | ||
|
||
- You could download HSI Drive 2.0 dataset from [here](https://ipaccess.ehu.eus/HSI-Drive/#download) after just sending an email to [email protected] with the subject "download HSI-Drive". You will receive a password to uncompress the files. | ||
|
||
- After download, unzip by the following instructions: | ||
|
||
```bash | ||
7z x -p"password" ./HSI_Drive_v2_0_Phyton.zip | ||
|
||
mv ./HSIDrive20 path_to_mmsegmentation/data | ||
mv ./HSI_Drive_v2_0_release_notes_Python_version.md path_to_mmsegmentation/data | ||
mv ./image_numbering.pdf path_to_mmsegmentation/data | ||
``` | ||
|
||
- After unzip, you get | ||
|
||
```none | ||
mmsegmentation | ||
├── mmseg | ||
├── tools | ||
├── configs | ||
├── data | ||
│ ├── HSIDrive20 | ||
│ │ ├── images | ||
│ │ │ ├── training | ||
│ │ │ ├── validation | ||
│ │ │ ├── test | ||
│ │ ├── annotations | ||
│ │ │ ├── training | ||
│ │ │ ├── validation | ||
│ │ │ ├── test | ||
│ │ ├── images_MF | ||
│ │ │ ├── training | ||
│ │ │ ├── validation | ||
│ │ │ ├── test | ||
│ │ ├── RGB | ||
│ │ ├── training_filenames.txt | ||
│ │ ├── validation_filenames.txt | ||
│ │ ├── test_filenames.txt | ||
│ ├── HSI_Drive_v2_0_release_notes_Python_version.md | ||
│ ├── image_numbering.pdf | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -205,6 +205,15 @@ mmsegmentation | |
│ │ ├── annotations | ||
│ │ │ ├── train | ||
│ │ │ ├── test | ||
│ ├── HSIDrive20 | ||
│ │ ├── images | ||
│ │ │ ├── train | ||
│ │ │ ├── validation | ||
│ │ │ ├── test | ||
│ │ ├── annotations | ||
│ │ │ ├── train | ||
│ │ │ ├── validation | ||
│ │ │ ├── test | ||
``` | ||
|
||
## 用 MIM 下载数据集 | ||
|
@@ -748,3 +757,46 @@ mmsegmentation | |
```bash | ||
python tools/dataset_converters/nyu.py nyu.zip | ||
``` | ||
|
||
## HSI Drive 2.0 | ||
|
||
- 您可以从以下位置下载 HSI Drive 2.0 数据集 [here](https://ipaccess.ehu.eus/HSI-Drive/#download) 刚刚向 [email protected] 发送主题为“下载 HSI-Drive”的电子邮件后 您将收到解压缩文件的密码. | ||
|
||
- 下载后,按照以下说明解压: | ||
|
||
```bash | ||
7z x -p"password" ./HSI_Drive_v2_0_Phyton.zip | ||
|
||
mv ./HSIDrive20 path_to_mmsegmentation/data | ||
mv ./HSI_Drive_v2_0_release_notes_Python_version.md path_to_mmsegmentation/data | ||
mv ./image_numbering.pdf path_to_mmsegmentation/data | ||
``` | ||
|
||
- 解压后得到: | ||
|
||
```none | ||
mmsegmentation | ||
├── mmseg | ||
├── tools | ||
├── configs | ||
├── data | ||
│ ├── HSIDrive20 | ||
│ │ ├── images | ||
│ │ │ ├── training | ||
│ │ │ ├── validation | ||
│ │ │ ├── test | ||
│ │ ├── annotations | ||
│ │ │ ├── training | ||
│ │ │ ├── validation | ||
│ │ │ ├── test | ||
│ │ ├── images_MF | ||
│ │ │ ├── training | ||
│ │ │ ├── validation | ||
│ │ │ ├── test | ||
│ │ ├── RGB | ||
│ │ ├── training_filenames.txt | ||
│ │ ├── validation_filenames.txt | ||
│ │ ├── test_filenames.txt | ||
│ ├── HSI_Drive_v2_0_release_notes_Python_version.md | ||
│ ├── image_numbering.pdf | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) OpenMMLab. All rights reserved. | ||
from mmseg.datasets import BaseSegDataset | ||
from mmseg.registry import DATASETS | ||
|
||
classes_exp = ('unlabelled', 'road', 'road marks', 'vegetation', | ||
'painted metal', 'sky', 'concrete', 'pedestrian', 'water', | ||
'unpainted metal', 'glass') | ||
palette_exp = [[0, 0, 0], [77, 77, 77], [255, 255, 255], [0, 255, 0], | ||
[255, 0, 0], [0, 0, 255], [102, 51, 0], [255, 255, 0], | ||
[0, 207, 250], [255, 166, 0], [0, 204, 204]] | ||
|
||
|
||
@DATASETS.register_module() | ||
class HSIDrive20Dataset(BaseSegDataset): | ||
METAINFO = dict(classes=classes_exp, palette=palette_exp) | ||
|
||
jonGuti13 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
def __init__(self, | ||
img_suffix='.npy', | ||
seg_map_suffix='.png', | ||
**kwargs) -> None: | ||
super().__init__( | ||
img_suffix=img_suffix, seg_map_suffix=seg_map_suffix, **kwargs) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.