Generate n random boxes with y1<=y2, x1<=x2 using the given RNG.
(rng, n)
| 2434 | |
| 2435 | |
| 2436 | def _make_valid_boxes(rng, n): |
| 2437 | """Generate n random boxes with y1<=y2, x1<=x2 using the given RNG.""" |
| 2438 | raw = rng.random((n, 4), dtype=np.float32) |
| 2439 | return np.stack( |
| 2440 | [ |
| 2441 | np.minimum(raw[:, 0], raw[:, 2]), # y1 |
| 2442 | np.minimum(raw[:, 1], raw[:, 3]), # x1 |
| 2443 | np.maximum(raw[:, 0], raw[:, 2]), # y2 |
| 2444 | np.maximum(raw[:, 1], raw[:, 3]), # x2 |
| 2445 | ], |
| 2446 | axis=1, |
| 2447 | ).astype(np.float32) |
| 2448 | |
| 2449 | |
| 2450 | _NMS_V5_CASES = [ |
no test coverage detected
searching dependent graphs…