Predictions¶
-
src.actions.prediction.get_workaround_details(compilation_dict)[source]¶ Creates a model using the saved compliation dict from training the TF model.
- Parameters
compilation_dict (
Dict) – the compilation dict with the details to recreate the tensorflow model- Returns
a TF model, a TF loss, a TF optimiser, and TF metrics
Note
This workaround is used since normal model saving for TF subclassed models did not work at the time of writing.
-
src.actions.prediction.predict_tensorflow(lseq_list, model_weight_path, leaf_shape, cr_csv_list='', mseq_list=None, threshold=0.5, format_dict=None)[source]¶ Makes predictions for the images in each LeafSequence in the list of leaf sequences. The predictions are saved using a default path. If classification report csv save paths are provided, classification reports are generated and saved.
- Parameters
lseq_list (
List[LeafSequence]) – a list of LeafSequence to make predictions formodel_weight_path (
str) – the path to saved tf model to use to make predictionsleaf_shape (
Tuple[int,int]) – the shape of leaf used when training the saved modelcr_csv_list (
List[str]) – file paths of where the classification reports should be saved; if this is provided, it must be the same length as the lseq_listmseq_list (
Optional[List[MaskSequence]]) – the list of mseqs to use when generating the classification report, this must be provided if cr_csv_list is provided, and it must be the same length as lseq_listthreshold (
float) – the threshold to use when saving predictions; i.e. a pixel is saved as an embolism if p(embolism) > thresholdformat_dict (
Optional[Dict]) – the format to use when loading the LeafSequence Leaf images; these images are used as inputs for the predictions
- Return type
None- Returns
None