|
|
--- |
|
|
tags: |
|
|
- object-detection |
|
|
- fashion |
|
|
- conditional-detr |
|
|
license: apache-2.0 |
|
|
datasets: |
|
|
- baselefre/new_embeddings_fixed_cats |
|
|
--- |
|
|
|
|
|
# Fashion Object Detection Model |
|
|
|
|
|
Fine-tuned Conditional DETR model for detecting 8 fashion categories: |
|
|
- bag |
|
|
- bottom |
|
|
- dress |
|
|
- hat |
|
|
- outer |
|
|
- shoes |
|
|
- top |
|
|
- accessory |
|
|
|
|
|
## Model Details |
|
|
- Base model: microsoft/conditional-detr-resnet-50 |
|
|
- Training dataset: baselefre/new_embeddings_fixed_cats |
|
|
- Checkpoint: 18000 steps |
|
|
|
|
|
## Usage |
|
|
|
|
|
```python |
|
|
from transformers import AutoImageProcessor, AutoModelForObjectDetection |
|
|
from PIL import Image |
|
|
import torch |
|
|
|
|
|
# Load model |
|
|
processor = AutoImageProcessor.from_pretrained("baselefre/objectdetectionaugmentedclean") |
|
|
model = AutoModelForObjectDetection.from_pretrained("baselefre/objectdetectionaugmentedclean") |
|
|
|
|
|
# Load image |
|
|
image = Image.open("your_image.jpg") |
|
|
|
|
|
# Inference |
|
|
inputs = processor(images=image, return_tensors="pt") |
|
|
outputs = model(**inputs) |
|
|
target_sizes = torch.tensor([image.size[::-1]]) |
|
|
results = processor.post_process_object_detection(outputs, threshold=0.5, target_sizes=target_sizes)[0] |
|
|
|
|
|
# Print detections |
|
|
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]): |
|
|
print(f"{model.config.id2label[label.item()]}: {score:.2f} at {box.tolist()}") |
|
|
``` |
|
|
|