| 이름 | 링크 |
|---|---|
| FashionClip 기능 추출 및 분류 | |
| 튜토리얼 -리스트를 사용한 패션 클립 평가 |
업데이트 (10/03/23) : 모델을 업데이트했습니다! 우리는 Laion/Clip-Vit-B-32-Laion2b-S34B-B79K Checkpoint (Thanks Bin!)가 패션에서 원래 OpenAi 클립보다 더 잘 작동한다는 것을 발견했습니다. 따라서 우리는 Architecture를 동일하게 유지하면서 Fashionclip (따라서 Fashionclip 2.0)의 새로운 (그리고 더 나은!) 버전을 미세 조정합니다. 우리는 laion/CLIP-ViT-B-32-laion2B-s34B-b79K 가 제공하는 우수성 이득이 훈련 데이터가 증가했기 때문이라고 가정합니다 (5x OpenAI Clip 데이터). 그러나 우리의 논문은 패션 데이터 세트에서 미세 조정 된 laion/CLIP 우리의 벤치 마크에서 제로 샷 퍼포먼스를 향상 시켰습니다. 모델 전체의 가중 매크로 F1 점수를 비교하는 아래 표를 참조하십시오. `
| 모델 | fmnist | 카글 | 깊은 |
|---|---|---|---|
| Openai 클립 | 0.66 | 0.63 | 0.45 |
| 패션 클립 | 0.74 | 0.67 | 0.48 |
| laion 클립 | 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 데이터 세트의 공식 릴리스를 기다리고 있으며 미세 조정 된 모델 가중치, 사전 처리 된 이미지 및 텍스트 벡터가 공개됩니다. 한편, 우리는 현재 CLIP 의 포옹 얼굴 구현을 사용 fclip = FashionCLIP('<username>/<repo_name>', ... ) 있으며 표준 Hugginf 또한 개인 리포지토리 (예 : fclip = FashionCLIP('<username>/<repo_name>', auth_token=<AUTH_TOKEN>, ... ) )를 지원합니다.
자세한 내용은 아래를 참조하십시오!
FashionCLIP 은 패션 산업을 위해 미세 조정 된 클립과 같은 모델입니다. 우리는 미세 조정 CLIP (Radford et al., 2021 이상에서 700k <이미지, 텍스트> Farfetch 데이터 세트 1 의 쌍.
우리는 Fashionclip을 적용하여 검색, 분류 및 패션 구문 분석과 같은 업계에서 문제를 개방하기 위해 적용하여 평가합니다. 우리의 결과 미세 조정이 도메인 별 개념을 포착하고 제로 샷 시나리오에서 일반화하는 데 도움이된다는 것을 보여줍니다. 또한 질적 분석을 통해 정량적 테스트를 보완하고 시각적 공간에 개념이 언어 일반화를 잠금 해제하는 방법에 대한 예비 통찰력을 제공합니다. 자세한 내용은 당사 논문을 참조하십시오.
이 저장소에는 FashionCLIP 과 상호 작용할 수있는 API와 FashionCLIP 의 기능을 보여주는 Streamlit (Coming Soon!)을 사용하여 구축 된 대화식 데모를 찾을 수 있습니다.
임베딩을 생성하는 빠른 방법이 필요하십니까? 검색 성능을 테스트 하시겠습니까?
우선, 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 )Colab 노트북을 사용하여 더 많은 기능을보십시오.
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 을 쉽게 사용할 수 있도록 두 가지 주요 추상화가 있습니다.
먼저, 주어진 카탈로그와 관련된 정보를 캡슐화하고 FashionCLIP 에 중요한 정보를 노출시키는 FCLIPDataset 클래스. 또한 데이터의 빠른 탐색 및 시각화를위한 도우미 기능을 제공합니다. 주요 초기화 매개 변수는 다음과 같습니다
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)
패키지 사용 방법에 대한 자세한 내용은 함께 제공되는 노트북을 참조하십시오!
보류 중 공식 릴리스. ↩