morpheus_framework package¶
Subpackages¶
Submodules¶
morpheus_framework.morpheus_framework module¶
-
class
morpheus_core.morpheus_core.AGGREGATION_METHODS[source]¶ Bases:
objectHelper class with string constants to use as arguments in morpheus_core methods.
-
INVALID_ERR= 'Invalid aggregation method please select one of AGGREGATION_METHODS.MEAN_VAR or AGGREGATION_METHODS.RANK_VOTE'¶
-
MEAN_VAR= 'mean_var'¶
-
RANK_VOTE= 'rank_vote'¶
-
-
morpheus_core.morpheus_core.predict(model: Callable, model_inputs: List[Union[str, numpy.ndarray]], n_classes: int, batch_size: int, window_shape: Tuple[int, int], dilation: float = 1, stride: Tuple[int, int] = (1, 1), update_map: numpy.ndarray = None, aggregate_method: str = 'rank_vote', out_dir: str = None, gpus: List[int] = None, cpus: int = None, parallel_check_interval: float = 1) → Tuple[List[astropy.io.fits.hdu.hdulist.HDUList], List[numpy.ndarray]][source]¶ Applies the model the model_inputs
If you are using the parallel functionality, then model must be pickleable.
Parameters: - model (Callable) – The model to apply to the inputs
- model_inputs (List[Union[np.ndarray, str]]) – The inputs to classify using the given model
- n_classes (int) – The number of classes that are output
- batch_size (int) – The number of examples to include in a batch
- window_shape (int) – The (height, width) of the samples to extract
- stride (Tuple[int, int]) – How many (rows, columns) to move through the image at each iteration.
- update_map (np.narray) – A 2D array of the same size as window height that indicates which pixels to use to updates for each example
- aggregate_method (str) – How to process the output from the model. If AGGREGATION_METHODS.MEAN_VAR record output using mean and variance, If AGGREGATION_METHODS.RANK_VOTE record output as the normalized vote count.
- out_dir (str) – The directory to save output files in if the model_inputs are string locations.
- gpus (List[int]) – The gpu ids to use for parallel processesing
- cpus (int) – The number of cpus to use for parllel processing
Returns: A 2-Tuple where the first element is the list of fits.HDULS for the outputfiles. The second element is a list of the output arrays from the model given the the input arrays.
Raises: - ValueError if model_inputs are not all of the same type
- ValueError if model_inputs are not str or np.ndarray
- ValueError if both gpus and cpus are given
- ValueError is cpus or gpus are given, but out_dir is not given
- ValueError if len(gpus)==1
- ValueError if cpus<2