dacapo.experiments.starts.cosem_start
Attributes
Classes
A class to represent the starting point for tasks. This class inherits |
Functions
|
Loads the model setup from the dacapo store for the specified run. The |
Module Contents
- dacapo.experiments.starts.cosem_start.logger
- dacapo.experiments.starts.cosem_start.get_model_setup(run)
Loads the model setup from the dacapo store for the specified run. The model setup includes the classes_channels, voxel_size_input and voxel_size_output.
- Parameters:
run – str The run for which the model setup is to be loaded.
- Returns:
- list
The classes_channels of the model.
- voxel_size_inputlist
The voxel_size_input of the model.
- voxel_size_outputlist
The voxel_size_output of the model.
- Return type:
classes_channels
- Raises:
Exception – If the model setup cannot be loaded, an Exception is thrown which is logged and handled by training the model without head matching.
Examples
>>> classes_channels, voxel_size_input, voxel_size_output = get_model_setup(run)
Notes
This function is called by the CosemStart class to load the model setup from the dacapo store for the specified run.
- class dacapo.experiments.starts.cosem_start.CosemStart(start_config)
A class to represent the starting point for tasks. This class inherits from the Start class and is used to load the weights of the starter model used for finetuning. The weights are loaded from the dacapo store for the specified run and criterion.
- run
str The run to be used as a starting point for tasks.
- criterion
str The criterion to be used for choosing weights from run.
- name
str The name of the run and criterion.
- channels
list The classes_channels of the model.
- __init__(start_config)
Initializes the CosemStart class with specified config to run the initialization of weights for a model associated with a specific criterion.
- check()
Checks if the checkpoint for the specified run and criterion exists.
- initialize_weights(model, new_head=None)
Retrieves the weights from the dacapo store and load them into the model.
Notes
This class is used to represent the starting point for tasks. The weights of the starter model used for finetuning are loaded from the dacapo store.
- run
- criterion
- name
- channels
- check()
Checks if the checkpoint for the specified run and criterion exists.
- Raises:
Exception – If the checkpoint does not exist, an Exception is thrown which is logged and handled by training the model without head matching.
Examples
>>> check()
Notes
This function is called by the CosemStart class to check if the checkpoint for the specified run and criterion exists.
- initialize_weights(model, new_head=None)
Retrieves the weights from the dacapo store and load them into the model.
- Parameters:
model – obj The model to which the weights are to be loaded.
new_head – list The labels of the new head.
- Returns:
- obj
The model with the weights loaded from the dacapo store.
- Return type:
model
- Raises:
RuntimeError – If weights of a non-existing or mismatched layer are being loaded, a RuntimeError exception is thrown which is logged and handled by loading only the common layers from weights.
Examples
>>> model = initialize_weights(model, new_head)
Notes
This function is called by the CosemStart class to retrieve the weights from the dacapo store and load them into the model.