Skip to content

fix(model-builder-rel): bbox delta normalization uses (+2 more) - #40

Open
andrewwhitecdw wants to merge 1 commit into
NVIDIA:masterfrom
andrewwhitecdw:bugfix/model-builder-rel-assorted-08d7f9b4
Open

fix(model-builder-rel): bbox delta normalization uses (+2 more)#40
andrewwhitecdw wants to merge 1 commit into
NVIDIA:masterfrom
andrewwhitecdw:bugfix/model-builder-rel-assorted-08d7f9b4

Conversation

@andrewwhitecdw

@andrewwhitecdw andrewwhitecdw commented Jul 27, 2026

Copy link
Copy Markdown

This PR addresses 3 issues in lib/modeling_rel/model_builder_rel.py.

Fix 1

fix: bbox delta normalization uses ndarray.view with tensor shape

Fix: Replace:

            if cfg.TRAIN.BBOX_NORMALIZE_TARGETS_PRECOMPUTED:
                # (legacy) Optionally normalize targets by a precomputed mean and stdev
                box_deltas = box_deltas.view(-1, 4) * cfg.TRAIN.BBOX_NORMALIZE_STDS \
                             + cfg.TRAIN.BBOX_NORMALIZE_MEANS

with:

            if cfg.TRAIN.BBOX_NORMALIZE_TARGETS_PRECOMPUTED:
                # (legacy) Optionally normalize targets by a precomputed mean and stdev
                box_deltas = box_deltas.reshape(-1, 4) * cfg.TRAIN.BBOX_NORMALIZE_STDS \
                             + cfg.TRAIN.BBOX_NORMALIZE_MEANS

Fix 2

fix: DEDUP_BOXES branch references undefined inv_index

Fix: Replace:

        if cfg.DEDUP_BOXES > 0 and not cfg.MODEL.FASTER_RCNN:
            # Map scores and predictions back to the original set of boxes
            scores = scores[inv_index, :]
            pred_boxes = pred_boxes[inv_index, :]

with:

        if cfg.DEDUP_BOXES > 0 and not cfg.MODEL.FASTER_RCNN:
            raise NotImplementedError(
                'DEDUP_BOXES requires inv_index, which is not available here')

Fix 3

fix: prepare_det_rois uses training batch size at test time

Fix: Replace:

        for im_i in range(cfg.TRAIN.IMS_PER_BATCH):

with:

        for im_i in range(im_info.shape[0]):

Files changed

  • lib/modeling_rel/model_builder_rel.py

@andrewwhitecdw
andrewwhitecdw marked this pull request as ready for review July 27, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant