XavierJiezou's picture
Add files using upload-large-folder tool
918db92 verified
# Copyright (c) OpenMMLab. All rights reserved.
import os.path as osp
from typing import List
import mmengine.fileio as fileio
from mmseg.registry import DATASETS
from mmseg.datasets import BaseSegDataset
@DATASETS.register_module()
class GrassDataset(BaseSegDataset):
"""grass segmentation dataset. The file structure should be.
.. code-block:: none
β”œβ”€β”€ data
β”‚ β”œβ”€β”€ grass
β”‚ β”‚ β”œβ”€β”€ img_dir
β”‚ β”‚ β”‚ β”œβ”€β”€ train
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€0.tif
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€...
β”‚ β”‚ β”‚ β”œβ”€β”€ val
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€9.tif
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€...
β”‚ β”‚ β”œβ”€β”€ ann_dir
β”‚ β”‚ β”‚ β”œβ”€β”€ train
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€0.png
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€...
β”‚ β”‚ β”‚ β”œβ”€β”€ val
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€9.png
β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€...
"""
METAINFO = dict(
classes=("low", "middle-low", "middle", "middle-high", "high"),
palette=[
[185, 101, 71],
[248, 202, 155],
[211, 232, 158],
[138, 191, 104],
[92, 144, 77],
],
)
def __init__(self,
img_suffix='.tif',
seg_map_suffix='.png',
reduce_zero_label=False,
**kwargs) -> None:
super().__init__(
img_suffix=img_suffix,
seg_map_suffix=seg_map_suffix,
reduce_zero_label=reduce_zero_label,
**kwargs)