1 Star 1 Fork 1

oscarlin/imagecaption

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
dataloader.py 1.07 KB
一键复制 编辑 原始数据 按行查看 历史
SAKURA-CAT 提交于 2021-05-10 17:59 . update
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)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/oscarlin/imagecaption.git
git@gitee.com:oscarlin/imagecaption.git
oscarlin
imagecaption
imagecaption
master

搜索帮助

23e8dbc6 1850385 7e0993f3 1850385