Skip to content

Instantly share code, notes, and snippets.

@beeva-ricardoguerrero
Last active March 15, 2018 02:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beeva-ricardoguerrero/c3f862b9be23511e5e809b258d4acbc9 to your computer and use it in GitHub Desktop.
Save beeva-ricardoguerrero/c3f862b9be23511e5e809b258d4acbc9 to your computer and use it in GitHub Desktop.
How to load Pascal VOC 2012 Segmentation's ground truth in Python
def load_gt(gt_path, network_size):
"""
Load ground truth images with it's specific format.
VERY IMPORTANT TO LOAD GT THIS WAY. OTHERWISE THE VALUES WON'T BE CORRECT
To read more:
http://host.robots.ox.ac.uk/pascal/VOC/voc2012/segexamples/index.html
https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.misc.imread.html
"""
im = scipy.misc.imread(image_path, mode='P') # Split indexes from palette
return im
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment