sleap.nn.data.inference#

Transformers for performing inference.

class sleap.nn.data.inference.GlobalPeakFinder(confmaps_key: str = 'predicted_instance_confidence_maps', confmaps_stride: int = 1, peak_threshold: float = 0.2, peaks_key: str = 'predicted_center_instance_points', peak_vals_key: str = 'predicted_center_instance_confidences', keep_confmaps: bool = True, device_name: str | None = None, integral: bool = True, integral_patch_size: int = 5)[source]#

Global peak finding transformer.

class sleap.nn.data.inference.KerasModelPredictor(keras_model: Model, model_input_keys: Any = 'instance_image', model_output_keys: Any = 'predicted_instance_confidence_maps', device_name: str | None = None)[source]#

Transformer for performing tf.keras model inference.

class sleap.nn.data.inference.LocalPeakFinder(confmaps_key: str = 'centroid_confidence_maps', confmaps_stride: int = 1, peak_threshold: float = 0.2, peaks_key: str = 'predicted_centroids', peak_vals_key: str = 'predicted_centroid_confidences', peak_sample_inds_key: str = 'predicted_centroid_sample_inds', peak_channel_inds_key: str = 'predicted_centroid_channel_inds', keep_confmaps: bool = True, device_name: str | None = None, integral: bool = True)[source]#

Local peak finding transformer.

class sleap.nn.data.inference.MockGlobalPeakFinder(all_peaks_in_key: str = 'instances', peaks_out_key: str = 'predicted_center_instance_points', peak_vals_key: str = 'predicted_center_instance_confidences', keep_confmaps: bool = True, confmaps_in_key: str = 'instance_confidence_maps', confmaps_out_key: str = 'predicted_instance_confidence_maps')[source]#

Transformer that mimics GlobalPeakFinder but passes ground truth data.

class sleap.nn.data.inference.PredictedCenterInstanceNormalizer(centroid_key: str = 'centroid', centroid_confidence_key: str = 'centroid_confidence', peaks_key: str = 'predicted_center_instance_points', peak_confidences_key: str = 'predicted_center_instance_confidences', new_centroid_key: str = 'predicted_centroid', new_centroid_confidence_key: str = 'predicted_centroid_confidence', new_peaks_key: str = 'predicted_instance', new_peak_confidences_key: str = 'predicted_instance_confidences')[source]#

Transformer for adjusting centered instance coordinates.

property input_keys: List[str]#

Return the keys that incoming elements are expected to have.

property output_keys: List[str]#

Return the keys that outgoing elements will have.

transform_dataset(input_ds: DatasetV2) DatasetV2[source]#

Create a dataset that contains instance cropped data.