five

tglcourse/latent_lsun_church_256px

收藏
Hugging Face2022-10-28 更新2024-03-04 收录
下载链接:
https://hf-mirror.com/datasets/tglcourse/latent_lsun_church_256px
下载链接
链接失效反馈
官方服务:
资源简介:
--- dataset_info: features: - name: label dtype: class_label: names: 0: '0' 1: '1' 2: '2' 3: '3' 4: '4' 5: '5' 6: '6' 7: '7' 8: '8' 9: '9' 10: a 11: b 12: c 13: d 14: e 15: f - name: latent sequence: sequence: sequence: float32 splits: - name: test num_bytes: 106824288 num_examples: 6312 - name: train num_bytes: 2029441460 num_examples: 119915 download_size: 2082210019 dataset_size: 2136265748 --- # Dataset Card for "latent_lsun_church_256px" This is derived from https://huggingface.co/datasets/tglcourse/lsun_church_train Each image is cropped to 256px square and encoded to a 4x32x32 latent representation using the same VAE as that employed by Stable Diffusion Decoding ```python from diffusers import AutoencoderKL from datasets import load_dataset from PIL import Image import numpy as np import torch # load the dataset dataset = load_dataset('tglcourse/latent_lsun_church_256px') # Load the VAE (requires access - see repo model card for info) vae = AutoencoderKL.from_pretrained("CompVis/stable-diffusion-v1-4", subfolder="vae") latent = torch.tensor([dataset['train'][0]['latent']]) # To tensor (bs, 4, 32, 32) latent = (1 / 0.18215) * latent # Scale to match SD implementation with torch.no_grad(): image = vae.decode(latent).sample[0] # Decode image = (image / 2 + 0.5).clamp(0, 1) # To (0, 1) image = image.detach().cpu().permute(1, 2, 0).numpy() # To numpy, channels lsat image = (image * 255).round().astype("uint8") # (0, 255) and type uint8 image = Image.fromarray(image) # To PIL image # The resulting PIL image ```

数据集信息: 特征字段: - 名称:label 数据类型: 分类标签(class_label): 类别名称: 0: '0' 1: '1' 2: '2' 3: '3' 4: '4' 5: '5' 6: '6' 7: '7' 8: '8' 9: '9' 10: a 11: b 12: c 13: d 14: e 15: f - 名称:隐变量(latent) 序列结构: 序列结构: 序列结构:32位浮点型(float32) 数据划分: - 名称:test 字节数:106824288 样本数:6312 - 名称:train 字节数:2029441460 样本数:119915 下载大小:2082210019 数据集总大小:2136265748 --- # 「latent_lsun_church_256px」数据集卡片 本数据集衍生自 https://huggingface.co/datasets/tglcourse/lsun_church_train 每张图像均被裁剪为256像素的正方形,并使用与Stable Diffusion同款的变分自编码器(Variational Autoencoder, VAE)编码为4×32×32的隐变量表示。 ## 解码 python from diffusers import AutoencoderKL from datasets import load_dataset from PIL import Image import numpy as np import torch # 加载数据集 dataset = load_dataset('tglcourse/latent_lsun_church_256px') # 加载变分自编码器(VAE)(需获取访问权限——详见仓库模型卡片说明) vae = AutoencoderKL.from_pretrained("CompVis/stable-diffusion-v1-4", subfolder="vae") latent = torch.tensor([dataset['train'][0]['latent']]) # 转换为张量(批量大小, 4, 32, 32) latent = (1 / 0.18215) * latent # 缩放以匹配Stable Diffusion的实现逻辑 with torch.no_grad(): image = vae.decode(latent).sample[0] # 解码 image = (image / 2 + 0.5).clamp(0, 1) # 归一化至(0,1)区间 image = image.detach().cpu().permute(1, 2, 0).numpy() # 转换为numpy数组,通道置于最后一维 image = (image * 255).round().astype("uint8") # 映射至(0,255)区间并转换为uint8类型 image = Image.fromarray(image) # 转换为PIL图像对象 image # 生成的PIL图像
提供机构:
tglcourse
原始信息汇总

数据集概述

数据集名称

  • 名称: latent_lsun_church_256px

数据集特征

  • 特征1: label

    • 数据类型: 类别标签
    • 类别名称:
      • 0: 0
      • 1: 1
      • 2: 2
      • 3: 3
      • 4: 4
      • 5: 5
      • 6: 6
      • 7: 7
      • 8: 8
      • 9: 9
      • 10: a
      • 11: b
      • 12: c
      • 13: d
      • 14: e
      • 15: f
  • 特征2: latent

    • 数据类型: 序列,序列类型为float32

数据集分割

  • 分割1: test

    • 数据大小: 106824288字节
    • 样本数量: 6312
  • 分割2: train

    • 数据大小: 2029441460字节
    • 样本数量: 119915

数据集大小

  • 下载大小: 2082210019字节
  • 数据集总大小: 2136265748字节
搜集汇总
数据集介绍
main_image_url
以上内容由遇见数据集搜集并总结生成
二维码
社区交流群
二维码
科研交流群
商业服务