Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 985 Bytes

predictions.md

File metadata and controls

23 lines (16 loc) · 985 Bytes

Make predictions with the pre-trained base model

In order to make predictions with the base model on your own data, you can either load the model through torch hub:

import torch
trainedModel = torch.hub.load("chfc-cmi", "cmr_seg_base")

or download the model file from the releases page and load it with fastai:

from fastai.vision.all import load_learner
trainedModel = load_learner("resnet34_5percent_size256_extremeTfms_ceLoss_fastai2.pkl")

The trainedModel can directly be used to make predictions on an image file (or images loaded in python):

pred = trainedModel.predict("path/to/image.png")

⚠️ The input image is resized (with zero padding) to 256x256 before prediction, thus the resulting mask is 256x256, as well. For more details about the predict function and it's return values, see the fastai documentation.