torchsig.models.spectrogram_models.detr.criterion.get_uncertain_point_coords_with_randomness¶
- torchsig.models.spectrogram_models.detr.criterion.get_uncertain_point_coords_with_randomness(coarse_logits, uncertainty_func, num_points, oversample_ratio, importance_sample_ratio)[source]¶
- Sample points in [0, 1] x [0, 1] coordinate space based on their uncertainty. The unceratinties
are calculated for each point using ‘uncertainty_func’ function that takes point’s logit prediction as input.
See PointRend paper for details. :param coarse_logits: A tensor of shape (N, C, Hmask, Wmask) or (N, 1, Hmask, Wmask) for
class-specific or class-agnostic prediction.
- Parameters:
uncertainty_func – A function that takes a Tensor of shape (N, C, P) or (N, 1, P) that contains logit predictions for P points and returns their uncertainties as a Tensor of shape (N, 1, P).
num_points (int) – The number of points P to sample.
oversample_ratio (int) – Oversampling parameter.
importance_sample_ratio (float) – Ratio of points that are sampled via importnace sampling.
- Returns:
- A tensor of shape (N, P, 2) that contains the coordinates of P
sampled points.
- Return type:
point_coords (Tensor)