BigCell
Collection
Gigapixel whole-slide image generation.
More info at https://histodiffusion.github.io/docs/projects/bigcell/ • 2 items • Updated
Error code: StreamingRowsError
Exception: ValueError
Message: Dataset 'size_2048' has length 367 but expected 7
Traceback: Traceback (most recent call last):
File "/src/services/worker/src/worker/utils.py", line 147, in get_rows_or_raise
return get_rows(
dataset=dataset,
...<4 lines>...
column_names=column_names,
)
File "/src/libs/libcommon/src/libcommon/utils.py", line 272, in decorator
return func(*args, **kwargs)
File "/src/services/worker/src/worker/utils.py", line 127, in get_rows
rows_plus_one = list(itertools.islice(safe_iter(ds, dataset=dataset), rows_max_number + 1))
File "/src/services/worker/src/worker/utils.py", line 483, in safe_iter
yield from ds.decode(False) if ds.features else ds
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2951, in __iter__
for key, example in ex_iterable:
^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2461, in __iter__
for key, pa_table in self._iter_arrow():
~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 2486, in _iter_arrow
for key, pa_table in self.ex_iterable._iter_arrow():
~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 547, in _iter_arrow
for key, pa_table in iterator:
^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/iterable_dataset.py", line 430, in _iter_arrow
for key, pa_table in self.generate_tables_fn(**gen_kwags):
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/hdf5/hdf5.py", line 76, in _generate_tables
num_rows = _check_dataset_lengths(h5, self.info.features)
File "/usr/local/lib/python3.14/site-packages/datasets/packaged_modules/hdf5/hdf5.py", line 353, in _check_dataset_lengths
raise ValueError(f"Dataset '{path}' has length {dset.shape[0]} but expected {num_rows}")
ValueError: Dataset 'size_2048' has length 367 but expected 7Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
This is a small sample of the data format used to train and evaluate BigCell (GitHub). It contains two 32,768×32,768 regions at 20×:
| Region | Source |
|---|---|
cptac/AML/C3L-00453-41_x0_y0 |
CPTAC (AML) |
tcga_diagnostic/brca/TCGA-3C-AALI-01Z-00-DX1.F6E9A5DF-D8FB-45CF-B4BD-C6B76294C291_x0_y0 |
TCGA-BRCA (diagnostic) |
Each region is cut into non-overlapping crops of 2048 to 32768 px, excluding background. The sample has 6.8 GB, 1,600 files.
All crops are at 20×. <size> is the side length of the crop in pixels at 20×.
<source>/<type>/<slide>_x<X>_y<Y>/<size>/ size ∈ {2048, 4096, 8192, 16384, 32768}
<N>.jpg 2048×2048 image (the crop downsampled when size > 2048)
<N>_full.jpg the crop at full resolution (size > 2048)
<N>_uni.npy (size/256, size/256, 1536) float16 UNI-2h grid, one token per 256×256 patch
<N>_vae.npy (64, 256, 256) float16 FLUX.2 VAE posterior mean ‖ std of <N>.jpg
metadata/
image_list_train.h5 datasets size_<size>: relative paths of every <N>.jpg
new_organ_split.csv organ ↔ (source, type) used in the paper
image_embedding_stats/uni2_{4096,8192}/normalization_stats.pt
per-position mean / var of UNI-2 grids over the full training set (used by the CGM)
| size | crops | used for |
|---|---|---|
| 2048 | 367 | training the tile generator (_vae.npy + _uni.npy) |
| 4096 / 8192 | 93 / 24 | CGM training grids; 4k / 8k generation |
| 16384 / 32768 | 7 / 2 | 16k / 32k generation |
huggingface-cli download StonyBrook-CVLab/BigCell-sample-data --repo-type dataset --local-dir bigcell_sample_data
# generate an 8192×8192 image from a real region's UNI-2 grid
python scripts/generate_from_grid.py --grid bigcell_sample_data/cptac/AML/C3L-00453-41_x0_y0/8192/0_uni.npy --out 8k.jpg
# fine-tune the 2048 tile generator on the sample
torchrun --nproc_per_node 4 -m bigcell.train configs/bigcell/2048.yaml --data-dir bigcell_sample_data \
--init-from bigcell-2048 --batch-size 8 --max-train-steps 100
The TITAN report embeddings that the CGM is trained on are not part of this sample.
CC BY-NC-ND 4.0. The images derive from CPTAC and TCGA, which are subject to their original data-use terms. The UNI-2h features and FLUX.2 latents are subject to the licences of those models.