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_factorboxes 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 beyondfar_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 seedspos_seed\((S, 3)\),batch_seed\((S,)\) and their votespos_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 andDataKeys.BATCH_BOX\((K,)\) per-box scene index.
Returns:
-
Dict[str, Tensor]βA dict with the scalar
lossand detachedvote_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_lossand theobj_accdiagnostic.