October 2018
Intermediate to advanced
472 pages
10h 57m
English
Let us now define a data_list() function that will automate the process of loading an image and its segmentation array into memory and resize them to the shape of 360*480 using OpenCV. This function returns two lists containing images and segmentation array:
def data_list(imgIds, count = 12127, ratio = 0.2): """Function to load image and its target into memory.""" img_lst = [] lab_lst = [] for x in tqdm(imgIds[0:count]): # load image details img = coco.loadImgs(x)[0] # read image I = io.imread('images/train2014/'+img['file_name']) if len(I.shape)<3: continue # load annotation information annIds = coco.getAnnIds(imgIds=img['id'], catIds=catIds, iscrowd=None) # load annotation anns = coco.loadAnns(annIds) # prepare mask ...Read now
Unlock full access