Converting VOC2012 annotation .xml to segmentation .png
This is Deeplab's bash script for preprocessing the dataset which may help - https://github.com/tensorflow/models/blob/master/research/deeplab/datasets/download_and_convert_voc2012.sh

Some people reported running into some problems reading the annotations, which is covered here https://stackoverflow.com/questions/51676447/python-use-pil-to-load-png-file-gives-strange-results?noredirect=1#comment90316222_51676447