🚀 CLIP-convnext_large_d_320.laion2B-s29B-b131K-ftのモデルカード
このモデルは、LAION-2Bデータセットを用いて訓練されたCLIPモデルで、ゼロショット画像分類などのタスクに利用できます。
🚀 クイックスタート
このモデルは、研究コミュニティ向けの研究成果として提供されています。ゼロショット画像分類や画像・テキスト検索などのタスクに使用できます。
✨ 主な機能
- ゼロショット画像分類:事前にクラスラベルの訓練を行わずに画像を分類できます。
- 画像とテキストの検索:画像とテキストの関連性を利用して検索を行えます。
- 下流タスクの微調整:画像分類や画像生成などの下流タスクでの微調整が可能です。
📦 インストール
このモデルは、open_clip
ライブラリを用いて使用できます。以下のコマンドでインストールできます。
pip install open_clip
💻 使用例
基本的な使用法
import open_clip
import torch
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('convnext_large_d_320.laion2B-s29B-b131K-ft')
tokenizer = open_clip.get_tokenizer('convnext_large_d_320.laion2B-s29B-b131K-ft')
image = preprocess(Image.open("image.jpg")).unsqueeze(0)
text = tokenizer(["a photo of a cat", "a photo of a dog"])
with torch.no_grad():
image_features = model.encode_image(image)
text_features = model.encode_text(text)
image_features /= image_features.norm(dim=-1, keepdim=True)
text_features /= text_features.norm(dim=-1, keepdim=True)
logits_per_image, logits_per_text = model(image, text)
probs = logits_per_image.softmax(dim=-1).cpu().numpy()
print("Label probs:", probs)
高度な使用法
import open_clip
import torch
from PIL import Image
model, _, preprocess = open_clip.create_model_and_transforms('convnext_large_d_320.laion2B-s29B-b131K-ft')
tokenizer = open_clip.get_tokenizer('convnext_large_d_320.laion2B-s29B-b131K-ft')
images = [preprocess(Image.open(f"image_{i}.jpg")).unsqueeze(0) for i in range(3)]
images = torch.cat(images, dim=0)
texts = tokenizer(["a photo of a cat", "a photo of a dog", "a photo of a bird"])
with torch.no_grad():
image_features = model.encode_image(images)
text_features = model.encode_text(texts)
image_features /= image_features.norm(dim=-1, keepdim=True)
text_features /= text_features.norm(dim=-1, keepdim=True)
logits_per_image, logits_per_text = model(images, texts)
probs = logits_per_image.softmax(dim=-1).cpu().numpy()
print("Label probs:", probs)
📚 ドキュメント
モデル詳細
このモデルは、OpenCLIPを用いて、LAION-2B(英語)サブセットのLAION-5Bデータセットで訓練されたCLIP ConvNeXt-Largeモデルです。
用途
直接的な使用
ゼロショット画像分類、画像とテキストの検索など。
下流の使用
画像分類や他の画像タスクの微調整、線形プローブ画像分類、画像生成のガイドと条件付けなど。
範囲外の使用
このモデルのすべての展開されたユースケース(商用または非商用)は、現在のところ範囲外です。制約された環境での画像検索などの非展開ユースケースも、特定の固定クラス分類法でのモデルの十分なドメイン内テストが行われない限り、推奨されません。
訓練詳細
訓練データ
このモデルは、LAION-2B(https://laion.ai/blog/laion-5b/)というLAION-5Bの20億サンプルの英語サブセットを用いて訓練されました。
⚠️ 重要な注意
このデータセットは、大規模なマルチモーダルモデルの訓練と、公開されたインターネットからクロールされた未整理の大規模データセットの取り扱いに関する研究と実験を民主化することを目的として作成されています。したがって、このデータセットは研究目的で使用することをお勧めします。この大規模データセットは未整理であり、収集されたリンクが人間の閲覧者にとって非常に不快で不快なコンテンツにつながる可能性があることに注意してください。
訓練手順
すべての320x320モデルの微調整は、グローバルバッチサイズ131072で、203.7Mサンプルの10 - 16チェックポイント間隔で訓練され、微調整中に合計約2 - 3Bサンプルが見られました。
評価
評価は、LAION CLIP Benchmark suiteのコードを用いて行われました。
テストデータ、要因、メトリクス
テストデータ
テストは、分類にはVTAB+(https://arxiv.org/abs/1910.04867のVTABと追加のロバストデータセットの組み合わせ)、検索にはCOCOとFlickrを用いて行われました。
結果
このモデルは、ImageNet-1kで75.9から76.9のトップ1ゼロショット精度を達成しています。
謝辞
このモデルの訓練に使用されたコンピューティングリソースを提供してくれたstability.aiに感謝します。
引用
@inproceedings{schuhmann2022laionb,
title={{LAION}-5B: An open large-scale dataset for training next generation image-text models},
author={Christoph Schuhmann and
Romain Beaumont and
Richard Vencu and
Cade W Gordon and
Ross Wightman and
Mehdi Cherti and
Theo Coombes and
Aarush Katta and
Clayton Mullis and
Mitchell Wortsman and
Patrick Schramowski and
Srivatsa R Kundurthy and
Katherine Crowson and
Ludwig Schmidt and
Robert Kaczmarczyk and
Jenia Jitsev},
booktitle={Thirty-sixth Conference on Neural Information Processing Systems Datasets and Benchmarks Track},
year={2022},
url={https://openreview.net/forum?id=M3Y74vmsMcY}
}
@software{ilharco_gabriel_2021_5143773,
author = {Ilharco, Gabriel and
Wortsman, Mitchell and
Wightman, Ross and
Gordon, Cade and
Carlini, Nicholas and
Taori, Rohan and
Dave, Achal and
Shankar, Vaishaal and
Namkoong, Hongseok and
Miller, John and
Hajishirzi, Hannaneh and
Farhadi, Ali and
Schmidt, Ludwig},
title = {OpenCLIP},
month = jul,
year = 2021,
note = {If you use this software, please cite it as below.},
publisher = {Zenodo},
version = {0.1},
doi = {10.5281/zenodo.5143773},
url = {https://doi.org/10.5281/zenodo.5143773}
}
@inproceedings{Radford2021LearningTV,
title={Learning Transferable Visual Models From Natural Language Supervision},
author={Alec Radford and Jong Wook Kim and Chris Hallacy and A. Ramesh and Gabriel Goh and Sandhini Agarwal and Girish Sastry and Amanda Askell and Pamela Mishkin and Jack Clark and Gretchen Krueger and Ilya Sutskever},
booktitle={ICML},
year={2021}
}
@Article{liu2022convnet,
author = {Zhuang Liu and Hanzi Mao and Chao-Yuan Wu and Christoph Feichtenhofer and Trevor Darrell and Saining Xie},
title = {A ConvNet for the 2020s},
journal = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2022},
}
@misc{rw2019timm,
author = {Ross Wightman},
title = {PyTorch Image Models},
year = {2019},
publisher = {GitHub},
journal = {GitHub repository},
doi = {10.5281/zenodo.4414861},
howpublished = {\url{https://github.com/rwightman/pytorch-image-models}}
}
📄 ライセンス
このモデルはMITライセンスの下で提供されています。