Skip to content

fix: OTA target scaling uses height for both dimensions#2147

Open
Mr-Neutr0n wants to merge 1 commit into
WongKinYiu:mainfrom
Mr-Neutr0n:fix/ota-target-scaling-dimensions
Open

fix: OTA target scaling uses height for both dimensions#2147
Mr-Neutr0n wants to merge 1 commit into
WongKinYiu:mainfrom
Mr-Neutr0n:fix/ota-target-scaling-dimensions

Conversation

@Mr-Neutr0n

Copy link
Copy Markdown

Bug

OTA target coordinate normalization uses the height dimension for both x and y scaling. The x coordinate should be normalized by width and y by height.

Fix

Corrected the scaling to use the appropriate dimension for each coordinate.

In utils/loss.py, the target xywh coordinates are converted from normalized [0,1] space to pixel space. The original code multiplies all four values (x, y, w, h) by imgs[batch_idx].shape[1] (height), but x and w should use shape[2] (width) instead. This affects ComputeLossOTA, ComputeLossBinOTA, and ComputeLossAuxOTA.

The fix changes the scalar multiplication to a per-coordinate tensor [W, H, W, H] so that x/w scale by width and y/h scale by height.

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