October 2018
Intermediate to advanced
472 pages
10h 57m
English
Since we are building a binary segmentation model, let us consider the images from the images/train2014 folder that are only tagged with the person label so that we can segment the person out of the image. The COCO API provides us with easy-to-use methods, two of which are the getCatIds and getImgIds. The following snippet will help us extract the image IDs of all the images with the label person tagged to it:
# extract the category ids using the label 'person'catIds = coco.getCatIds(catNms=['person'])# extract the image ids using the catIdsimgIds = coco.getImgIds(catIds=catIds )# print number of images with the tag 'person'print("Number of images with the tag 'person' :" ,len(imgIds))
This should be the output:
Number of images with ...
Read now
Unlock full access