Commit
·
c5d07e3
1
Parent(s):
a226df2
Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: mit
|
3 |
+
---
|
4 |
+
|
5 |
+
# AskVideos-VideoCLIP-7B-v0.1
|
6 |
+
Like it's image-only counterpart, CLIP, VideoCLIP enables you to compute similarity scores but between text and videos.
|
7 |
+
|
8 |
+
VideoCLIP uses a Video Q-Former to aggregate frame-level embeddings temporally into a single embedding, maintaining relevance of the underlying content.
|
9 |
+
|
10 |
+
The resulting embedding is then trained with contrastive learning to match it's corresponding text, enabling similarity search for videos and text.
|
11 |
+
|
12 |
+
# Usage
|
13 |
+
|
14 |
+
```
|
15 |
+
# Load model
|
16 |
+
import video_clip
|
17 |
+
eval_config = 'eval_configs/video_clip.yaml'
|
18 |
+
model, vis_processor = video_clip.load_model(eval_config)
|
19 |
+
|
20 |
+
# Compute video embeddings
|
21 |
+
video_embs = video_clip.get_all_video_embeddings(videos, model, vis_processor)
|
22 |
+
|
23 |
+
# Compute Video-Text similarity
|
24 |
+
v2t_sim = video_clip.compute_sim(model, texts, video_embs)
|
25 |
+
|
26 |
+
# Compute Text-Video similarity
|
27 |
+
t2v_sim = v2t_sim.T
|
28 |
+
|
29 |
+
# Compute Video-Video distance
|
30 |
+
v2v_dists = video_clip.compute_dist_videoq(model, video_embs[0], video_embs)
|
31 |
+
```
|
32 |
+
|
33 |
+
For a more detailed demo of how to use the model, see demo.ipynb.
|