Views
No views yet
n_points_scale, plus a refined training recipe (bag of freebies). The API matches v1; the weights are not interchangeable.PekingU/rtdetr_v2_r34vd for zeromodels. One implementation runs unmodified on TensorFlow / Torch / JAX.RTDETRV2Detect) on COCO (ResNet-34-vd).1import os
2os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
3
4from PIL import Image
5from zeromodels.models.rt_detr_v2 import (
6 RTDETRV2Detect,
7 RTDETRV2ImageProcessor,
8)
9
10model = RTDETRV2Detect.from_weights("zeromodels/rtdetr-v2-r34vd")
11processor = RTDETRV2ImageProcessor.from_weights("zeromodels/rtdetr-v2-r34vd")
12
13image = Image.open("your_image.jpg").convert("RGB")
14inputs = processor(image)
15output = model(inputs["pixel_values"], training=False)
16results = processor.post_process_object_detection(
17 output, threshold=0.5, target_sizes=[(image.height, image.width)]
18)[0]
19for score, name, box in zip(
20 results["scores"], results["label_names"], results["boxes"]
21):
22 print(f"{name}: {float(score):.3f} {box}")from_weights("zeromodels/<variant>"):| Variant | Hub | Backbone |
|---|---|---|
rtdetr-v2-r18vd | zeromodels/rtdetr-v2-r18vd | ResNet-18-vd |
rtdetr-v2-r34vd | zeromodels/rtdetr-v2-r34vd | ResNet-34-vd |
rtdetr-v2-r50vd | zeromodels/rtdetr-v2-r50vd | ResNet-50-vd |
rtdetr-v2-r101vd | zeromodels/rtdetr-v2-r101vd | ResNet-101-vd |
KERAS_BACKEND before importing Keras / zeromodels.RTDETRV2ImageProcessor keeps do_normalize=False by default (rescaled [0, 1] input, matching upstream).hf: prefix, e.g. RTDETRV2Detect.from_weights("hf:PekingU/rtdetr_v2_r34vd").