Skip to main content

Toolbox for running N2V and friends.

Project description

CAREamics Restoration

License PyPI Python Version CI codecov

Installation

pip install careamics

For more details on the options please follow the installation guide.

Usage

CAREamics uses the Engine object to construct the pipeline for both training and prediction. First we import the Engine.

from careamics_restoration.engine import Engine

The Engine could be initialized in 2 ways:

  1. Using the yaml config file

Specify the mandatory parameters in the config file

experiment_name: Name of the experiment
working_directory: Path to the working directory, where all the outputs will be stored

algorithm: 
    loss: type of loss function, e.g. n2v for Noise2Void
    model: model architecture, e.g. UNet
    is_3D: True if 3D data, False if 2D data

training:
  num_epochs: Number of training epochs
  patch_size: Size of the patches, List of 2 or 3 elements
  batch_size: Batch size for training

extraction_strategy: Controls how the patches are extracted from the data

data:
    data_format: File extension, e.g. tif
    axes: Defines the shape of the input data

Full description of the configuration parameters is in the documentation.

engine = Engine(config_path="config.yml")
  1. Using the path to the pretrained model It's also possible to initialize the Engine using the model checkpoint, saved during the training or downloaded from the BioImage Model Zoo. Checkpoint must contain model_state_dict. Read more abount saving and loading models in the documentation.

Once Engine is initialized, we can start training, providing the relative paths to train and validation data

engine.train(train_path=train_path, val_path=val_path)

Training will run for the specified number of epochs and save the model checkpoint in the working directory.

Prediction could be done directly after the training or by loading the pretrained model checkpoint.

predictions = engine.predict(pred_path=predict_path)

For more examples please take a look at the notebooks.

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

careamics-0.1.0rc4.tar.gz (122.1 kB view hashes)

Uploaded Source

Built Distribution

careamics-0.1.0rc4-py3-none-any.whl (134.4 kB view hashes)

Uploaded Python 3

Supported by

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