Handbag sketch attribute model

Actual trained weights for a sketch-only categorical attribute predictor. This is a private model repository, separate from the private interactive Space at https://huggingface.co/spaces/kwongnon/handbag-sketch-attributes.

The frozen ImageNet-pretrained mobilenetv3_large_100.ra_in1k encoder feeds ten classification heads: angle, bag_type, strap_type, closure, hardware, material, color, structure, shape, size. The selected model uses linear heads, AdamW learning rate 0.001, weight decay 0.0001, and train-only label mappings. Six head configurations were compared on validation mean macro F1; the selected trial ran six epochs with early stopping. Test was evaluated after selection.

Data and leakage checks

Pinned dataset revision: 98d85555d5f2e6d782599b8c73f0d27ff4c67456. 19,300 training rows from 193 original sketches / 97 bags; validation 42 sketches / 21 bags; test 41 sketches / 21 bags. No augmented holdout rows. Original bags and all descendants remain in one split. Audits found no cross-split bag, parent, URL, or exact image overlap. Only sketch pixels enter the model; photos, labels, URLs and provenance are not predictor inputs. See leakage_audit.json. Similar designs and source-label errors remain possible.

Measured performance

Attribute Test accuracy
angle 87.8%
bag_type 90.2%
strap_type 80.5%
closure 46.3%
hardware 51.2%
material 41.5%
color 19.5%
structure 34.1%
shape 34.1%
size 56.1%

Mean attribute accuracy: 54.1%; all-ten-attributes correctness: 0% on this small test set. Color, material, and hardware finish have limited visual evidence in a line sketch. Confidence is uncalibrated softmax probability, not a guarantee of correctness.

Files

  • model.pt: actual trained PyTorch encoder/head weights, label mappings, and preprocessing.
  • model.onnx: browser/runtime export; all 41 test predictions reproduced.
  • network.py: architecture and single-image Predictor.
  • train.py, kwongnon_handbag_sketch_attribute_model.ipynb: training workflow.
  • labels.json, metrics, search configuration, per-example test predictions, and verification reports.

The notebook includes the training pipeline and recorded run results; the original run was executed using train.py, rather than through a notebook execution engine. This custom multi-head model uses the supplied Predictor instead of a generic Transformers pipeline.

Load the trained model

Download network.py alongside the weights and install requirements.txt.

from huggingface_hub import snapshot_download
from PIL import Image
import sys

folder = snapshot_download("kwongnon/handbag-sketch-attribute-model",
    allow_patterns=["model.pt", "network.py"])
sys.path.insert(0, folder)
from network import Predictor
predictor = Predictor(folder + "/model.pt")
result = predictor.predict(Image.open("your_sketch.png"))
print(result)

Private repository access requires an authorized Hugging Face login. Weights contain no credentials. The checkpoint loads with weights_only=True and does not need to fetch pretrained weights. Input is EXIF-corrected, padded with white to 224×224 RGB, and normalized for the pretrained encoder.

No new license or redistribution rights are granted for the upstream dataset.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Dataset used to train kwongnon/handbag-sketch-attribute-model