Commit 0df47bf
fix(yolo detector): accept tensor batches from antenna REST dataloader
The Mothbot YOLO detector's predict_batch strictly required list[PIL.Image],
which works for the API/ml-layer path but fails for the antenna worker
path. The antenna RESTDataset applies torchvision.transforms.ToTensor()
to images before they reach the detector, producing tensor batches that
the original check rejected with:
Mothbot YOLO11m Creature Detector expects a list of PIL images from
the collate fn; got <class 'torch.Tensor'>
FasterRCNN's detection path already accepts both, which is why this only
surfaced when wiring a YOLO-based pipeline into the worker.
Accept three input forms now:
- list[PIL.Image] (ML-layer dataloader, unchanged)
- torch.Tensor (B, C, H, W) from REST stacked batches
- list[torch.Tensor] (C, H, W) from REST mixed-size fallback
For tensor inputs, convert back to HWC uint8 numpy so ultralytics does
its own letterboxing / normalization at imgsz=1600, matching the PIL
path's behavior.
Discovered running job 1493 through the beast Antenna worker.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 9f2b5f9 commit 0df47bf
1 file changed
Lines changed: 22 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
515 | 515 | | |
516 | 516 | | |
517 | 517 | | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
524 | 539 | | |
525 | | - | |
| 540 | + | |
526 | 541 | | |
527 | 542 | | |
528 | 543 | | |
| |||
0 commit comments