[detection] Faster R-CNN accepts negative box_detections_per_img and applies Python slicing
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Ambito
- computer-vision, machine-learning
Direzione di ricerca
Inizia dall’implementazione del rilevamento Faster R-CNN di TorchVision e segui come box_detections_per_img viene applicato agli indici successivi a NMS; l’issue individua il comportamento dello slicing negativo, ma non indica alcun file o test. Controlla i test di rilevamento esistenti ed esegui un test mirato per i limiti negativi. Il lavoro è completato quando il comportamento previsto dal progetto è esplicito e i valori negativi funzionano come previsto oppure generano un ValueError chiaro.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
🐛 Describe the bug
The Faster R-CNN factory accepts a negative box_detections_per_img. On the tested build, the value is applied as a Python negative slice to the post-NMS detection indices. For example, with 46 baseline detections, -1 returns 45 and -2 returns 44. This is surprising for a parameter documented as the maximum number of detections per image.
Could the project clarify whether negative values are intended to be supported? If not, would it be preferable to reject them with a ValueError instead of silently dropping the final detections?
Minimal reproducer
import torch
import torchvision
from torchvision.models.detection import fasterrcnn_mobilenet_v3_large_320_fpn
print("torch:", torch.__version__)
print("torchvision:", torchvision.__version__)
image = torch.linspace(0, 1, 3 * 64 * 64).reshape(3, 64, 64)
with torch.no_grad():
for limit in (100, -1, -2, 0):
torch.manual_seed(109150)
model = fasterrcnn_mobilenet_v3_large_320_fpn(
weights=None,
weights_backbone=None,
num_classes=2,
box_score_thresh=0.0,
box_nms_thresh=1.0,
box_detections_per_img=limit,
min_size=64,
max_size=64,
).eval()
result = model([image])[0]
print(limit, len(result["scores"]))
On the reported CPU configuration, output counts were 100 -> 46, -1 -> 45, -2 -> 44, and 0 -> 0. Same-model comparisons found the negative-limit boxes, scores, and labels equal to Python slices of the positive-limit result.
Expected behavior
Please clarify the intended behavior for negative values. If they are invalid, rejecting them explicitly would avoid silently interpreting a configuration error as Python slicing.
### Versions
### Environment
- Linux x86_64, Python 3.12.7, PyTorch 2.14.1+cpu, TorchVision 0.29.1+cpu.
- Also reproduced on PyTorch 2.5.1+cpu / TorchVision 0.20.1+cpu and PyTorch 2.10.0+cu128 / TorchVision 0.25.0+cu128; the CUDA build was tested with CPU input.
- Randomly initialized model; no checkpoint download required.
- Lingua principale
- Python
- Stelle
- 18k
- Fork
- 7.3k
- Merge medio
- 4h 56m
- PR unite (30g)
- 9
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di pytorch/vision
-
sigmoid_focal_loss gives NaN gradients for confident predictions when gamma < 1Forse già presa @yuvraj-del l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pytorch/vision#9743 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
vision_stable.cpp gets hipified into a duplicate copy under ROCm, causing "multiple definition of vision::cuda_version()"Forse già presa Una pull request collegata a questa issue è aperta o già unita. Apertamodule: rocm
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Clip samplers crash on iteration when no video clips are availableForse già presa @raunakpandey1 l’ha presa 13 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
complete_box_iou_loss / complete_box_iou: NaN gradients for zero-height boxes, NaN for point boxesForse già presa @aounullah l’ha presa 5 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
pytorch/vision#9730 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
sanitize_bounding_boxes computes the wrong height for rotated boxesForse già presa @u7k4rs6 l’ha presa 46 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di pytorch/vision
Issue simili
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
Install the skills as a Claude Code pluginForse già presa @ruban-24 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 6 giorni
-
Make the usage of time-zone aware UTC timestamps the norm across the pynxtools NOMAD ecosystemAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
FAIRmat-NFDI/pynxtools#874 ·
-
Eval: PublicationApertadata
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
huggingface/kernels#1006 ·
I maintainer di solito rispondono entro 1 giorno