Skip to content

πŸŒ‹πŸ‘΅πŸ» Yo'LLaVA: Your Personalized Language and Vision Assistant

Notifications You must be signed in to change notification settings

WisconsinAIVision/YoLLaVA

Repository files navigation

πŸŒ‹πŸ‘΅πŸ» Yo'LLaVA: Your Personalized LLaVA (NeurIPS 2024)

YoLLaVA Image

β˜†.。.:γƒ»Β°β˜†.。.:・°

πŸŒ‹πŸ‘΅πŸ» Yo'LLaVA: Your Personalized Language and Vision Assistant (NeurIPS 2024)
Thao Nguyen ✨, Haotian Liu, Mu Cai, Yuheng Li, Utkarsh Ojha, Yong Jae Lee
🦑 University of Wisconsin-Madison

./assets/images/teaser.png
Given just a few images of a novel subject (e.g., a dog named <bo>, a person named <thao>), Yo’LLaVA learns to facilitate textual/visual conversations centered around that subject.

β˜†.。.:γƒ»Β°β˜†.。.:・°

Abstract: Large Multimodal Models (LMMs) have shown remarkable capabilities across a variety of tasks (e.g., image captioning, visual question answering). While broad, their knowledge remains generic (e.g., recognizing a dog), and they are unable to handle personalized subjects (e.g., recognizing a user's pet dog). Human reasoning, in contrast, typically operates within the context of specific subjects in our surroundings. For example, one might ask, "What should I buy for my dog's birthday?"; as opposed to a generic inquiry about "What should I buy for a dog's birthday?". Similarly, when looking at a friend's image, the interest lies in seeing their activities (e.g., "my friend is holding a cat"), rather than merely observing generic human actions (e.g., "a man is holding a cat"). In this paper, we introduce the novel task of personalizing LMMs, so that they can have conversations about a specific subject. We propose Yo'LLaVA, which learns to embed a personalized subject into a set of latent tokens given a handful of example images of the subject. Our qualitative and quantitative analyses reveal that Yo'LLaVA can learn the concept more efficiently using fewer tokens and more effectively encode the visual attributes compared to strong prompting baselines (e.g., LLaVA).

Training/ Testing

Installation: This code is directly built on top of LLaVA. Please follow LLaVA's installation!

🚧 Note: This code is under construction 🚧 -- While the base code is available, I have NOT tested the code and optimize the code yet -- Please check back for updates!

python train-multi-token.py --name bo \
            --exp_name final5 --prefix_token 16 --epoch 15 \
            --model_path ./llava_ckpts/llava_ckpt \
            --data_root ./yollava-data/train \
            --user_prompt --recog_only --text_only --random_image

or run bash train.sh

To test, plesase refer to test-sks.py and test-sks-qa.py.

Yo'LLaVA Dataset

YoLLaVA Data

To download the dataset, please intall Git Large File Storage (LFS) and clone the repository. The dataset is in yollava-data folder

git lfs install
git clone https://github.com/WisconsinAIVision/YoLLaVA.git

The simple Visual Question Answering json file is located in yollava-visual-qa.json with the following format:

{
    "./yollava-data/test/bo/0.png":
    {
        "question": "What is the primary color of <sks>'s fur?",
        "options":
        {
            "A": "Brown",
            "B": "Grey"
        },
        "correct_answer": "A"
    }
}
Retrieved Negative Examples

For your convenience, retrieved negative examples are provided in this Google Drive.

Please not that these images are retrieved from LAION-2B with CLIP; and we do NOT own the rights to these images, and these images are purely for research purposes.

Example of negative retrieved

Please download the yollava-data.zip in Google Drive and unzip it. In the folder, you can also find the json file with CLIP similarity scores. Folder structure:

yollava-data
β”œβ”€β”€ train
β”‚   β”œβ”€β”€ bo
β”‚   β”‚   β”œβ”€β”€ 0.png
β”‚   β”‚   β”œβ”€β”€ 1.png
β”‚   β”‚   β”œβ”€β”€ ...
β”‚   β”‚   └── negative_example
β”‚   β”‚       β”œβ”€β”€ 76618997f6ce14d73ccde567a6c8eabb.png
β”‚   β”‚       β”œβ”€β”€ eca8f558d3c4423351f45e87fb8ee5f9.png
β”‚   β”‚       β”œβ”€β”€ ...
β”‚   β”‚       └── scores.json
β”œβ”€β”€ test
β”‚   β”œβ”€β”€ bo
β”‚   β”‚   β”œβ”€β”€ 0.png
β”‚   β”‚   β”œβ”€β”€ 1.png
β”‚   β”‚   β”œβ”€β”€ ...

The json file has the following format:

{
    "image": "51df89957cb840afa91b37db9669fd1b",
    "image_path": "/mnt/localssd/code/data/yollava-data/train/bo/negative_example/51df89957cb840afa91b37db9669fd1b.png",
    "clip_score": 0.6376656889915466
}
Some pretrained concepts

We also provide some pretrained concepts in this Google Drive. This pretrained concepts library includes:


<bo>

<butin>

<ciin>

<denisdang>

<dug>

<khanhvy>

<mam>

<marie-cat>

<oong>

<phuc-map>

<thao>

<thuytien>

<viruss>

<willinvietnam>

<yuheng>

The best.pt is the checkpoint that have higest recognition accuracy in the train set. Other checkpoints are also provided in the folder.

BibTeX

@misc{nguyen2024yollavapersonalizedlanguagevision,
      title={Yo'LLaVA: Your Personalized Language and Vision Assistant}, 
      author={Thao Nguyen and Haotian Liu and Yuheng Li and Mu Cai and Utkarsh Ojha and Yong Jae Lee},
      year={2024},
      eprint={2406.09400},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2406.09400}, 
}

Acknowledgement

This code is heavily borrowed from:

Thank you (.❛ α΄— ❛.)!