(pt, bbox, resH, resW)
| 241 | |
| 242 | |
| 243 | def transformBoxInvert(pt, bbox, resH, resW): |
| 244 | center = torch.zeros(2) |
| 245 | center[0] = (bbox[2] - 1 - bbox[0]) / 2 |
| 246 | center[1] = (bbox[3] - 1 - bbox[1]) / 2 |
| 247 | |
| 248 | lenH = max(bbox[3] - bbox[1], (bbox[2] - bbox[0]) * resH / resW) |
| 249 | lenW = lenH * resW / resH |
| 250 | |
| 251 | _pt = (pt * lenH) / resH |
| 252 | |
| 253 | if bool(((lenW - 1) / 2 - center[0]) > 0): |
| 254 | _pt[0] = _pt[0] - ((lenW - 1) / 2 - center[0]).item() |
| 255 | if bool(((lenH - 1) / 2 - center[1]) > 0): |
| 256 | _pt[1] = _pt[1] - ((lenH - 1) / 2 - center[1]).item() |
| 257 | |
| 258 | new_point = torch.zeros(2) |
| 259 | new_point[0] = _pt[0] + bbox[0] |
| 260 | new_point[1] = _pt[1] + bbox[1] |
| 261 | return new_point |
| 262 | |
| 263 | |
| 264 | def _box_to_center_scale(x, y, w, h, aspect_ratio=1.0, scale_mult=1.25): |
nothing calls this directly
no outgoing calls
no test coverage detected