Skip to content

Commit 994bc40

Browse files
authored
Add files via upload
1 parent 1cbddd3 commit 994bc40

File tree

2 files changed

+102
-0
lines changed

2 files changed

+102
-0
lines changed

mmseg/datasets/MoNuSAC.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import os.path as osp
2+
3+
import mmengine.fileio as fileio
4+
5+
from mmseg.registry import DATASETS
6+
from .basesegdataset import BaseSegDataset
7+
8+
9+
@DATASETS.register_module()
10+
class MoNuSACDataset(BaseSegDataset):
11+
"""Pascal VOC dataset.
12+
13+
Args:
14+
split (str): Split txt file for Pascal VOC.
15+
"""
16+
METAINFO = dict(
17+
classes=('background', 'Epithelial', 'Lymphocyte', 'Neutrophil','Macrophage'),
18+
palette=[[0, 0, 0], [128, 0, 0], [0, 128, 0], [128, 128, 0],
19+
[0, 0, 128]])
20+
# palette=[[0, 0, 0], [1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4]])
21+
22+
def __init__(self,
23+
ann_file,
24+
img_suffix='.jpg',
25+
seg_map_suffix='.png',
26+
**kwargs) -> None:
27+
super().__init__(
28+
img_suffix=img_suffix,
29+
seg_map_suffix=seg_map_suffix,
30+
ann_file=ann_file,
31+
**kwargs)
32+
assert fileio.exists(self.data_prefix['img_path'],
33+
self.backend_args) and osp.isfile(self.ann_file)

mmseg/datasets/NuInsSeg.py

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import os.path as osp
2+
3+
import mmengine.fileio as fileio
4+
5+
from mmseg.registry import DATASETS
6+
from .basesegdataset import BaseSegDataset
7+
8+
9+
@DATASETS.register_module()
10+
class MoNuSACDataset(BaseSegDataset):
11+
"""Pascal VOC dataset.
12+
13+
Args:
14+
split (str): Split txt file for Pascal VOC.
15+
"""
16+
METAINFO = dict(
17+
classes=('background',
18+
'human bladder',
19+
'human brain',
20+
'human cardia',
21+
'human cerebellum',
22+
'human epiglottis',
23+
'human jejunum',
24+
'human kidney',
25+
'human liver',
26+
'human lung',
27+
'human melanoma',
28+
'human muscle',
29+
'human oesophagus',
30+
'human pancreas',
31+
'human peritoneum',
32+
'human placenta',
33+
'human pylorus',
34+
'human rectum',
35+
'human salivory gland',
36+
'human spleen',
37+
'human testis',
38+
'human tongue',
39+
'human tonsile',
40+
'human umbilical cord',
41+
'mouse fat (white and brown)_subscapula',
42+
'mouse femur',
43+
'mouse heart',
44+
'mouse kidney',
45+
'mouse liver',
46+
'mouse muscle_tibia',
47+
'mouse spleen',
48+
'mouse thymus' ),
49+
palette=[[0, 0, 0],
50+
[128, 0, 0], [0, 128, 0],[0, 0, 128], [128, 128, 0],[0, 128, 128], [128, 0, 128], [128, 128, 128],
51+
[255, 0, 0], [0, 255, 0],[0, 0, 255], [255, 255, 0],[0, 255, 255], [255, 0, 255], [255, 255, 255],
52+
[64, 0, 0], [0, 64, 0],[0, 0, 64], [64, 64, 0],[0, 64, 64], [64, 0, 64], [64, 64, 64],
53+
[192, 0, 0], [0, 192, 0],[0, 0, 192], [192, 192, 0],[0, 192, 192], [192, 0, 192], [192, 192, 192],
54+
[32, 0, 0], [0, 32, 0],[0, 0, 32],
55+
])
56+
# palette=[[0, 0, 0], [1, 1, 1], [2, 2, 2], [3, 3, 3], [4, 4, 4]])
57+
58+
def __init__(self,
59+
ann_file,
60+
img_suffix='.jpg',
61+
seg_map_suffix='.png',
62+
**kwargs) -> None:
63+
super().__init__(
64+
img_suffix=img_suffix,
65+
seg_map_suffix=seg_map_suffix,
66+
ann_file=ann_file,
67+
**kwargs)
68+
assert fileio.exists(self.data_prefix['img_path'],
69+
self.backend_args) and osp.isfile(self.ann_file)

0 commit comments

Comments
 (0)