COCO
需要安装COCO API
图像标注:
dset.CocoCaptions(root="dir where images are", annFile="json annotation file", [transform, target_transform])
例子:
import torchvision.datasets as dsetimport torchvision.transforms as transformscap = dset.CocoCaptions(root = 'dir where images are', annFile = 'json annotation file', transform=transforms.ToTensor())print('Number of samples: ', len(cap))img, target = cap[3] # load 4th sampleprint("Image Size: ", img.size())print(target)
输出:
Number of samples: 82783Image Size: (3L, 427L, 640L)[u'A plane emitting smoke stream flying over a mountain.',u'A plane darts across a bright blue sky behind a mountain covered in snow',u'A plane leaves a contrail above the snowy mountain top.',u'A mountain that has a plane flying overheard in the distance.',u'A mountain view with a plume of smoke in the background']
检测:
dset.CocoDetection(root="dir where images are", annFile="json annotation file", [transform, target_transform])