We present a simple yet effective approach, object-contextual representations, characterizing a pixel by exploiting the representation of the corresponding object class. First, we learn object regions under the supervision of ground-truth segmentation. Second, we compute the object region representation by aggregating the representations of the pixels lying in the object region. Last, % the representation similarity we compute the relation between each pixel and each object region and augment the representation of each pixel with the object-contextual representation which is a weighted aggregation of all the object region representations according to their relations with the pixel.
git clone -b release/2.8 https://github.com/PaddlePaddle/PaddleSeg.git
cd PaddleSeg
pip3 install -r requirements.txt
pip3 install protobuf==3.20.3
pip3 install urllib3==1.26.13
python3 setup.py install
yum install -y mesa-libGL
Go to visit Cityscapes official website, then choose 'Download' to download the Cityscapes dataset.
Specify /path/to/cityscapes
to your Cityscapes path in later training process, the unzipped dataset path structure sholud look like:
cityscapes/
├── gtFine
│ ├── test
│ ├── train
│ │ ├── aachen
│ │ └── bochum
│ └── val
│ ├── frankfurt
│ ├── lindau
│ └── munster
└── leftImg8bit
├── train
│ ├── aachen
│ └── bochum
└── val
├── frankfurt
├── lindau
└── munster
# Datasets preprocessing
pip3 install cityscapesscripts
python3 tools/data/convert_cityscapes.py --cityscapes_path /path/to/cityscapes --num_workers 8
python3 tools/data/create_dataset_list.py /path/to/cityscapes --type cityscapes --separator ","
# CityScapes PATH as follow:
tree -L 2 /path/to/cityscapes
/path/to/cityscapes/
├── gtFine
│ ├── test
│ ├── train
│ └── val
├── leftImg8bit
│ ├── test
│ ├── train
│ └── val
├── test.txt
├── train.txt
└── val.txt
# Change '/path/to/cityscapes' as your local Cityscapes dataset path
data_dir=/path/to/cityscapes
sed -i "s#: data/cityscapes#: ${data_dir}#g" configs/_base_/cityscapes.yml
# Set up environment variables
export FLAGS_cudnn_exhaustive_search=True
export FLAGS_cudnn_batchnorm_spatial_persistent=True
# One GPU
export CUDA_VISIBLE_DEVICES=0
python3 tools/train.py --config configs/ocrnet/ocrnet_hrnetw18_cityscapes_1024x512_160k.yml --do_eval --use_vdl
# Four GPUs
export CUDA_VISIBLE_DEVICES=0,1,2,3
python3 -u -m paddle.distributed.launch --gpus 0,1,2,3 tools/train.py \
--config configs/ocrnet/ocrnet_hrnetw18_cityscapes_1024x512_160k.yml \
--do_eval \
--use_vdl
GPU | IPS | ACC |
---|---|---|
BI-V100 x 4 | 2.12 samples/sec | mIoU=0.8120 |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。