22#include <opencv2/opencv.hpp>
39 CLIP(std::string
const & modelpath);
61 float similarity(cv::Mat
const & emb1, cv::Mat
const & emb2)
const;
64 struct clip_ctx * itsCtx =
nullptr;
Interface to a CLIP model used to compute text and image embeddings.
void freeze(bool doit)
Freeze/unfreeze parameters that users should not change while running.
float similarity(cv::Mat const &emb1, cv::Mat const &emb2) const
Compute cosine similarity between two embeddings.
virtual ~CLIP()
Virtual destructor for safe inheritance.
cv::Mat textEmbedding(std::string const &txt)
Get embedding for some text, typically as a 1x512 float matrix (depends on clip model version)
cv::Mat imageEmbedding(cv::Mat const &img)
Get embedding for some RGB uint8 packed image, typically as a 1x512 float matrix.
int textEmbeddingSize() const
Get text embedding size, useful if we need to know it before getting an embedding,...
int imageEmbeddingSize() const
Get image embedding size, useful if we need to know it before getting an embedding,...
Main namespace for all JeVois classes and functions.