transformers - 💡(How to fix) Fix Qwen3-VL: Halucination/Error with 2D bounding box output [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
huggingface/transformers#44393Fetched 2026-04-08 00:28:47
View on GitHub
Comments
2
Participants
2
Timeline
6
Reactions
0
Timeline (top)
commented ×2closed ×1labeled ×1mentioned ×1

Fix Action

Fix / Workaround

Detecting 2D bounding boxes does not work if inputting images with an aspect ratio similar to KITTI (3.3:1), as the model defaults to 3D bounding boxes. This can be fixed by changing the aspect ratio to a size similar during 2D training and the rescaling the output bounding boxes.

RAW_BUFFERClick to expand / collapse

System Info

Not quite sure if this is the proper place, but could in theory be handled via preprocessing. This issue is more as a type of documentation in case other face this in the future.

Detecting 2D bounding boxes does not work if inputting images with an aspect ratio similar to KITTI (3.3:1), as the model defaults to 3D bounding boxes. This can be fixed by changing the aspect ratio to a size similar during 2D training and the rescaling the output bounding boxes.

Who can help?

No response

Information

  • The official example scripts
  • My own modified scripts

Tasks

  • An officially supported task in the examples folder (such as GLUE/SQuAD, ...)
  • My own task or dataset (give details below)

Reproduction

Ask Qwen3 to detect 2D Boxes in KITTI images

Expected behavior

JSON output with 9 values per box (3D bbox)

extent analysis

Fix Plan

Aspect Ratio Adjustment

To fix the issue, we need to adjust the aspect ratio of the input images during 2D training and rescale the output bounding boxes.

Steps

  1. Update Training Configuration
    • Change the aspect ratio in the training configuration file (e.g., config.yaml) to match the aspect ratio of the KITTI images (3.3:1).
    • Example:

aspect_ratio: 3.3

2. **Update Model Architecture**
   - Modify the model architecture to output 2D bounding boxes instead of 3D bounding boxes.
   - Example (assuming a PyTorch model):
     ```python
class TwoDBoxDetector(nn.Module):
    def forward(self, x):
        # ... (rest of the model architecture)
        boxes_2d = self.output_layer(x)
        return boxes_2d
  1. Rescale Output Bounding Boxes
    • Add a post-processing step to rescale the output bounding boxes based on the aspect ratio.
    • Example:

def rescale_boxes(boxes, aspect_ratio): # ... (calculate the rescaled box coordinates) return rescaled_boxes

4. **Update Detection Script**
   - Modify the detection script to use the updated model architecture and rescale the output bounding boxes.
   - Example:
     ```python
detector = TwoDBoxDetector()
boxes = detector(image)
rescaled_boxes = rescale_boxes(boxes, aspect_ratio)

Verification

  • Run the detection script on KITTI images and verify that the output JSON contains 9 values per box (3D bbox) is not present.
  • Check that the output bounding boxes are correctly rescaled to match the aspect ratio of the input images.

Extra Tips

  • Make sure to update the model architecture and detection script to handle the new aspect ratio.
  • Test the

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

JSON output with 9 values per box (3D bbox)

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING