Skip to content

votenet

VoteNet detection loss: deep Hough voting target assignment and multi-task objective.

Classes:

  • VoteNetLoss –

    Loss of VoteNetDetection (vote, objectness, box, semantic).

VoteNetLoss [source] ΒΆ

VoteNetLoss(
    num_classes: int,
    *,
    num_heading_bins: int,
    num_size_clusters: int,
    mean_sizes: Union[Tensor, List[List[float]]],
    near_threshold: float = 0.3,
    far_threshold: float = 0.6,
    objectness_weights: Tuple[float, float] = (0.2, 0.8),
    gt_vote_factor: int = 3,
    loss_weight: float = 10.0,
)

Bases: Module

Loss of VoteNetDetection (vote, objectness, box, semantic).

Reference: Deep Hough Voting for 3D Object Detection in Point Clouds (Qi et al., 2019).

Every target is assigned inside the loss from the packed ground-truth boxes:

  • Vote: each seed point inside a box votes for its center. A seed collects the centers of the first gt_vote_factor boxes containing it (repeating the first when inside fewer), and the smooth-\(L_1\) distance of its closest predicted vote to its closest target vote is averaged over the seeds inside a box.
  • Objectness: proposals are matched to objects by nearest center. A proposal is positive when its nearest center is within near_threshold, negative beyond far_threshold, and ignored in the band between; a weighted two-way cross-entropy supervises the objectness logits.
  • Box and semantic: positives drive the center (symmetric Chamfer between proposal and object centers), heading (bin cross-entropy + normalized residual smooth-\(L_1\)), size (class cross-entropy + normalized residual smooth-\(L_1\)) and semantic-class terms, each averaged over the positives.

The library heading is counter-clockwise about \(+z\) while the heading head predicts the negated angle, so the heading bins are computed from \(-\theta\). Scenes are padded to a common object count with zero centers that take part in the proposal-to-object matching.

Parameters:

  • num_classes (int) –

    Number of semantic classes.

  • num_heading_bins (int) –

    Number of heading-angle bins (\(1\) for axis-aligned ScanNet, \(12\) for SUN RGB-D).

  • num_size_clusters (int) –

    Number of size templates (the size class is the semantic class).

  • mean_sizes (Union[Tensor, List[List[float]]]) –

    Per-template mean box size, shape \((\text{num\_size\_clusters}, 3)\).

  • near_threshold (float, default: 0.3 ) –

    Distance (meters) below which a proposal is a positive object match.

  • far_threshold (float, default: 0.6 ) –

    Distance (meters) above which a proposal is a negative match.

  • objectness_weights (Tuple[float, float], default: (0.2, 0.8) ) –

    Cross-entropy class weights \([\text{negative}, \text{positive}]\).

  • gt_vote_factor (int, default: 3 ) –

    Number of target votes (containing-box centers) collected per seed.

  • loss_weight (float, default: 10.0 ) –

    Global multiplier applied to the summed loss.

Methods:

  • forward –

    Compute the VoteNet loss and its terms.

forward [source] ΒΆ

forward(
    output: VoteNetOutput, data: Dict[str, Any]
) -> Dict[str, Tensor]

Compute the VoteNet loss and its terms.

Parameters:

  • output (VoteNetOutput) –

    The model's raw output: dense head tensors (objectness_scores, center, heading_scores, heading_residuals_normalized, size_scores, size_residuals_normalized, sem_cls_scores, pos_vote_aggr) as \((B, K, \cdot)\), plus the packed seeds pos_seed \((S, 3)\), batch_seed \((S,)\) and their votes pos_vote \((S \cdot \text{vote\_factor}, 3)\).

  • data (Dict[str, Any]) –

    Packed ground truth: DataKeys.BOX \((K, 7)\) full-extent boxes with counter-clockwise headings, DataKeys.LABEL \((K,)\) per-box classes and DataKeys.BATCH_BOX \((K,)\) per-box scene index.

Returns:

  • Dict[str, Tensor] –

    A dict with the scalar loss and detached vote_loss, objectness_loss, box_loss,

  • Dict[str, Tensor] –

    center_loss, heading_cls_loss, heading_res_loss, size_cls_loss, size_res_loss,

  • Dict[str, Tensor] –

    sem_cls_loss and the obj_acc diagnostic.