/ Модель

Характеристики

Лицензия
MIT
Библиотека
keras

fashion-image-search

Эмбеддинги изображенийИзображение → embedding3 профессии

Модель ищет визуально похожие товары одежды и аксессуаров по фотографии в фиксированном каталоге из 8 000 позиций.

46скачиваний за 30 дней0лайковвеса обновлены25 сен 2026

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

Fashion Image Search — модель поиска похожих товаров в каталоге одежды и аксессуаров по изображению, созданная автором shalev396. Изображение обрабатывает замороженная MobileNetV2 с весами ImageNet и 2 257 984 параметрами: она извлекает вектор признаков размерности 1280, который PCA-проекция сокращает до 256 измерений, после чего вектор нормализуется. Поиск точный, по косинусному сходству среди заранее проиндексированных 8 000 товаров; результаты включают ближайшие совпадения с названием, категорией и миниатюрой.

Модель предназначена для визуального поиска по модному каталогу: пользователь загружает фотографию товара и получает визуально похожие позиции. На отложенной выборке из 500 изображений точность совпадения типа товара среди пяти ближайших результатов составила 72,8%, а совпадения главной категории — 97,0%. Репозиторий содержит TensorFlow/Keras-модель извлечения признаков, проекцию PCA и индекс каталога; README также описывает использование через Python, Gradio API и Hugging Face Inference Endpoints.

Модель использует только изображения и не была дообучена на данных модной индустрии: ImageNet-признаки отражают формы и текстуры, поэтому поиск находит визуально похожие товары, а не обязательно товары того же бренда, цены или стиля. Индекс ограничен фиксированным каталогом Myntra из 8 000 товаров, в основном снятых на белом фоне; уличные снимки, необычные ракурсы, несколько объектов в кадре и редкие категории снижают качество. Изображение без кадрирования искажается при масштабировании до 224×224. Лицензия — MIT.

Сценарии применения

  • поиск похожей одежды по фотографии товара
  • подбор обуви, сумок и аксессуаров по изображению
  • поиск визуальных аналогов товаров в каталоге интернет-магазина
  • получение ближайших товаров с названиями и категориями
  • создание прототипа визуального поиска по каталогу моды

Ограничения

Индекс ограничен фиксированным каталогом Myntra из 8 000 товаров; уличные фотографии, несколько предметов в кадре, необычные ракурсы и редкие категории могут ухудшать поиск. Сходство определяется признаками ImageNet и означает визуальное сходство, а не совпадение бренда, цены или стиля; входное изображение растягивается до 224×224 без кадрирования.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Fashion Image Search

Visual product search: a photo goes in, the most similar products of a fashion catalog come out. A frozen ImageNet MobileNetV2 turns each image into a 1280-d feature vector, PCA (fit on the catalog, no labels) reduces it to a 256-d L2-normalized embedding, and an exact cosine nearest-neighbour search over the pre-computed embeddings of 8,000 catalog products returns the closest matches with their name, category and a thumbnail. Nothing is fine-tuned: "training" means embedding the catalog and measuring retrieval quality on held-out photos.

On 500 held-out test photos, 72.8 % of the top-5 matches have the query's exact article type (119 types in the catalog; a random ranking gets 5.4 %) and 97.0 % its master category.

Model

Embedderkeras.applications.MobileNetV2(include_top=False, pooling="avg", weights="imagenet"), frozen, 2,257,984 parameters
PreprocessingRGB, bilinear resize to 224x224, x / 127.5 - 1 (a Rescaling layer inside backbone.keras)
Embedding1280-d global-average-pooled features -> PCA 256-d (projection.npz, fit on the catalog embeddings) -> L2-normalized
Index8,000 catalog products, embeddings.npy (8000x256 float16) + catalog.parquet (metadata + JPEG thumbnails, native 60x80 px)
Searchexact cosine k-NN (brute force; same ranking as sklearn NearestNeighbors(metric="cosine"))
Input / outputone image -> {"matches": [{"id", "name", "master_category", "article_type", "score", "thumbnail"}]}

Files: backbone.keras (the embedder, so inference never downloads ImageNet weights), projection.npz, embeddings.npy, catalog.parquet, config.json, model.py (embedder, preprocessing, search, Predictor), handler.py (Inference Endpoint), metrics.json, assets/ (graphs).

Usage

from huggingface_hub import snapshot_download
import sys
path = snapshot_download("shalev396/fashion-image-search")
sys.path.insert(0, path)
import model
predictor = model.load(path, device="cpu")
result = predictor.predict("my_sneaker.jpg", k=6)      # PIL image, path, bytes or base64
for m in result["matches"]:
    print(f'{m["score"]:.3f}  {m["article_type"]:12s}  {m["name"]}')
  • Space API (free): see the Space: POST /gradio_api/call/predict with [image, k] -> [{"matches": [...]}, seconds, device].
  • Inference Endpoint: deploy this repo (Deploy -> Inference Endpoints). handler.py takes {"inputs": "<base64 image>", "parameters": {"k": 6}} and returns the same {"matches": [...]}.

Training

Data: Fashion Product Images (Small) (44k Myntra product photos, 60x80 px, labelled with master category / sub category / article type). Master categories with fewer than 20 products are dropped. A stratified (by master category) split gives the catalog (8,000 products that get indexed), 500 validation queries (choose the variant) and 500 test queries (reported once). Queries are never in the catalog.

Five representations are compared with the same cosine k-NN search: raw pixels, a colour histogram, MobileNetV2 and MobileNetV2 reduced with PCA (fit on the catalog, no labels). The one with the best validation Precision@10 (article type) is exported. Embedding the ~9,000 photos took 767 s on a shared (heavily loaded) desktop CPU, 879 s for the whole build; an earlier run of the same pipeline on an idle machine took 256 s end to end. Full code: training/ · Colab

Experiments

variantdimval P@10 (article type)test P@5 (article type)test P@10 (article type)test P@5 (master cat.)test P@10 (master cat.)
mobilenetv2_pca256 (deployed)2560.70900.72840.70220.97040.9686
mobilenetv2_pca1281280.70840.72520.70260.97200.9696
mobilenetv21,2800.70380.72640.70120.96800.9650
pixels_323,0720.59880.63920.60660.93840.9292
color_hist_85120.29880.28680.26140.69040.6656

The three MobileNetV2 variants are within 0.005 of each other on validation (500 queries, so the differences are within noise); PCA-256 was picked by the rule and keeps the index 5x smaller than the full 1280-d embedding. The CNN clearly beats both no-learning baselines, especially on the fine-grained article type (P@10 0.70 vs 0.61 for raw pixels and 0.26 for colour histograms).

Precision@K curves Variant comparison

Evaluation

Precision@K = share of a held-out query's top-K catalog matches that have the same label (master category: 6 coarse classes; article type: 119 fine classes in the catalog, such as Tshirts, Casual Shoes, Handbags). A random ranking scores 0.342 (master category) and 0.054 (article type). Test split of the deployed variant:

metric (test)value
p_at_1_master_category0.9780
p_at_5_master_category0.9704
p_at_10_master_category0.9686
p_at_1_article_type0.7520
p_at_5_article_type0.7284
p_at_10_article_type0.7022

Per master category (test P@5, article type; metrics.json -> per_category, n = test queries): Apparel 0.74 (n=241), Accessories 0.82 (n=127), Footwear 0.63 (n=103), Personal Care 0.57 (n=27), Free Items 1.00 (n=1), Sporting Goods 0.40 (n=1).

Footwear mixes up visually close types (heels / flats / sandals). An earlier run of the legacy code (full 1280-d embedding, a different 500-query sample) reported P@5 0.977 / 0.718 (master category / article type), in line with these numbers.

t-SNE of the catalog embeddings Example queries

Limitations

  • The catalog is fixed: 8,000 products from one Indian e-commerce site (Myntra), photographed on a white background. Street photos, several items in one picture or unusual angles match less well.
  • ImageNet features know shapes and textures, not fashion attributes: two shirts of the same cut but different brands look alike, and "similar" means visually similar, not same style or price.
  • Precision@K uses the dataset's labels as ground truth. Some near-duplicates carry different article-type labels (e.g. Tshirts vs Tops), so the fine-grained number understates quality a bit.
  • Products photographed in their packaging match other boxed products: the watch-in-a-box example (second row of the query grid) retrieves fragrance gift sets, not watches.
  • Rare master categories are barely represented (Free Items 19, Sporting Goods 4 catalog products).
  • The input photo is squashed to 224x224 without cropping; very wide or tall images are distorted.

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · keras

Нельзя запустить

Keras/TensorFlow-модели рантайм не загружает.

Ревизия весов
cacb917

0 моделей