ImageNet 288²
Collection
2 items
•
Updated
__key__
stringlengths 11
16
| cls
int64 0
999
| json
dict | latent
imagewidth (px) 27
420
|
---|---|---|---|
n02097047_2079 | 196 | {
"filename": "n02097047/n02097047_2079.JPEG",
"height": 375,
"label": 196,
"width": 500
} | |
n01682714_8546 | 40 | {
"filename": "n01682714/n01682714_8546.JPEG",
"height": 544,
"label": 40,
"width": 759
} | |
n03134739_3100 | 522 | {
"filename": "n03134739/n03134739_3100.JPEG",
"height": 500,
"label": 522,
"width": 333
} | |
n04254777_3064 | 806 | {
"filename": "n04254777/n04254777_3064.JPEG",
"height": 375,
"label": 806,
"width": 500
} | |
n02859443_5650 | 449 | {
"filename": "n02859443/n02859443_5650.JPEG",
"height": 333,
"label": 449,
"width": 500
} | |
n02096177_2282 | 192 | {
"filename": "n02096177/n02096177_2282.JPEG",
"height": 427,
"label": 192,
"width": 640
} | |
n02107683_5102 | 239 | {
"filename": "n02107683/n02107683_5102.JPEG",
"height": 360,
"label": 239,
"width": 480
} | |
n01443537_18604 | 1 | {
"filename": "n01443537/n01443537_18604.JPEG",
"height": 500,
"label": 1,
"width": 375
} | |
n02264363_4016 | 318 | {
"filename": "n02264363/n02264363_4016.JPEG",
"height": 365,
"label": 318,
"width": 500
} | |
n03759954_24005 | 650 | {
"filename": "n03759954/n03759954_24005.JPEG",
"height": 375,
"label": 650,
"width": 500
} | |
n03109150_39890 | 512 | {
"filename": "n03109150/n03109150_39890.JPEG",
"height": 150,
"label": 512,
"width": 200
} | |
n03876231_33996 | 696 | {
"filename": "n03876231/n03876231_33996.JPEG",
"height": 389,
"label": 696,
"width": 500
} | |
n04125021_5078 | 771 | {
"filename": "n04125021/n04125021_5078.JPEG",
"height": 1024,
"label": 771,
"width": 768
} | |
n04335435_124863 | 829 | {
"filename": "n04335435/n04335435_124863.JPEG",
"height": 333,
"label": 829,
"width": 500
} | |
n02106166_8341 | 232 | {
"filename": "n02106166/n02106166_8341.JPEG",
"height": 500,
"label": 232,
"width": 336
} | |
n03838899_28485 | 683 | {
"filename": "n03838899/n03838899_28485.JPEG",
"height": 375,
"label": 683,
"width": 500
} | |
n02114855_14674 | 272 | {
"filename": "n02114855/n02114855_14674.JPEG",
"height": 391,
"label": 272,
"width": 500
} | |
n04326547_19339 | 825 | {
"filename": "n04326547/n04326547_19339.JPEG",
"height": 356,
"label": 825,
"width": 500
} | |
n01687978_11724 | 42 | {
"filename": "n01687978/n01687978_11724.JPEG",
"height": 375,
"label": 42,
"width": 500
} | |
n02356798_1543 | 335 | {
"filename": "n02356798/n02356798_1543.JPEG",
"height": 103,
"label": 335,
"width": 128
} | |
n03899768_3286 | 706 | {
"filename": "n03899768/n03899768_3286.JPEG",
"height": 492,
"label": 706,
"width": 500
} | |
n02509815_1702 | 387 | {
"filename": "n02509815/n02509815_1702.JPEG",
"height": 375,
"label": 387,
"width": 500
} | |
n03599486_16623 | 612 | {
"filename": "n03599486/n03599486_16623.JPEG",
"height": 333,
"label": 612,
"width": 500
} | |
n03590841_10600 | 607 | {
"filename": "n03590841/n03590841_10600.JPEG",
"height": 600,
"label": 607,
"width": 518
} | |
n02125311_20209 | 286 | {
"filename": "n02125311/n02125311_20209.JPEG",
"height": 375,
"label": 286,
"width": 500
} | |
n02018795_1761 | 138 | {
"filename": "n02018795/n02018795_1761.JPEG",
"height": 333,
"label": 138,
"width": 500
} | |
n02391049_6385 | 340 | {
"filename": "n02391049/n02391049_6385.JPEG",
"height": 375,
"label": 340,
"width": 500
} | |
n04355338_2663 | 835 | {
"filename": "n04355338/n04355338_2663.JPEG",
"height": 375,
"label": 835,
"width": 500
} | |
n03085013_18918 | 508 | {
"filename": "n03085013/n03085013_18918.JPEG",
"height": 375,
"label": 508,
"width": 500
} | |
n02256656_9855 | 316 | {
"filename": "n02256656/n02256656_9855.JPEG",
"height": 356,
"label": 316,
"width": 500
} | |
n07697537_37711 | 934 | {
"filename": "n07697537/n07697537_37711.JPEG",
"height": 375,
"label": 934,
"width": 500
} | |
n01985128_36330 | 124 | {
"filename": "n01985128/n01985128_36330.JPEG",
"height": 480,
"label": 124,
"width": 640
} | |
n02085620_4259 | 151 | {
"filename": "n02085620/n02085620_4259.JPEG",
"height": 375,
"label": 151,
"width": 500
} | |
n04418357_996 | 854 | {
"filename": "n04418357/n04418357_996.JPEG",
"height": 33,
"label": 854,
"width": 140
} | |
n01775062_4721 | 77 | {
"filename": "n01775062/n01775062_4721.JPEG",
"height": 354,
"label": 77,
"width": 500
} | |
n04517823_6792 | 882 | {
"filename": "n04517823/n04517823_6792.JPEG",
"height": 375,
"label": 882,
"width": 500
} | |
n02493793_8287 | 381 | {
"filename": "n02493793/n02493793_8287.JPEG",
"height": 580,
"label": 381,
"width": 629
} | |
n04154565_19128 | 784 | {
"filename": "n04154565/n04154565_19128.JPEG",
"height": 375,
"label": 784,
"width": 500
} | |
n03384352_20773 | 561 | {
"filename": "n03384352/n03384352_20773.JPEG",
"height": 500,
"label": 561,
"width": 375
} | |
n03764736_8352 | 653 | {
"filename": "n03764736/n03764736_8352.JPEG",
"height": 375,
"label": 653,
"width": 500
} | |
n02051845_23189 | 144 | {
"filename": "n02051845/n02051845_23189.JPEG",
"height": 357,
"label": 144,
"width": 500
} | |
n03496892_32808 | 595 | {
"filename": "n03496892/n03496892_32808.JPEG",
"height": 266,
"label": 595,
"width": 400
} | |
n03924679_5226 | 713 | {
"filename": "n03924679/n03924679_5226.JPEG",
"height": 484,
"label": 713,
"width": 480
} | |
n02277742_11237 | 322 | {
"filename": "n02277742/n02277742_11237.JPEG",
"height": 500,
"label": 322,
"width": 500
} | |
n03481172_4420 | 587 | {
"filename": "n03481172/n03481172_4420.JPEG",
"height": 449,
"label": 587,
"width": 600
} | |
n02488291_3763 | 374 | {
"filename": "n02488291/n02488291_3763.JPEG",
"height": 375,
"label": 374,
"width": 500
} | |
n09332890_14685 | 975 | {
"filename": "n09332890/n09332890_14685.JPEG",
"height": 533,
"label": 975,
"width": 800
} | |
n02102177_6206 | 218 | {
"filename": "n02102177/n02102177_6206.JPEG",
"height": 500,
"label": 218,
"width": 334
} | |
n02110627_7404 | 252 | {
"filename": "n02110627/n02110627_7404.JPEG",
"height": 250,
"label": 252,
"width": 267
} | |
n02692877_16062 | 405 | {
"filename": "n02692877/n02692877_16062.JPEG",
"height": 354,
"label": 405,
"width": 500
} | |
n01945685_1700 | 114 | {
"filename": "n01945685/n01945685_1700.JPEG",
"height": 450,
"label": 114,
"width": 500
} | |
n01984695_1678 | 123 | {
"filename": "n01984695/n01984695_1678.JPEG",
"height": 375,
"label": 123,
"width": 500
} | |
n01768244_6189 | 69 | {
"filename": "n01768244/n01768244_6189.JPEG",
"height": 375,
"label": 69,
"width": 500
} | |
n02102318_11235 | 219 | {
"filename": "n02102318/n02102318_11235.JPEG",
"height": 375,
"label": 219,
"width": 500
} | |
n04532670_1434 | 888 | {
"filename": "n04532670/n04532670_1434.JPEG",
"height": 333,
"label": 888,
"width": 500
} | |
n01985128_48369 | 124 | {
"filename": "n01985128/n01985128_48369.JPEG",
"height": 375,
"label": 124,
"width": 500
} | |
n03457902_44380 | 580 | {
"filename": "n03457902/n03457902_44380.JPEG",
"height": 482,
"label": 580,
"width": 500
} | |
n03721384_129 | 642 | {
"filename": "n03721384/n03721384_129.JPEG",
"height": 333,
"label": 642,
"width": 500
} | |
n02687172_343 | 403 | {
"filename": "n02687172/n02687172_343.JPEG",
"height": 1143,
"label": 403,
"width": 1600
} | |
n02105162_1395 | 225 | {
"filename": "n02105162/n02105162_1395.JPEG",
"height": 372,
"label": 225,
"width": 500
} | |
n07590611_18076 | 926 | {
"filename": "n07590611/n07590611_18076.JPEG",
"height": 1600,
"label": 926,
"width": 1200
} | |
n01744401_12937 | 62 | {
"filename": "n01744401/n01744401_12937.JPEG",
"height": 339,
"label": 62,
"width": 500
} | |
n07754684_16025 | 955 | {
"filename": "n07754684/n07754684_16025.JPEG",
"height": 500,
"label": 955,
"width": 375
} | |
n01910747_17166 | 107 | {
"filename": "n01910747/n01910747_17166.JPEG",
"height": 334,
"label": 107,
"width": 500
} | |
n02279972_23178 | 323 | {
"filename": "n02279972/n02279972_23178.JPEG",
"height": 333,
"label": 323,
"width": 500
} | |
n02815834_9366 | 438 | {
"filename": "n02815834/n02815834_9366.JPEG",
"height": 505,
"label": 438,
"width": 400
} | |
n03710193_1449 | 637 | {
"filename": "n03710193/n03710193_1449.JPEG",
"height": 375,
"label": 637,
"width": 500
} | |
n07930864_23929 | 968 | {
"filename": "n07930864/n07930864_23929.JPEG",
"height": 500,
"label": 968,
"width": 375
} | |
n03110669_96993 | 513 | {
"filename": "n03110669/n03110669_96993.JPEG",
"height": 360,
"label": 513,
"width": 500
} | |
n01530575_6305 | 10 | {
"filename": "n01530575/n01530575_6305.JPEG",
"height": 300,
"label": 10,
"width": 400
} | |
n03781244_1878 | 663 | {
"filename": "n03781244/n03781244_1878.JPEG",
"height": 1181,
"label": 663,
"width": 1772
} | |
n02090622_1774 | 169 | {
"filename": "n02090622/n02090622_1774.JPEG",
"height": 402,
"label": 169,
"width": 500
} | |
n01740131_10089 | 60 | {
"filename": "n01740131/n01740131_10089.JPEG",
"height": 500,
"label": 60,
"width": 333
} | |
n01924916_9978 | 110 | {
"filename": "n01924916/n01924916_9978.JPEG",
"height": 465,
"label": 110,
"width": 700
} | |
n04371774_14380 | 843 | {
"filename": "n04371774/n04371774_14380.JPEG",
"height": 333,
"label": 843,
"width": 500
} | |
n02776631_47437 | 415 | {
"filename": "n02776631/n02776631_47437.JPEG",
"height": 450,
"label": 415,
"width": 430
} | |
n01614925_4827 | 22 | {
"filename": "n01614925/n01614925_4827.JPEG",
"height": 500,
"label": 22,
"width": 375
} | |
n07693725_13112 | 931 | {
"filename": "n07693725/n07693725_13112.JPEG",
"height": 332,
"label": 931,
"width": 500
} | |
n03792972_4117 | 672 | {
"filename": "n03792972/n03792972_4117.JPEG",
"height": 226,
"label": 672,
"width": 500
} | |
n07745940_6739 | 949 | {
"filename": "n07745940/n07745940_6739.JPEG",
"height": 375,
"label": 949,
"width": 500
} | |
n07579787_10354 | 923 | {
"filename": "n07579787/n07579787_10354.JPEG",
"height": 359,
"label": 923,
"width": 500
} | |
n02086646_758 | 156 | {
"filename": "n02086646/n02086646_758.JPEG",
"height": 500,
"label": 156,
"width": 500
} | |
n01692333_6430 | 45 | {
"filename": "n01692333/n01692333_6430.JPEG",
"height": 344,
"label": 45,
"width": 434
} | |
n02089867_6457 | 166 | {
"filename": "n02089867/n02089867_6457.JPEG",
"height": 375,
"label": 166,
"width": 500
} | |
n07717410_2929 | 941 | {
"filename": "n07717410/n07717410_2929.JPEG",
"height": 375,
"label": 941,
"width": 500
} | |
n01735189_8982 | 57 | {
"filename": "n01735189/n01735189_8982.JPEG",
"height": 338,
"label": 57,
"width": 500
} | |
n07613480_5216 | 927 | {
"filename": "n07613480/n07613480_5216.JPEG",
"height": 375,
"label": 927,
"width": 500
} | |
n04074963_7429 | 761 | {
"filename": "n04074963/n04074963_7429.JPEG",
"height": 400,
"label": 761,
"width": 400
} | |
n04483307_15897 | 871 | {
"filename": "n04483307/n04483307_15897.JPEG",
"height": 333,
"label": 871,
"width": 500
} | |
n04356056_2359 | 837 | {
"filename": "n04356056/n04356056_2359.JPEG",
"height": 375,
"label": 837,
"width": 500
} | |
n02835271_9310 | 444 | {
"filename": "n02835271/n02835271_9310.JPEG",
"height": 375,
"label": 444,
"width": 500
} | |
n04009552_11732 | 745 | {
"filename": "n04009552/n04009552_11732.JPEG",
"height": 668,
"label": 745,
"width": 400
} | |
n13040303_2762 | 994 | {
"filename": "n13040303/n13040303_2762.JPEG",
"height": 300,
"label": 994,
"width": 400
} | |
n02966687_13432 | 477 | {
"filename": "n02966687/n02966687_13432.JPEG",
"height": 200,
"label": 477,
"width": 134
} | |
n02422699_2574 | 352 | {
"filename": "n02422699/n02422699_2574.JPEG",
"height": 500,
"label": 352,
"width": 333
} | |
n03676483_13235 | 629 | {
"filename": "n03676483/n03676483_13235.JPEG",
"height": 500,
"label": 629,
"width": 500
} | |
n01774384_3728 | 75 | {
"filename": "n01774384/n01774384_3728.JPEG",
"height": 333,
"label": 75,
"width": 500
} | |
n03899768_107988 | 706 | {
"filename": "n03899768/n03899768_107988.JPEG",
"height": 375,
"label": 706,
"width": 500
} | |
n03124043_6640 | 514 | {
"filename": "n03124043/n03124043_6640.JPEG",
"height": 480,
"label": 514,
"width": 360
} | |
n03347037_15784 | 556 | {
"filename": "n03347037/n03347037_15784.JPEG",
"height": 250,
"label": 556,
"width": 250
} |
The full ImageNet-1k compressed to less than 5 GB
Compression procedure:
import torch
import datasets
from types import SimpleNamespace
from diffusers import AutoencoderDC
from torchvision.transforms.v2 import ToPILImage, PILToTensor, RandomCrop, CenterCrop
from walloc.walloc import pil_to_latent
from IPython.display import display
device = 'cuda'
config = SimpleNamespace()
config.crop_size = 160
config.valid_crop_size = 288
ds = datasets.load_dataset('danjacobellis/imagenet_288_dcae_fp8')
decoder = AutoencoderDC.from_pretrained("mit-han-lab/dc-ae-f32c32-sana-1.1-diffusers", torch_dtype=torch.float32).decoder.to(device)
rand_crop = RandomCrop((config.crop_size//32,config.crop_size//32))
cent_crop = CenterCrop((config.valid_crop_size//32,config.valid_crop_size//32))
def train_collate_fn(batch):
B = len(batch)
x = torch.zeros((B, 32, config.crop_size//32, config.crop_size//32), dtype=torch.torch.float8_e4m3fn)
y = torch.zeros(B, dtype=torch.long)
for i_sample, sample in enumerate(batch):
y[i_sample] = sample['cls']
z = pil_to_latent([sample['latent']], N=36, n_bits=8, C=4)[:,:32]
x[i_sample,:,:,:] = rand_crop(z.to(torch.int8).view(torch.float8_e4m3fn))
return x, y
def valid_collate_fn(batch):
B = len(batch)
x = torch.zeros((B, 32, config.valid_crop_size//32, config.valid_crop_size//32), dtype=torch.torch.float8_e4m3fn)
y = torch.zeros(B, dtype=torch.long)
for i_sample, sample in enumerate(batch):
y[i_sample] = sample['cls']
z = pil_to_latent([sample['latent']], N=36, n_bits=8, C=4)[:,:32]
x[i_sample,:,:,:] = cent_crop(z.to(torch.int8).view(torch.float8_e4m3fn))
return x, y
%%time
# warmup batch
x,y = valid_collate_fn(ds['train'].select(range(64)))
with torch.no_grad():
xh = decoder(x.to(torch.float32).to(device))
CPU times: user 1.68 s, sys: 124 ms, total: 1.8 s
Wall time: 1.47 s
%%time
x,y = valid_collate_fn(ds['train'].select(range(64)))
with torch.no_grad():
xh = decoder(x.to(torch.float32).to(device))
CPU times: user 282 ms, sys: 2.51 ms, total: 285 ms
Wall time: 29.2 ms
for img in xh[:2]:
display(ToPILImage()(img.clamp(-0.5,0.5)+0.5))
!jupyter nbconvert --to markdown README.ipynb
[NbConvertApp] Converting notebook README.ipynb to markdown
[NbConvertApp] Support files will be in README_files/
[NbConvertApp] Making directory README_files
[NbConvertApp] Writing 2752 bytes to README.md