| اسم | وصلة |
|---|---|
| استخراج ميزة FashionClip وتصنيفه | |
| البرنامج التعليمي - تقييم الأزياء مع Reclist |
تحديث (10/03/23): لقد قمنا بتحديث النموذج! لقد وجدنا أن نقطة تفتيش Laion/Clip-Vit-B-32-Laion2B-S34B-B79K (شكرًا بن!) كانت أفضل من مقطع Openai الأصلي على الموضة. وبالتالي ، فإننا نقوم بضبط نسخة أحدث (وأفضل!) من FashionClip (من الآن فصاعدًا FashionClip 2.0) ، مع الحفاظ على العمارة كما هي. نفترض أن مكاسب Perofrmance التي توفرها laion/CLIP-ViT-B-32-laion2B-s34B-b79K ناتجة عن زيادة بيانات التدريب (بيانات 5x Openai Clip). أطروحتنا ، ومع ذلك ، لا تزال كما هي-تحسنت laion/CLIP على مجموعة بيانات الأزياء الخاصة بنا من خلال المعايير الخاصة بنا. راجع الجدول أدناه الذي يقارن درجة الماكرو F1 المرجحة عبر النماذج. `
| نموذج | FMNIST | kagl | عميق |
|---|---|---|---|
| مقطع Openai | 0.66 | 0.63 | 0.45 |
| الأزياء | 0.74 | 0.67 | 0.48 |
| مقطع لاون | 0.78 | 0.71 | 0.58 |
| FashionClip 2.0 | 0.83 | 0.73 | 0.62 |
نحن الآن على معانقة الوجه! النموذج متاح هنا.
نحن الآن على التقارير العلمية الطبيعة!
@Article{Chia2022,
title="Contrastive language and vision learning of general fashion concepts",
author="Chia, Patrick John
and Attanasio, Giuseppe
and Bianchi, Federico
and Terragni, Silvia
and Magalh{~a}es, Ana Rita
and Goncalves, Diogo
and Greco, Ciro
and Tagliabue, Jacopo",
journal="Scientific Reports",
year="2022",
month="Nov",
day="08",
volume="12",
number="1",
pages="18958",
abstract="The steady rise of online shopping goes hand in hand with the development of increasingly complex ML and NLP models. While most use cases are cast as specialized supervised learning problems, we argue that practitioners would greatly benefit from general and transferable representations of products. In this work, we build on recent developments in contrastive learning to train FashionCLIP, a CLIP-like model adapted for the fashion industry. We demonstrate the effectiveness of the representations learned by FashionCLIP with extensive tests across a variety of tasks, datasets and generalization probes. We argue that adaptations of large pre-trained models such as CLIP offer new perspectives in terms of scalability and sustainability for certain types of players in the industry. Finally, we detail the costs and environmental impact of training, and release the model weights and code as open source contribution to the community.",
issn="2045-2322",
doi="10.1038/s41598-022-23052-9",
url="https://doi.org/10.1038/s41598-022-23052-9"
}
نحن ننتظر الإصدار الرسمي لمجموعة بيانات Farfetch ، والتي سيتم فيها نشر أوزان النماذج التي يتم ضبطها بشكل جيد ، ومواقف الصور والنص المعالجة مسبقًا. في غضون ذلك ، نستخدم حاليًا تطبيق Face Face CLIP ويمكننا استخدام أوزان النموذج من Openai باتباع اتفاقية تسمية Hugginface القياسية (IE fclip = FashionCLIP('<username>/<repo_name>', ... ) ). نحن ندعم أيضًا المستودعات الخاصة (أي fclip = FashionCLIP('<username>/<repo_name>', auth_token=<AUTH_TOKEN>, ... ) ).
انظر أدناه لمزيد من التفاصيل!
FashionCLIP هو نموذج يشبه مقطع تم ضبطه لصناعة الأزياء. نحن نضبط CLIP (Radford et al. ، 2021 على أكثر من 700 ألف <صورة ، نص> أزواج من مجموعة بيانات Farfetch 1 .
نقوم بتقييم الأزياء من خلال تطبيقه لفتح المشكلات في الصناعة مثل الاسترجاع والتصنيف وتحليل الأزياء. توضح نتائجنا أن التثبيت الدقيق يساعد في التقاط مفاهيم خاصة بالمجال وتعميمها في سيناريوهات الصفر. نقوم أيضًا بتكملة الاختبارات الكمية مع التحليلات النوعية ، ونقدم رؤى أولية حول كيفية قيام المفاهيم التي ترتكز في الفضاء البصري بإلغاء تأمين التعميم اللغوي. يرجى الاطلاع على ورقتنا لمزيد من التفاصيل.
في هذا المستودع ، ستجد واجهة برمجة تطبيقات للتفاعل مع FashionCLIP وتوضيح تفاعلي تم تصميمه باستخدام STREMELIT (قريبًا!) الذي يعرض قدرات FashionCLIP .
هل تحتاج إلى طريقة سريعة لتوليد التضمينات؟ هل تريد اختبار أداء الاسترجاع؟
بادئ ذي بدء ، يجب أن تكون قادرًا على تثبيت هذا بسرعة باستخدام PIP.
$ pip install fashion-clip
إذا كان لديك قوائم بالنصوص ومسارات الصور ، فمن السهل جدًا توليد التضمينات:
from fashion_clip . fashion_clip import FashionCLIP
fclip = FashionCLIP ( 'fashion-clip' )
# we create image embeddings and text embeddings
image_embeddings = fclip . encode_images ( images , batch_size = 32 )
text_embeddings = fclip . encode_text ( texts , batch_size = 32 )
# we normalize the embeddings to unit norm (so that we can use dot product instead of cosine similarity to do comparisons)
image_embeddings = image_embeddings / np . linalg . norm ( image_embeddings , ord = 2 , axis = - 1 , keepdims = True )
text_embeddings = text_embeddings / np . linalg . norm ( text_embeddings , ord = 2 , axis = - 1 , keepdims = True )استخدم دفتر كولاب الخاص بنا لرؤية المزيد من الوظائف.
from PIL import Image
import requests
from transformers import CLIPProcessor , CLIPModel
model = CLIPModel . from_pretrained ( "patrickjohncyh/fashion-clip" )
processor = CLIPProcessor . from_pretrained ( "patrickjohncyh/fashion-clip" )
image = Image . open ( "images/image1.jpg" )
inputs = processor ( text = [ "a photo of a red shoe" , "a photo of a black shoe" ],
images = image , return_tensors = "pt" , padding = True )
outputs = model ( ** inputs )
logits_per_image = outputs . logits_per_image # this is the image-text similarity score
probs = logits_per_image . softmax ( dim = 1 )
print ( probs )
image . resize (( 224 , 224 )) من جذر المشروع ، قم بتثبيت حزمة fashion-clip محليًا مع
$ pip install -e .
هناك نوعان من التجريدات الرئيسية لتسهيل الاستخدام السهل FashionCLIP .
أولاً ، فئة FCLIPDataset التي تغلف المعلومات المتعلقة بكتالوج معين وتكشف معلومات مهمة لـ FashionCLIP . بالإضافة إلى ذلك ، فإنه يوفر وظائف مساعد لاستكشاف وتصور البيانات السريعة. معلمات التهيئة الرئيسية
name: str -> Name of dataset
image_source_path: str -> absolute path to images (can be local or s3)
image_source_type: str -> type of source (i.e. local or s3)
catalog: List[dict] = None -> list of dicts containing at miniumum the keys ['id', 'image', 'caption']
لسهولة الاستخدام ، توفر API أيضًا الوصول إلى مجموعة البيانات ( بمجرد إصدارها رسميًا ) ، المستخدمة في الورقة لتدريب FahionCLIP ، من خلال تحديد اسم الكتالوج المقابل.
from fashion_clip import FCLIPDataset
dataset = FCLIPDataset(name='FF',
image_source_path='path/to/images',
image_source_type='local')
from fashion_clip import FCLIPDataset
my_catalog = [{'id': 1, 'image': 'x.jpg', 'caption': 'image x'}]
dataset = FCLIPDataset(name='my_dataset',
image_source_path='path/to/images',
image_source_type='local',
catalog=my_catalog)
التجريد الثاني هو فئة FashionCLIP ، التي تأخذ اسم نموذج مقطع الوجه المعانقة و FCLIPDataset ، ويوفر وظائف مريحة لأداء المهام مثل الاسترجاع متعدد الوسائط ، وتصنيف الصفر والتوطين. معلمات التهيئة لـ FashionCLIP هي كما يلي:
model_name: str -> Name of model OR path to local model
dataset: FCLIPDataset -> Dataset,
normalize: bool -> option to convert embeddings to unit norm
approx: bool -> option to use approximate nearest neighbors
على غرار تجريد FCLIPDataset ، قمنا بتضمين نموذج FashionCLIP مسبقًا من الورقة ، المستضافة هنا. إذا تم استلام مجموعة بيانات غير معروفة ومجموعة نموذجية ، فسيتم إنشاء متجهات الصورة والتسمية التوضيحية عند إنشاء مثيل للكائن ، وإلا سيتم سحب المتجهات/التضمينات التي تم حسيمها مسبقًا من S3.
from fashion_clip import FCLIPDataset, FashionCLIP
dataset = FCLIPDataset(name='FF',
image_source_path='path/to/images',
image_source_type='local')
fclip = FashionCLIP('fasihon-clip', ff_dataset)
لمزيد من التفاصيل حول كيفية استخدام الحزمة ، راجع دفتر الملاحظات المصاحب!
في انتظار الإصدار الرسمي. ↩