当前位置:   article > 正文

FashionGen数据集下载

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()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

效果展示

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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/Li_阴宅/article/detail/797153
推荐阅读
相关标签
  

闽ICP备14008679号