facebookresearch/detectron2 · error · NotImplementedError
anchor_boundary_thresh is a legacy option not implemented fo
Error message
anchor_boundary_thresh is a legacy option not implemented for RRPN.
What it means
RRPN (Rotated RPN) does not support the legacy anchor_boundary_thresh option. The constructor explicitly rejects any non-negative value because clipping anchors to image boundaries was never ported to the rotated proposal generator.
Source
Thrown at detectron2/modeling/proposal_generator/rrpn.py:140
res = Instances(image_size)
res.proposal_boxes = boxes[keep]
res.objectness_logits = scores_per_img[keep]
results.append(res)
return results
@PROPOSAL_GENERATOR_REGISTRY.register()
class RRPN(RPN):
"""
Rotated Region Proposal Network described in :paper:`RRPN`.
"""
@configurable
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
if self.anchor_boundary_thresh >= 0:
raise NotImplementedError(
"anchor_boundary_thresh is a legacy option not implemented for RRPN."
)
@classmethod
def from_config(cls, cfg, input_shape: Dict[str, ShapeSpec]):
ret = super().from_config(cfg, input_shape)
ret["box2box_transform"] = Box2BoxTransformRotated(weights=cfg.MODEL.RPN.BBOX_REG_WEIGHTS)
return ret
@torch.no_grad()
def label_and_sample_anchors(self, anchors: List[RotatedBoxes], gt_instances: List[Instances]):
"""
Args:
anchors (list[RotatedBoxes]): anchors for each feature map.
gt_instances: the ground-truth instances for each image.
Returns:
list[Tensor]:View on GitHub (pinned to a2f4a8771a)
Solutions
- Set cfg.MODEL.RPN.BOUNDARY_THRESH = -1 to disable boundary clipping (the only supported value for RRPN)
- Remove the BOUNDARY_THRESH key from your config
- Use RPN instead of RRPN if boundary clipping is required
Example fix
# before cfg.MODEL.RPN.BOUNDARY_THRESH = 10 # after cfg.MODEL.RPN.BOUNDARY_THRESH = -1
Defensive patterns
Strategy: validation
Validate before calling
assert cfg.MODEL.RPN.BOUNDARY_THRESH == -1 or cfg.MODEL.PROPOSAL_GENERATOR.NAME != 'RRPN', 'RRPN requires BOUNDARY_THRESH = -1'
Prevention
- Validate proposal generator name against anchor options before build_model
- Keep rotated-detction configs separate from axis-aligned configs
When it happens
Trigger: Constructing an RRPN (e.g. via cfg.MODEL.PROPOSAL_GENERATOR.NAME = 'RRPN') with cfg.MODEL.RPN.BOUNDARY_THRESH >= 0, then building the model; __init__ raises immediately.
Common situations: Copying a config from a standard Detectron/Faster R-CNN setup that sets SOLVER/RPN.BOUNDARY_THRESH, or using rotated-box detection (RRPN) with an old config dump.
Related errors
- Class with @configurable must have a 'from_config' classmeth
- {name} must take 'cfg' as the first argument!
- total_batch_size and single_gpu_batch_size are mutually inco
- Unknown training sampler: {}
- bias_lr_factor requires base_lr
AI-assisted analysis of facebookresearch/detectron2@a2f4a8771a (2026-08-27).
Data as JSON: /api/errors/1108564a487e260a.
Report an issue: GitHub.