deepdisc.inference.predictors
Classes
Create a simple end-to-end predictor with the given config that runs on |
Functions
|
Returns indices for matched pairs of ground truth and detected objects in an image |
|
Returns indices for matched pairs of ground truth and detected objects in an image |
Module Contents
- class AstroPredictor(cfg, lazy=False, cfglazy=None, checkpoint=None)[source]
Create a simple end-to-end predictor with the given config that runs on single device for a single input image. Compared to using the model directly, this class does the following additions: 1. Load checkpoint from cfg.MODEL.WEIGHTS. 2. Always take BGR image as the input and apply conversion defined by cfg.INPUT.FORMAT. 3. Apply resizing defined by cfg.INPUT.{MIN,MAX}_SIZE_TEST. 4. Take one input image and produce a single output, instead of a batch. This is meant for simple demo purposes, so it does the above steps automatically. This is not meant for benchmarks or running complicated inference logic. If you’d like to do anything more complicated, please refer to its source code as examples to build and use the model manually. .. attribute:: metadata
the metadata of the underlying dataset, obtained from cfg.DATASETS.TEST.
- type:
Metadata
Examples:
pred = DefaultPredictor(cfg) inputs = cv2.imread("input.jpg") outputs = pred(inputs)
- get_predictions(dataset_dict, imreader, key_mapper, predictor)[source]
Returns indices for matched pairs of ground truth and detected objects in an image
- Parameters:
dataset_dict (dictionary) – The dictionary metadata for a single image
imreader (ImageReader object) – An object derived from ImageReader base class to read the images.
key_mapper (function) – The key_mapper should take a dataset_dict as input and return the key used by imreader
predictor (AstroPredictor) – The predictor object used to make predictions on the test set
- Returns:
matched_gts (list(int)) – The indices of matched objects in the ground truth list
matched_dts (list(int)) – The indices of matched objects in the detections list
outputs (list(Intances)) – The list of detected object Instances
- get_predictions_new(dataset_dict, predictor)[source]
Returns indices for matched pairs of ground truth and detected objects in an image
- Parameters:
dataset_dict (dictionary) – The dictionary metadata for a single image
predictor (AstroPredictor) – The predictor object used to make predictions on the test set
- Returns:
outputs – The list of detected object Instances
- Return type:
list(Intances)