|
|
--- |
|
|
tags: |
|
|
- object-detection |
|
|
- rf-detr |
|
|
- package-segmentation |
|
|
- computer-vision |
|
|
library_name: rfdetr |
|
|
license: apache-2.0 |
|
|
--- |
|
|
|
|
|
# RF-DETR Package Detection Model |
|
|
|
|
|
This model is a fine-tuned **RF-DETR Medium** model for package/box detection, trained on a custom dataset. |
|
|
|
|
|
## Model Description |
|
|
|
|
|
- **Model Type:** RF-DETR (Real-time DETR for object detection) |
|
|
- **Base Model:** RF-DETR Medium |
|
|
- **Task:** Object Detection (Package/Box Segmentation) |
|
|
- **Training Data:** Custom dataset |
|
|
- **Classes:** 2 class(es) |
|
|
|
|
|
## Training Details |
|
|
|
|
|
- **Epochs:** N/A |
|
|
- **Batch Size:** 16 |
|
|
- **Learning Rate:** 5e-05 |
|
|
- **Input Resolution:** 576x576 |
|
|
|
|
|
## Performance |
|
|
|
|
|
Training metrics available in the model repository. |
|
|
|
|
|
## Usage |
|
|
|
|
|
### Installation |
|
|
|
|
|
```bash |
|
|
pip install rfdetr torch torchvision |
|
|
``` |
|
|
|
|
|
### Loading the Model |
|
|
|
|
|
```python |
|
|
import torch |
|
|
from rfdetr import RFDETRMedium |
|
|
from PIL import Image |
|
|
|
|
|
# Load model |
|
|
model = RFDETRMedium() |
|
|
checkpoint = torch.load("checkpoint_best_total.pth", map_location='cpu') |
|
|
model.model.load_state_dict(checkpoint['model']) |
|
|
model.model.eval() |
|
|
|
|
|
# Run inference |
|
|
image = Image.open("path/to/image.jpg") |
|
|
results = model.predict(image) |
|
|
``` |
|
|
|
|
|
### API Usage (with Inference Endpoints) |
|
|
|
|
|
Once deployed as an Inference Endpoint: |
|
|
|
|
|
```python |
|
|
import requests |
|
|
from PIL import Image |
|
|
import io |
|
|
|
|
|
API_URL = "https://api-inference.huggingface.co/models/YOUR_USERNAME/rf-detr-box-segmentation" |
|
|
headers = {"Authorization": "Bearer YOUR_HF_TOKEN"} |
|
|
|
|
|
# Send image |
|
|
with open("image.jpg", "rb") as f: |
|
|
data = f.read() |
|
|
response = requests.post(API_URL, headers=headers, data=data) |
|
|
results = response.json() |
|
|
``` |
|
|
|
|
|
## Model Details |
|
|
|
|
|
- **Developed by:** Your Name |
|
|
- **Model date:** 1762288019.2803671 |
|
|
- **Framework:** PyTorch |
|
|
- **License:** Apache 2.0 |
|
|
|
|
|
## Citation |
|
|
|
|
|
```bibtex |
|
|
@software{rfdetr2024, |
|
|
title = {RF-DETR: Real-time DETR}, |
|
|
author = {Roboflow}, |
|
|
year = {2024}, |
|
|
url = {https://github.com/roboflow/rf-detr} |
|
|
} |
|
|
``` |
|
|
|
|
|
## Limitations |
|
|
|
|
|
This model is trained on a specific package detection dataset and may not generalize to all object detection tasks. |
|
|
|