monailabel.interfaces.app module¶
- class monailabel.interfaces.app.MONAILabelApp(app_dir, studies, conf, name='', description='', version='2.0', labels=None)[source]¶
Bases:
object
Default Pre-trained Path for downloading models
Base Class for Any MONAI Label App
- Parameters
app_dir (
str
) – path for your App directorystudies (
str
) – path for studies/datalistconf (
Dict
[str
,str
]) – dictionary of key/value pairs provided by user while running the app
- PRE_TRAINED_PATH: str = 'https://github.com/Project-MONAI/MONAILabel/releases/download/data'¶
- __init__(app_dir, studies, conf, name='', description='', version='2.0', labels=None)[source]¶
Base Class for Any MONAI Label App
- Parameters
app_dir (
str
) – path for your App directorystudies (
str
) – path for studies/datalistconf (
Dict
[str
,str
]) – dictionary of key/value pairs provided by user while running the app
- batch_infer(request, datastore=None)[source]¶
Run batch inference for an existing pre-trained model.
- Parameters
request – JSON object which contains model, params and device
datastore –
Datastore object. If None then use default app level datastore to fetch the images
For example:
{ "device": "cuda" "model": "segmentation_spleen", "images": "unlabeled", "label_tag": "original" }
- Raises
MONAILabelException – When
model
is not found- Returns
JSON containing label and params
- infer(request, datastore=None)[source]¶
Run Inference for an exiting pre-trained model.
- Parameters
request – JSON object which contains model, image, params and device
datastore –
Datastore object. If None then use default app level datastore to save labels if applicable
For example:
{ "device": "cuda" "model": "segmentation_spleen", "image": "file://xyz", "save_label": "true/false", "label_tag": "original" }
- Raises
MONAILabelException – When
model
is not found- Returns
JSON containing label and params
- init_scoring_methods()[source]¶
- Return type
Dict
[str
,ScoringMethod
]
- next_sample(request)[source]¶
Run Active Learning selection. User APP has to implement this method to provide next sample for labelling.
- Parameters
request –
JSON object which contains active learning configs that are part APP info
For example:
{ "strategy": "random" }
- Returns
JSON containing next image info that is selected for labeling
- on_save_label(image_id, label_id)[source]¶
Callback method when label is saved into datastore by a remote client
- scoring(request, datastore=None)[source]¶
Run scoring task over labels.
- Parameters
request – JSON object which contains model, params and device
datastore –
Datastore object. If None then use default app level datastore to fetch the images
For example:
{ "device": "cuda" "method": "dice", "y": "final", "y_pred": "original", }
- Raises
MONAILabelException – When
method
is not found- Returns
JSON containing result of scoring method