FashionGen数据集下载

FashionGen数据集下载

数据集下载

FashionGen数据集是一个公开数据集,经常用来做图文融合。但是去官网下载的话只是填了一个问卷,接着就没有下文了。
经过很长时间的寻找,我最终找到了一个可以在Google Drive上进行下载的FashionGen训练集和验证集,我下载下来后将其存在百度网盘中,供大家下载使用。
由于百度网盘上传文件大小限制,这里将训练集分卷压缩后上传,使用者下载下来后,将训练集的几个压缩文件放在一个目录下,全选中,右键解压即可。
链接:https://pan.baidu.com/s/1amJvPYeRXYP-uKv8Cl1fyQ
提取码:pz7a

数据集解析并保存所需信息到csv,以及保存图片

import h5py
import csv
from PIL import Image

csvfile_path = './fashiongen_train'
path_behind = 0
headline = ['index','description','category']

file_h5 = h5py.File('fashiongen_256_256_train.h5', 'r')

for i in range(0,len(file_h5['index'])-1):
    print(i)
    index = file_h5['index'][i][0]
    try:
        category = str(file_h5['input_category'][i][0],'UTF-8')
        description = str(file_h5['input_description'][i][0],'UTF-8')
    except Exception as e:
        continue
    img = Image.fromarray(file_h5['input_image'][i])
    img.save('./image/' + str(index) + '.jpg')
    if index % 50000 == 0:
        path_behind += 1
        csvfile = open(csvfile_path + str(path_behind) + '.csv', 'w', newline='')
        writer = csv.DictWriter(csvfile, fieldnames=headline)
        writer.writeheader()

    newData = {'index': str(index), 'description': description, 'category': category}
    writer.writerow(newData)

csvfile.close()

效果展示

在这里插入图片描述
在这里插入图片描述

  • 6
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 4
    评论
评论 4
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值