Skip to main content

MetroEM

Train all aligners

Get started

MetroEM is based on modelhouse, artificery, and scalenet packages. It's useful to understand these packages before proceeding.

Create a model

Create a directory, with subdirectories for each module. It's easiest to adapt an existing model. For example, use modelhouse to download the following model:

modelhouse load gs://corgie/models/pyramid_m4m6m9

Module conventions

Module subdirectories must follow the name convention

<STAGE>_mip<IN_MIP>in_<SUFFIX>

such that:

  • STAGE (int): processing order of module (lowest-to-highest, 0-indexed)
  • IN_MIP (int): mip level of the images to be used as input
  • SUFFIX (str): string for description only

Each module subdirectory must follow modelhouse directory conventions.

Create a training set

Training sets consists of an image dataset as well as a field dataset.

An image dataset is a set of image pairs (source and target images), one set of image pairs for the MIP level required as input for each module.

A field dataset is a displacement field computed by a previous module, one field for each image in an image set.

Create an image dataset

Image datasets may be created from CloudVolumes. For models with multiple modules, the image set of each module must be aligned in physical space across the span of MIP levels.
Images should be normalized (mean=0, std=1) over a larger field of view than the model. See corgie for a method to normalize CloudVolumes.

To create a dataset from a CloudVolume, use download_image.py. For example,

python download_image.py \
--dst_folder  ~/data \
--z_start 8175 \
--z_end 8180 \
--x_offset 200960 \
--y_offset 136448 \
--mip 3 5 \
--patch_size 1536 1536 \
--cv_path <CloudVolume path>

Create a field dataset

Field datasets will be automatically created during the training procedure.

Downloading from an existing field CloudVolume

There may be times when a user would like to create a field dataset from an existing field CloudVolume. To do so, use download_field.py. For example:

python download_field.py \
--dst_folder  ~/data/ \ 
--z_start 8175 \       
--z_end 8180 \	
--x_offset 200960 \
--y_offset 136448 \
--src_mip 8 \
--dst_mip 5 \
--patch_size 1536 \
--suffix precomputed \
--cv_path <CloudVolume path>

Once downloaded, a field dataset must be used as input when creating a new image dataset. For example:

python download_image.py \
--dst_folder  ~/data \
--z_start 8175 \
--z_end 8180 \
--x_offset 200960 \
--y_offset 136448 \
--mip 5 \
--patch_size 1536 \
--cv_path <CloudVolume path> \
--field_dset ~/data/field_0_x200960_y136448_z8175_MIP5_precomputed.h5 \

Each downloaded field is adjusted by its average translation, and the bounding box of the associated image must also be adjusted by the translation.

Train

With a model & dataset in place, it's time to train the model with train.py. For example:

python train.py \
--pyramid_path ~/model/m4m6m8 \
--dataset_path ~/data \
--train_mode scratch \
--train_stages 1 \
--generate_field_stages 1 \
--checkpoint_name precomputed \
--no_redirect_stdout

Metadata

Release files for metroem 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metroem 0.1.3
File Size Uploaded
metroem-0.1.3.tar.gz 33.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for metroem 0.1.3
File Interpreter ABI Platform
metroem-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 74.7 kB

Release files / metroem-0.1.3.tar.gz

Download URL metroem-0.1.3.tar.gz
Size 33.0 kB
Tags Source
SHA-256 checksum
How to use checksums
7ad8ab593a626ce8f4af1ff32e5193f22825f48004177c6cd7abb8c5b4e90f0d
BLAKE2b-256 checksum
How to use checksums
23ac710947400f2dec19174d1fc91582379da522f773fa5d684d1c7eac9a41fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release files / metroem-0.1.3-py3-none-any.whl

Download URL metroem-0.1.3-py3-none-any.whl
Size 41.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b683b5efcc561b6a467ffaf9a658af7124daab39a8e8bd139fdeefba8666e1df
BLAKE2b-256 checksum
How to use checksums
5c44c9d8c811872ae2d8cf584f0c20cd18992b3c6a21159c31676bae03d70af8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.7.13

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.9

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page