/ Модель

Характеристики

Библиотека
pytorch
Опубликована
18 авг 2026

faster_rcnn_resnet50

Поиск объектовИзображение → bounding_boxes

Реализация Faster R-CNN с ResNet-50 для обнаружения объектов 20 классов PASCAL VOC на изображениях.

0скачиваний за 30 дней0лайковвеса обновлены30 авг 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

0Curious0/faster_rcnn_resnet50 — реализация Faster R-CNN на PyTorch, обученная автором с нуля для обнаружения объектов на изображениях. Модель использует ResNet-50 с весами, предварительно обученными на ImageNet, и предназначена для детекции 20 классов объектов PASCAL VOC с выдачей ограничивающих рамок и оценок уверенности.

В обучении использованы объединённые обучающие наборы VOC2007 и VOC2012, а оценка проводилась на тестовой части VOC2007. Изображения масштабируются с сохранением пропорций: короткая сторона — 600 пикселей, длинная ограничена 1000 пикселями. Архитектура включает сеть предложений областей, RoI Pooling и классификационную голову Fast R-CNN; это RoIPool, а не RoIAlign. В README указано около 63% mAP, однако этот результат отражает совокупность отклонений от исходного протокола статьи.

Модель подходит для экспериментов и прикладной детекции объектов в сценариях, близких к PASCAL VOC. Ожидаемое качество ниже, чем у оригинальной конфигурации с ResNet-101: также не применялась горизонтальная аугментация, а размер пакета отличался от протокола статьи. Лицензия в предоставленных источниках не описана.

Сценарии применения

  • обнаружение объектов PASCAL VOC на фотографиях
  • поиск и локализация предметов на изображении рамками
  • эксперименты с Faster R-CNN и сетью предложений областей

Ограничения

В README отмечены ожидаемое снижение качества из-за ResNet-50 вместо ResNet-101 и отсутствия горизонтальной аугментации; указанный результат около 63% mAP отражает совокупность отклонений без контролируемых абляций. Карточка не сообщает лицензию.

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Faster R-CNN From Scratch (PyTorch)

A from-scratch PyTorch implementation of Faster R-CNN (Ren et al., 2015), aiming to closely — not exactly — reproduce paper-level results on Pascal VOC under real compute constraints.

Dataset

  • Training: VOC2007 trainval + VOC2012 trainval ("07+12" protocol), 5,011 + 11,540 = 16,551 images, read from each dataset's ImageSets/Main/trainval.txt (not Segmentation or Layout — an early bug in this project pointed at the wrong subfolder and silently shrank the dataset to ~1,446 images).
  • Evaluation: VOC2007 test. VOC2012 test is not used, since its ground truth requires official evaluation-server submission.

Backbone

  • ResNet-50 (deviation from the paper's ResNet-101, for compute reasons — expect a modest mAP gap as a known, accepted trade-off).

  • Initialized from ImageNet-pretrained weights.

Image Preprocessing

  • Resize so the shorter side = 600px, longer side capped at 1000px, aspect ratio preserved (matches the paper's protocol; an earlier fixed-224×224 resize was replaced after confirming this in the paper text).
  • Images are padded with max_dimensions in the batch to create a batch image tensor

Anchors

  • 9 anchors per grid location: 3 scales (128², 256², 512²) × 3 ratios (1:1, 1:2, 2:1).

Boundary handling (train vs. test)

  • Training: cross-boundary anchors are excluded entirely from the loss (not labeled positive/negative — ignored).
  • Testing: no exclusion; decoded proposals are clipped to the image boundary instead.

Anchor Labeling (IoU-based)

Convention used: positive = 1, negative = -1, ignore = 0.

  • Positive: (i) the anchor(s) with the highest IoU for a given GT box, OR (ii) any anchor with IoU > 0.7 with any GT box.
  • Negative: IoU < 0.3 with all GT boxes.
  • Ignore: neither of the above — excluded from the loss.
  • Condition (i) is applied last, so it can override a negative/ignore label.

RPN Loss

  • 256 anchors sampled per image, ~1:1 positive:negative ratio (padded with negatives if fewer than 128 positives are available).
  • Classification: cross-entropy over the sampled anchors (2-class: background/foreground).
  • Regression: Smooth L1 on (t_x, t_y, t_w, t_h) deltas, positive anchors only, normalized by positive count.
  • Combined: loss = cls_loss + λ * reg_loss, λ = 10.

Proposal Generation (decode → clip → filter → NMS → top-N)

  1. Decode anchors + predicted deltas → boxes
  2. Clip to image boundary (test-time; training excludes cross-boundary anchors upstream instead)
  3. Filter boxes smaller than 16px
  4. Select Pre-NMS-Top-N Boxes
  5. NMS, IoU threshold 0.7
  6. Keep Post-NMS-Top-N Boxes

RoI Pooling

  • RoIPool projects each proposal (corner format, absolute px) onto the shared feature map using stride = image_dim // feature_map_dim, then max-pools each projected region to a fixed 7×7 output — the original Fast R-CNN "RoI Pooling" (quantized max-pool over per-bin floor/ceil boundaries), not the later RoIAlign (Mask R-CNN's bilinear-interpolated variant).
  • Two implementations of the same operation: a manual "loop" mode (default) that computes each bin's boundaries explicitly (every bin covers ≥1 pixel even when a proposal is smaller than the output size), and an "adaptive" mode via nn.AdaptiveMaxPool2d.

Detection Head (Fast R-CNN)

  • Reuses conv5_x of an ImageNet-pretrained ResNet-50 as the region classifier — the shared backbone is split at conv4_x/conv5_x: conv4_x's output is the shared/RPN feature map, conv5_x becomes the per-RoI head. BatchNorm affine params are frozen and .train() is overridden to keep those BN layers in eval() mode (freezing requires_grad alone doesn't stop .train() from reactivating BN running-stat updates).
  • Global average pool over conv5_x's output, then two sibling nn.Linear heads:
    • Classification: num_classes + 1 logits (VOC's 20 object classes + 1 background class).
    • Regression: num_classes * 4 box deltas — class-specific, unlike the RPN's class-agnostic deltas.

Detection Loss

  • Classification: cross-entropy over the sampled proposals (21-way: 20 VOC classes + background).
  • Regression: Smooth L1, computed only on the positive proposals' predicted deltas for their own ground-truth class, gathered out of the class-specific [N, num_classes, 4] delta tensor — summed, then divided by the number of sampled proposals for that image (not just the positive count).
  • Regression targets are (t_x, t_y, t_w, t_h) deltas (same form as the RPN's), normalized by delta_std = (0.1, 0.1, 0.2, 0.2) — the Fast R-CNN paper's convention for zero-mean/unit-variance targets. Unlike the RPN's unnormalized deltas — any code decoding detection-head deltas back into boxes must multiply by delta_std first, or the decoded boxes come out silently near-zero-offset.
  • Combined: loss = cls_loss + λ * reg_loss, λ = 1 (Fast R-CNN's default balancing weight — unlike the RPN's λ = 10).

Detection Net (Inference Decode)

  • Wraps a trained DetectionHead for test-time use: given RegionProposalNetwork proposals and their RoIPool-ed features, runs the batched detection head once, then per image:
    1. Every (proposal, foreground class) pair whose softmax probability exceeds score_thresh (default 0.3) is emitted as a candidate — not just the argmax class. One proposal can therefore produce several detections, and a proposal whose highest-scoring class is background still contributes its foreground classes.
    2. Each candidate's box deltas for its own emitted class are gathered out of the class-specific delta tensor, un-normalized by delta_std, and decoded back to boxes with the same center-format inverse transform as the RPN's decoder.
    3. Boxes are clipped to the image's pre-padding size, then boxes that clipping collapsed to under min_box_size in either dimension are dropped.
    4. Per-class NMS (torchvision.ops.batched_nms, IoU nms_iou_thresh, default 0.3), then a top-max_detections_per_image cap by score (default 100).

Why argmax was replaced

The original decode kept only the argmax class per proposal and dropped the proposal when that was background. Measured on VOC2007 test, that emitted 16,819 detections against 14,976 GT boxes — 1.12 per object, where a standard Fast R-CNN emits 10–100× more — and capped mean recall at 0.613 while the RPN was supplying 80% proposal recall. Because 11-point AP scores p_interp(t) = 0 for every t above the achieved recall, mAP was pinned at 0.5389 against a ceiling of 0.6046 that the recall alone imposed; precision was already running at 89% of that ceiling. The loss was objects that never became detections at all, not objects ranked badly.

Per-class NMS (rather than class-agnostic) matters for the same metric: a person box must not suppress an overlapping horse box.

Training Protocol (4-Step Alternating Training, per the paper)

StepWhat's trainedBackbone
1RPN (backbone + RPN head, end-to-end)ImageNet-pretrained, fine-tuned
2Fast R-CNN detector, using Step-1 RPN's frozen proposals as fixed inputFresh ImageNet-pretrained, fine-tuned (separate from Step 1's)
3RPN again, backbone now frozen (shared, from Step 2)Frozen
4Fast R-CNN unique layers onlyFrozen

Step 1 hyperparameters (from the paper): SGD, momentum 0.9, weight decay 0.0005, lr 0.001 for the first ~60k mini-batches then 0.0001 for ~20k more (paper's batch-size-1 framing). This project's realized schedule: batch size 2 (a deliberate deviation for GPU throughput), 10 total epochs over 07+12 (~82,760 iterations) — 8 epochs at lr 0.001, 2 at lr 0.0001.

Results (VOC2007 test)

RPN Proposal Recall

IoU bandRecallGT boxes recalled
≥ 0.583.91%219 / 261
0.3 – 0.59.20%24 / 261
< 0.36.90%18 / 261

Detection Net (Fast R-CNN head)

score_threshnms_iou_threshmAP @ IoU 0.5
0.10.3~63% (best result; per-class AP not separately recorded for this config)
0.30.362.52% (full per-class breakdown below)

Per-class breakdown, score_thresh=0.3, nms_iou_thresh=0.3:

ClassAPrec[-1]AP_ceiln_detn_gtn_diff
aeroplane0.68380.73330.727389728526
bicycle0.69370.79530.727385233752
bird0.63640.72110.72731359459117
boat0.52170.65400.63641951263130
bottle0.22930.38380.36361934469188
bus0.79710.90140.909186921341
car0.67960.75020.727341721201340
cat0.80250.89660.818276435812
chair0.35600.63890.63647047756618
cow0.66920.76230.727380524485
diningtable0.64740.84470.818294120693
dog0.78920.88750.8182117148941
horse0.77780.83910.8182102234847
motorbike0.69660.78770.727389032544
person0.59160.68790.6364104854528699
pottedplant0.28500.47290.45453228480112
sheep0.56810.67360.636488024269
sofa0.69410.89120.81822019239157
train0.77280.86880.8182116328220
tvmonitor0.61190.77920.7273207130853

mAP @ IoU 0.5: 0.6252 — mean recall[-1]: 0.7485 — total detections: 44,520 — total GT (non-difficult): 12,032 — difficult GT excluded: 2,944.

Known Deviations From the Paper (Summary)

DeviationReasonExpected effect on mAP
ResNet-50 instead of ResNet-101Compute constraintWeaker features than ResNet-101, likely costing several mAP points — probably felt most on small/textured classes like bottle/pottedplant, this project's weakest. Not isolated by a ResNet-101 run.
Batch size 2 instead of 1GPU throughputPaper's lr schedule (per-image, batch size 1) reused unscaled, changing gradient noise per step. Not isolated.
No horizontal flip augmentationNot implementedPaper's VOC recipe uses flipping as a free 2× augmentation; skipping it likely costs some mAP, more on sparser classes. Not isolated.
BatchNorm frozen from Step 2 onwardBatch size 2 is too small for stable BN statistics — standard practice, not ad hocExpected neutral-to-beneficial vs. unfrozen (paper's VGG16 has no BN to compare against). Step 1 is the exception — its backbone trains with BN unfrozen.

None of these were isolated by a controlled ablation — the ~63% mAP reflects their combined effect, not any single deviation's contribution.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · pytorch

Нельзя запустить

В репозитории нет config.json: не понять архитектуру модели.

Ревизия весов
e25891d

0 моделей