CoolFace
Modelpublic

electblake/clothing_type_rtdetr_v2_r18vd

sourceHugging Faceapache-2.0updated 3d agoView on Hugging Face
0likes12downloads
Model Card

Clothing Type RT-DETRv2 R18vd

This is an RT-DETRv2 object-detection model fine-tuned from `PekingU/rtdetr_v2_r18vd`. It locates clothing in an image and assigns one of six labels:

  • —swim
  • —denim_shorts
  • —lingerie_black
  • —lingerie_red
  • —lingerie_white
  • —swim_sports

The published weights are the best validation checkpoint from an eight-epoch training run. The checkpoint was selected by COCO mAP and occurred at step 13,846 (epoch 7).

Intended use

The model is intended for experimental clothing detection, image indexing, and dataset organization. It returns bounding boxes, confidence scores, and one of the six labels above.

It is not designed for general fashion taxonomy, person identification, safety-critical decisions, or conclusions about people shown in an image.

Usage

python
import torch
from PIL import Image
from transformers import AutoImageProcessor, RTDetrV2ForObjectDetection

model_id = "electblake/clothing_type_rtdetr_v2_r18vd"
image = Image.open("image.jpg").convert("RGB")

processor = AutoImageProcessor.from_pretrained(model_id)
model = RTDetrV2ForObjectDetection.from_pretrained(model_id)
model.eval()

inputs = processor(images=image, return_tensors="pt")
with torch.inference_mode():
    outputs = model(**inputs)

result = processor.post_process_object_detection(
    outputs,
    threshold=0.125,
    target_sizes=torch.tensor([(image.height, image.width)]),
)[0]

for score, label_id, box in zip(
    result["scores"], result["labels"], result["boxes"]
):
    print(
        model.config.id2label[label_id.item()],
        round(score.item(), 3),
        [round(value, 1) for value in box.tolist()],
    )

Each box is returned as (xmin, ymin, xmax, ymax) in pixels. The example threshold of 0.125 matches the local inference script; applications should tune it for their precision/recall requirements.

Training data

The model was trained on a private image collection formatted as a Hugging Face imagefolder object-detection dataset. The data was split into 70% training, 15% validation, and 15% test partitions with random seed 42. Initial bounding boxes were produced with YOLO-World and therefore constitute pseudo-labels rather than exhaustively human-verified annotations.

The training dataset is not included in this model repository.

Training procedure

  • —Input size: 640 x 640
  • —Epochs: 8
  • —Train batch size: 4
  • —Evaluation batch size: 4
  • —Learning rate: 0.00005
  • —Weight decay: 0.0001
  • —Scheduler: cosine
  • —Mixed precision: FP16
  • —Best-model criterion: validation COCO mAP
  • —Seed: 42

The model was trained with Transformers 5.17.0 and PyTorch 2.14.0+cu130.

Validation results

Metrics below are from the private validation split at the selected best checkpoint (step 13,846). No independent external benchmark was used.

MetricValue
COCO mAP0.6460
COCO mAP@500.8411
COCO mAP@750.7217
Recall@1000.8696
ClassAP
swim0.5712
denim_shorts0.6521
lingerie_black0.5850
lingerie_red0.6433
lingerie_white0.5447
swim_sports0.8796

Limitations

  • —The narrow, private training distribution may not represent other image sources, garment styles, lighting conditions, poses, or occlusion levels.
  • —The label set is incomplete and conflates garment type with color for some classes.
  • —Pseudo-label errors from the annotation model can be inherited by this model.
  • —Reported results are validation-set measurements and may overestimate performance on unrelated data.

Evaluate the model on representative data before using it in an application.