{"library":"rfdetr","title":"RF-DETR","description":"RF-DETR is a PyTorch-based library for object detection and instance segmentation, implementing the DETR architecture with enhancements. It provides tools for training, inference, and deployment, integrating with PyTorch Lightning for composable training workflows. The library is actively maintained, with version 1.6.4 released recently, and receives frequent updates.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install rfdetr","pip install \"rfdetr[train]\""],"cli":null},"imports":["from rfdetr import RFDETRSmall","from rfdetr import RFDETRBase","from rfdetr import RFDETRLarge","from rfdetr.data import DetectionDataset"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import supervision as sv\nfrom rfdetr import RFDETRSmall\n\n# Initialize model with pre-trained weights. Use \"rfdetr-small\" for the default.\n# For a custom fine-tuned model: pretrain_weights=\"path/to/your/model.pth\"\nmodel = RFDETRSmall(pretrain_weights=\"rfdetr-small\")\n\n# Example image URL for prediction\nimage_url = \"https://media.roboflow.com/dog.jpg\"\n\n# Perform inference with a confidence threshold\ndetections = model.predict(image_url, threshold=0.5)\n\nprint(f\"Detected {len(detections)} objects.\")\n\n# Access new data points introduced in recent versions:\nif \"class_name\" in detections.data:\n    print(f\"Class names: {detections.data['class_name']}\")\nif \"source_image\" in detections.data:\n    print(f\"Source image shape: {detections.data['source_shape']}\")\n\n# Visualize results (requires 'supervision' to be installed)\n# image_bgr = detections.data.get(\"source_image\")\n# if image_bgr is not None:\n#     box_annotator = sv.BoxAnnotator()\n#     annotated_image = box_annotator.annotate(scene=image_bgr.copy(), detections=detections)\n#     sv.plot_image(annotated_image, size=(8, 8))\n","lang":"python","description":"This quickstart demonstrates how to load a pre-trained RF-DETR model, perform inference on an image URL, and inspect the returned detections object. It highlights recently added data fields like class names and source image/shape, which are useful for post-processing and visualization with libraries like `supervision`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}