Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- object-detection
|
| 4 |
+
- fashion
|
| 5 |
+
- conditional-detr
|
| 6 |
+
license: apache-2.0
|
| 7 |
+
datasets:
|
| 8 |
+
- baselefre/new_embeddings_fixed_cats
|
| 9 |
+
---
|
| 10 |
+
|
| 11 |
+
# Fashion Object Detection Model
|
| 12 |
+
|
| 13 |
+
Fine-tuned Conditional DETR model for detecting 8 fashion categories:
|
| 14 |
+
- bag
|
| 15 |
+
- bottom
|
| 16 |
+
- dress
|
| 17 |
+
- hat
|
| 18 |
+
- outer
|
| 19 |
+
- shoes
|
| 20 |
+
- top
|
| 21 |
+
- accessory
|
| 22 |
+
|
| 23 |
+
## Model Details
|
| 24 |
+
- Base model: microsoft/conditional-detr-resnet-50
|
| 25 |
+
- Training dataset: baselefre/new_embeddings_fixed_cats
|
| 26 |
+
- Checkpoint: 18000 steps
|
| 27 |
+
|
| 28 |
+
## Usage
|
| 29 |
+
|
| 30 |
+
```python
|
| 31 |
+
from transformers import AutoImageProcessor, AutoModelForObjectDetection
|
| 32 |
+
from PIL import Image
|
| 33 |
+
import torch
|
| 34 |
+
|
| 35 |
+
# Load model
|
| 36 |
+
processor = AutoImageProcessor.from_pretrained("baselefre/objectdetectionaugmentedclean")
|
| 37 |
+
model = AutoModelForObjectDetection.from_pretrained("baselefre/objectdetectionaugmentedclean")
|
| 38 |
+
|
| 39 |
+
# Load image
|
| 40 |
+
image = Image.open("your_image.jpg")
|
| 41 |
+
|
| 42 |
+
# Inference
|
| 43 |
+
inputs = processor(images=image, return_tensors="pt")
|
| 44 |
+
outputs = model(**inputs)
|
| 45 |
+
target_sizes = torch.tensor([image.size[::-1]])
|
| 46 |
+
results = processor.post_process_object_detection(outputs, threshold=0.5, target_sizes=target_sizes)[0]
|
| 47 |
+
|
| 48 |
+
# Print detections
|
| 49 |
+
for score, label, box in zip(results["scores"], results["labels"], results["boxes"]):
|
| 50 |
+
print(f"{model.config.id2label[label.item()]}: {score:.2f} at {box.tolist()}")
|
| 51 |
+
```
|