CoolFace
Modelpublic

LinaAlhuri/Arabic-clip-vit-base-patch32

sourceHugging Faceupdated 3y agoView on Hugging Face
3likes24downloads
Model Card

Model Details

Arabic CLIP is an adaptation of the Contrastive Language-Image Pre-training (CLIP) for the Arabic language. CLIP is an OpenAI-developed model that learns conceptual concepts from images and relates them with textual descriptions. This work attempts to improve the model's understanding and interpretation of visual information in the context of the Arabic language.

Model Use

python

from transformers import AutoTokenizer, FlaxVisionTextDualEncoderModel
model = FlaxVisionTextDualEncoderModel.from_pretrained("LinaAlhuri/Arabic-clip-vit-base-patch32", logit_scale_init_value=1,from_pt=True)
model.save_pretrained("arabic_clip") 

tokenizer = AutoTokenizer.from_pretrained("asafaya/bert-base-arabic", cache_dir=None, use_fast=True)

Data

The aim was to create a comprehensive Arabic image-text dataset by combining various data sources due to the scarcity of Arabic resources. Challenges included limited Arabic data and the quality of translated datasets. The approach involved merging genuine datasets for rich information and using translated datasets to cover diverse domains, scenarios, and objects, striking a balance between their respective pros and cons.

Dataset nameImages
Arabic Conceptual Captions1,427,210
Arabic COCO 2014414,113
Arabic WIT109,366
Arabic Flicker8K24,272
Proposed (WAP) dataset151,252
Total2,126,213

Performance and Limitations

We have tested the efficacy of Arabic CLIP across different benchmarks tailored for tasks like zero-shot learning, image retrieval, localization, and image search.

  • Conceptual Captions
  • COCO
  • ImageNet
  • Unsplash

Zero-shot Learning

Multilingual CLIPTop 1Top 5Top 10Top 100
Short translation10.1021.9926.7047.57
Long translation9.51820.94225.5445.59
Arabic Baseline Patch 32Top 1Top 5Top 10Top 100
Short translation17.5837.1545.6073.02
Long translation16.9437.1245.4472.94

Image Retrieval

Conceptual Captions Evaluation
MetricMCLIPBaseline Patch 32
MRR@10.0640.165
MRR@50.0930.231
MRR@100.1000.244
COCO Evaluation
MetricMCLIPBaseline Patch 32
MRR@10.0430.082
MRR@50.0680.127
MRR@100.0740.138

Limitations

To summarize the limitations into points

  • Arabic CLIP struggles to count after 3.
  • Limited genuine samples for the Arabic language.
  • Various noises and biases might be introduced into Arabic CLIP because no studies have been conducted yet to address this issue in the published Arabic dataset or Arabic language models.

Bias

For gender bias, it is important to note that Arabic uses a two-gender system in which all nouns are classified as masculine or feminine. However, this is not the case for English. Translating the text from English to Arabic may result in information loss or even make it prone to gender bias.