semsegpredictionhandler
semsegpredictionhandler ¶
module for semseg prediction handlers
Classes¶
SemSegBBoxPredictionHandler ¶
SemSegBBoxPredictionHandler(
instance_finder,
prediction_prefix="pred",
pred_identifier="image_filepath",
detection_idx_col=DETECTION_INDEX_COLUMN_NAME,
)
Bases: PredictionHandler
Prediction handler to convert a tensor to bounding box information corresponding
to ObjDetPredictionHandler based on found instances in a prediction mask.
Initialize SemSegBBoxPredictionHandler. Takes a list of arguments, which are passed to it when an object of this type is created.
Parameters:
-
instance_finder(InstanceFinder) –InstanceFinder for prediction identification
-
prediction_prefix(str, default:'pred') –Prefix the column names of the predictions
-
pred_identifier(str, default:'image_filepath') –Specify the column name of the image filepaths
-
detection_idx_col(str, default:DETECTION_INDEX_COLUMN_NAME) –Specify the name of the column in which detection indices are stored
Source code in niceml/mlcomponents/predictionhandlers/semsegpredictionhandler.py
Functions¶
__enter__ ¶
Enter SemSegBBoxPredictionHandler
Source code in niceml/mlcomponents/predictionhandlers/semsegpredictionhandler.py
__exit__ ¶
Save the data in self.data as a parquet file
Source code in niceml/mlcomponents/predictionhandlers/semsegpredictionhandler.py
add_prediction ¶
After each prediction, this is processed to find instances in a mask and create bounding box coordinates from the found instances
Source code in niceml/mlcomponents/predictionhandlers/semsegpredictionhandler.py
set_params ¶
The set_params function is called by the ExperimentContext object when it is time to set up a new experiment.
Parameters:
-
exp_context(ExperimentContext) –experiment context to pass to the instance finder
-
filename(str) –Specifies the name of the dataset
-
data_description(DataDescription) –Stores the data description of the dataset
Source code in niceml/mlcomponents/predictionhandlers/semsegpredictionhandler.py
SemSegMaskPredictionHandler ¶
Bases: PredictionHandler
Prediction handler to convert a tensor to channel images for SemSeg
This prediction handler converts a tensor to the maximum prediction image
Parameters:
-
img_extension(str, default:'.png') –Type of the images to write
-
prediction_suffix(str, default:'_pred') –Suffix for prediction columns
Source code in niceml/mlcomponents/predictionhandlers/semsegpredictionhandler.py
Functions¶
__enter__ ¶
__exit__ ¶
add_prediction ¶
After each prediction this is processed to store the images.
Source code in niceml/mlcomponents/predictionhandlers/semsegpredictionhandler.py
Functions¶
create_bbox_prediction_from_mask_instances ¶
Creates a prepared list of bounding box prediction information based on the result of a semantic segmentation Args: prediction: raw prediction data with the shape (image_width, image_height, channel_count) mask_instances: found instances of a mask
Returns:
-
List[Tuple[int, List[float]]]–List of Tuples (detection_index, list of prediction data
-
List[Tuple[int, List[float]]]–(bbox coordinates and prediction scores of each output channel))