代码拉取完成,页面将自动刷新
import torchvision.datasets as dataset
import torchvision.transforms as transforms
import torch
tr_tf = transforms.Compose([
transforms.RandomHorizontalFlip(),
transforms.Resize((224,224)),
transforms.CenterCrop((224,224)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])
te_tf = transforms.Compose([
transforms.Resize((224,224)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])])
tr_dataset = dataset.CocoCaptions(root = 'COCO_COCO_2014_Train_Images/train2014',
annFile = 'COCO_COCO_2014_Train_Val_annotations/annotations/captions_train2014.json',
transform=tr_tf)
te_dataset = dataset.CocoCaptions(root = 'COCO_COCO_2014_Val_Images/val2014',
annFile = 'COCO_COCO_2014_Train_Val_annotations/annotations/captions_val2014.json',
transform=te_tf)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。