title: How to create mask images from COCO dataset?
body: <p>So I have been using this code,. I am trying to generate the raw mask of the images from COCO dataset.     </p>
  
  <pre><code>dataDir='G:'
  dataType='train2014'
  annFile='{}/annotations/instances_{}.json'.format(dataDir,dataType)
  
  
  coco=COCO(annFile)
  annFile = '{}/annotations/person_keypoints_{}.json'.format(dataDir,dataType)
  coco_kps=COCO(annFile)
  
  
  catIds = coco.getCatIds(catNms=['person'])
  imgIds = coco.getImgIds(catIds=catIds );
  imgIds = coco.getImgIds(imgIds = imgIds[0])
  img = coco.loadImgs(imgIds[np.random.randint(0,len(imgIds))])[0]
  I = io.imread('G:/train2014/'+img['file_name'])
  
  plt.imshow(I); plt.axis('off')
  annIds = coco.getAnnIds(imgIds=img['id'], catIds=catIds, iscrowd=None)
  anns = coco.loadAnns(annIds)
  coco.showAnns(anns)
  </code></pre>
  
  <p>But what i get is some thing like this </p>
  
  <p><a href="https://i.stack.imgur.com/1qq3D.png" rel="noreferrer"><img src="https://i.stack.imgur.com/1qq3D.png" alt="enter image description here"></a></p>
  
  <p>But what I want is something like this </p>
  
  <p><a href="https://i.stack.imgur.com/rSwZ1.png" rel="noreferrer"><img src="https://i.stack.imgur.com/rSwZ1.png" alt="enter image description here"></a></p>
  
  <p>How can I get the raw mask against each image ? </p>