vis4d.op.box.samplers.base

Interface for Vis4D bounding box samplers.

Functions

match_and_sample_proposals(matcher, sampler, ...)

Match proposals to targets and subsample.

Classes

Sampler(batch_size, positive_fraction)

Sampler base class.

SamplingResult(sampled_box_indices, ...)

Sampling result class.

class Sampler(batch_size, positive_fraction)[source]

Sampler base class.

Creates an instance of the class.

__call__(matching)[source]

Type declaration.

Return type:

SamplingResult

abstract forward(matching)[source]

Sample bounding boxes according to their struct.

Return type:

SamplingResult

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}.

Create new instance of SamplingResult(sampled_box_indices, sampled_target_indices, sampled_labels)

sampled_box_indices: Tensor

Alias for field number 0

sampled_labels: Tensor

Alias for field number 2

sampled_target_indices: Tensor

Alias for field number 1

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]]