# Use VisionTextDualEncoder for image-text retrieval

**URL:** </static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuse-visiontextdualencoder-for-image-text-retrieval%2F27743%3E%5C
**Category:** Intermediate\
**Created:** [December 13, 2022, 9:29am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuse-visiontextdualencoder-for-image-text-retrieval%2F27743 "2022-12-13T09:29:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![johncash1990](https://avatars.discourse-cdn.com/v4/letter/j/49beb7/32.png) [@johncash1990](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Fu%2Fjohncash1990)%5C
**Post date:** [December 13, 2022, 9:29am UTC](/static-proxy?url=https%3A%2F%2Fdiscuss.huggingface.co%2Ft%2Fuse-visiontextdualencoder-for-image-text-retrieval%2F27743%2F1 "2022-12-13T09:29:55Z")

</div>

Is there a tutorial on using VisionTextDualEncoder together with a contrastive image-text loss?

My use case: I would like to train a network to put images and tags of those into the same latent space for image retrieval. Once I have the model trained I would like to use it for image/tag retrieval - image as a query and get tags that similar images have (k nearest neighbors) and the other way around.

Now I am not sure how exactly to train such a model?

I probably could do that with CLIP? Although I don’t need semantic information, just image to tag/keyword.
