Skip to content

Commit fa39f24

Browse files
authored
Update README.md
1 parent bfe01d5 commit fa39f24

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,15 @@ Please refer to [this commit (Xception)](https://github.com/VainF/DeepLabV3Plus-
5757

5858
### 7. New datasets
5959

60-
You can train deeplab models on your own datasets. Your ``torch.utils.data.Dataset`` should provide the following class methods for visualization, just like the [Cityscapes Dataset](https://github.com/VainF/DeepLabV3Plus-Pytorch/blob/9d501682bca56d3b7c1f54c7b73ef99d8a7747d9/datasets/cityscapes.py#L105):
60+
You can train deeplab models on your own datasets. Your ``torch.utils.data.Dataset`` should provide a decoding method that transforms your predictions to colorized images, just like the [VOC Dataset]([https://github.com/VainF/DeepLabV3Plus-Pytorch/blob/9d501682bca56d3b7c1f54c7b73ef99d8a7747d9/datasets/cityscapes.py#L105](https://github.com/VainF/DeepLabV3Plus-Pytorch/blob/bfe01d5fca5b6bb648e162d522eed1a9a8b324cb/datasets/voc.py#L156)):
6161
```python
62-
@classmethod
63-
def encode_target(cls, target):
64-
return cls.id_to_train_id[np.array(target)]
65-
66-
@classmethod
67-
def decode_target(cls, target):
68-
target[target == 255] = 19
69-
return cls.train_id_to_color[target]
62+
63+
class MyDataset(data.Dataset):
64+
...
65+
@classmethod
66+
def decode_target(cls, mask):
67+
"""decode semantic mask to RGB image"""
68+
return cls.cmap[mask]
7069
```
7170

7271

0 commit comments

Comments
 (0)