vis4d.op.box.samplers
Init sampler module.
- class Sampler(batch_size, positive_fraction)[source]
Sampler base class.
- class CombinedSampler(*args, pos_strategy, neg_strategy, neg_pos_ub=3.0, floor_thr=-1.0, floor_fraction=0.0, num_bins=3, bg_label=0, **kwargs)[source]
Combined sampler. Can have different strategies for pos/neg samples.
- __init__(*args, pos_strategy, neg_strategy, neg_pos_ub=3.0, floor_thr=-1.0, floor_fraction=0.0, num_bins=3, bg_label=0, **kwargs)[source]
Creates an instance of the class.
- static instance_balanced_sampling(idx_tensor, assigned_gts, assigned_gt_ious, sample_size)[source]
Sample indices with balancing according to matched GT instance.
- Return type:
Tensor
- iou_balanced_sampling(idx_tensor, assigned_gts, assigned_gt_ious, sample_size)[source]
Sample indices with balancing according to IoU with matched GT.
- Return type:
Tensor
- class RandomSampler(*args, bg_label=0, **kwargs)[source]
Random sampler class.
- class PseudoSampler[source]
Pseudo sampler class (does nothing).
- class SamplingResult(sampled_box_indices: Tensor, sampled_target_indices: Tensor, sampled_labels: Tensor)[source]
Sampling result class. Stores expected result tensors.
sampled_box_indices (Tensor): Index of sampled boxes from input. sampled_target_indices (Tensor): Index of assigned target for each
positive sampled box.
sampled_labels (Tensor): {0, -1, 1} = {neg, ignore, pos}.
-
sampled_box_indices:
Tensor Alias for field number 0
-
sampled_target_indices:
Tensor Alias for field number 1
-
sampled_labels:
Tensor Alias for field number 2
-
sampled_box_indices:
- match_and_sample_proposals(matcher, sampler, proposal_boxes, target_boxes)[source]
Match proposals to targets and subsample.
First, match the proposals to targets (ground truth labels) using the matcher. It is usually IoU matcher. The matching labels the proposals with positive or negative to show whether they are matched to an object. Second, the sampler will choose proposals based on certain criteria such as total proposal number and ratio of postives and negatives.
- Return type:
tuple[list[Tensor],list[Tensor],list[Tensor]]
Modules
Interface for Vis4D bounding box samplers. |
|
Combined Sampler. |
|
Pseudo Sampler. |
|
Random Sampler. |