Skip to main content

A systematic approach for determining optimal image resolution in deep learning-based microscopy segmentation, balancing accuracy with acquisition/storage costs.

Project description

ReScale4DL: Balancing Pixel and Contextual Information for Enhanced Bioimage Segmentation

PyPI Python 3.10-3.12 Oncall Tests codecov License: MIT

A systematic approach for determining optimal image resolution in deep learning-based microscopy segmentation, balancing accuracy with acquisition/storage costs. Following this approach, researchers can improve the sustainability and cost-effectiveness of bioimaging studies by reducing data and computing needs while optimising microscopy techniques.

Key Features

  • Resolution simulation: Rescale images and their respective annotations (upsample and downsample)
  • Segmentation evaluation: Compare performance across resolutions using:
    • Mean Intersection-over-Union (IoU)
    • Morphological features
    • Potential throughput
    • Personalised metrics
  • Visualization tools: Generate comparative plots and sample outputs

Installation

ReScale4DL is available as a Python package through pip. Activate your conda environment or create one:

conda create -n rescale4dl "python<=3.12"
conda activate rescale4dl

Install ReScale4DL with pip:

pip install rescale4dl

Manual installation

Manual installation using the GitHub repository

git clone https://github.com/HenriquesLab/ReScale4DL.git
cd rescale4dl
conda create -n rescale4dl "python<=3.12"
conda activate rescale4dl
python -m pip install .

Usage

1. Image Rescaling

Notebook: Rescale_Images.ipynb

2. Segmentation Analysis

Notebook: Evaluate_Segmentation.ipynb

3. Rescale and crop

Notebook: Rescale_Foundation_Models.ipynb

Additional DL resources for microscopy:

The deep learning networks presented in the ReScale4DL paper were trained using the following platforms:

  • ZeroCostDL4Mic: A Google Colab-based no-cost toolbox to explore Deep Learning in Microscopy
  • DL4MicEverywhere: Docker-based implementation bringing the ZeroCostDL4Mic experience for local deployment

For detailed hyperparameter settings and training configurations, please refer to Table 1 in our bioRxiv preprint.

Scripts

ReScale4DL provides a set of functionalities to quickly analyse your images and find an optimal pixel size:

  1. Rescaling the images in the path by donwsampling with a factor of 2 and 3, and by upsampling with a factor of 2:
rescale4dl.batch.process_all_datasets(“/path/data”, [2,3], [2], [1], modes=[“mean”])
  1. Analyse the segmentation results for different scaling factors in 2D:
rescale4dl.analyse(“/path/data”) 
  1. Analyse the segmentation results for different scaling factors in 3D:
rescale4dl.analyse(“/path/data”,
        is_3d=True,
        run_per_object_stats = False, # True for Instance Segmentation, False for Semantic or Binary Segmentation
        save_images = False, # True to save images of the segmentation examples and data distributions, False to skip saving images and saving some memory
        sampling_dir_list = None)

Contributing

We welcome contributions through:

License

MIT License - See LICENSE for details

How to cite this work

Ferreira, M.G., Saraiva, B.M., Brito, A.D., Pinho, M.G., Henriques, R. and Gómez-de-Mariscal, E., ReScale4DL: Balancing Pixel and Contextual Information for Enhanced Bioimage Segmentation. bioRxiv, pp.2025-04, (2025) https://doi.org/10.1101/2025.04.09.647871

ReScale4DL-preprint

@article{ferreira2025rescale4dl,
  title={ReScale4DL: Balancing Pixel and Contextual Information for Enhanced Bioimage Segmentation},
  author={Ferreira, Mariana G and Saraiva, Bruno M and Brito, Ant{\'o}nio D and Pinho, Mariana G and Henriques, Ricardo and G{\'o}mez-de-Mariscal, Estibaliz},
  journal={bioRxiv},
  pages={2025--04},
  year={2025},
  publisher={Cold Spring Harbor Laboratory},
  URL = https://doi.org/10.1101/2025.04.09.647871
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rescale4dl-0.2.2.tar.gz (56.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rescale4dl-0.2.2-py3-none-any.whl (51.9 kB view details)

Uploaded Python 3

File details

Details for the file rescale4dl-0.2.2.tar.gz.

File metadata

  • Download URL: rescale4dl-0.2.2.tar.gz
  • Upload date:
  • Size: 56.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rescale4dl-0.2.2.tar.gz
Algorithm Hash digest
SHA256 65cfbdfa641d715e4eddd467d948ba713674222ce099328e486d088ad628a506
MD5 9d3a34e2b878d02ea5ea9a3dee5fb12f
BLAKE2b-256 c43aae3008551e76e20e7fe4ca9c1d1bd8266eaefbbf67da4610b1aeaad2cbd5

See more details on using hashes here.

File details

Details for the file rescale4dl-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: rescale4dl-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 51.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for rescale4dl-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 67a5c22ea8b1a79ea63aba73d39382950adf9043f5d5e12a0de07a8be5efd607
MD5 90e26d98a666fe17f6282b8399008d91
BLAKE2b-256 90aa991a6cd523b326185df32a59a0077337746d156ca2ce51c9d0715dfb92ab

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page