File size: 1,657 Bytes
918db92
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# 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)