File size: 3,456 Bytes
08d219e 9432762 08d219e 56dc88d 9432762 56dc88d 9432762 56dc88d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
---
pretty_name: IGVC Segmentation Dataset
tags:
- image
license: cc-by-4.0
---
# IGCV Segmentation Dataset
Dataset for training a semantic image segmentation model for the [Intelligent Ground Vehicle Competition](http://www.igvc.org/).
## Composition
Each instance consists of an reference image from the point of view of the robot and the corresponding obstacle (e.g. construction drums, buckets) and lane segmentation masks.
**Train**
256 frames rendered in 4 different lighting environments using Blender = 1024 images
**Test**
10 frames captured from the [SCR 2023 IGVC run](https://www.youtube.com/watch?v=7tZsk3T3STA) (manually segmented) + 13 frames rendered in 4 lighting environments = 62 images
## Usage
For usage with PyTorch it is recommended to wrap the dataset into a [`Dataset`](https://docs.pytorch.org/docs/stable/data.html#torch.utils.data.Dataset) adapter class and generate a training/validation split:
```python
from torch.utils.data import Dataset
from datasets import load_dataset, Dataset as HFDataset
import numpy as np
class Split:
TRAIN = "train"
VALID = "valid"
TEST = "test"
class SegmentationDataset(Dataset):
def __init__(self, path="Nico0302/IGVC-Segmentation", split=Split.TRAIN, transform=None, mask_name="obstacle_mask", valid_size=0.125):
self.path = path
self.split = split
self.transform = transform
self.mask_name = mask_name
self.valid_size = valid_size
self.data = self._read_split()
def __len__(self):
return len(self.data)
def __getitem__(self, idx):
item = self.data[idx]
sample = dict(image=np.array(item["image"]), mask=np.array(item[self.mask_name]))
if self.transform is not None:
sample = self.transform(**sample)
return {
"image": np.transpose(sample["image"], (2, 0, 1)), # HWC to CHW (3, H, W)
"mask": np.expand_dims(sample["mask"].astype(np.float32) / 255.0, 0), # HW to CHW (1, H, W)
}
def _read_split(self):
dataset = load_dataset(self.path, split="test" if self.split == Split.TEST else "train")
assert isinstance(dataset, HFDataset), "Dataset must be a Hugging Face Dataset"
if (self.split == Split.TEST):
return dataset
splits = dataset.train_test_split(test_size=self.valid_size, seed=42)
if self.split == Split.VALID:
return splits["test"]
return splits["train"]
```
Using this adapter, the dataset can simple be passed to the [`DataLoader`](https://docs.pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader):
```python
train_dataset = SegmentationDataset(split=Split.TRAIN)
valid_dataset = SegmentationDataset(split=Split.VALID)
test_dataset = SegmentationDataset(split=Split.TEST)
train_dataloader = DataLoader(train_dataset)
valid_dataloader = DataLoader(valid_dataset)
test_dataloader = DataLoader(test_dataset)
```
## Acknowledgements
Thank you for [Sooner Competitive Robotics](https://ou.edu/scr/) for allowing me to use frames from their IGVC 2023 run video as part of the test set.
## Citation
If you are using this dataset, please cite
```bibtex
@misc{gres2025IGVC,
author = { Nicolas Gres },
title = { IGCV Segmentation Dataset },
year = 2025,
url = { https://huggingface.co/datasets/Nico0302/IGVC-Segmentation },
publisher = { Hugging Face }
}
``` |