AskYoutube commited on
Commit
69cf325
1 Parent(s): 0f12b80

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +35 -0
README.md CHANGED
@@ -1,3 +1,38 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+
5
+ # AskVideos-VideoCLIPv0.2
6
+ Like it's image-only counterpart, CLIP, VideoCLIP enables you to compute a single embedding for videos that can be used to compute similarity with text.
7
+
8
+ VideoCLIP uses a Video Q-Former to aggregate frame-level embeddings temporally into a single embedding, maintaining relevance of the underlying content. The resulting embedding is then trained with contrastive loss + captioning loss to match it's corresponding text.
9
+
10
+ This is the latest version of the VideoCLIP model, incorporating more diverse and high quality data. Compared to v0.1, this model performs better on a larger distribution of data and works better on long range retrieval tasks.
11
+
12
+ # Usage
13
+ Link to github to run the model: [link](https://github.com/AskYoutubeAI/AskVideos-VideoCLIP).
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: float matrix of size [num_videos, clip_dim_size, query_tokens] containing VideoCLIP embeddings.
22
+ # In this model, clip_dim_size=1024 and query_tokens=32.
23
+ video_embs = video_clip.get_all_video_embeddings(videos, model, vis_processor)
24
+
25
+ # Compute Video-Text similarity.
26
+ # v2t_sim: float matrix of size [num_videos, num_texts] indicating similarity.
27
+ v2t_sim = video_clip.compute_sim(model, texts, video_embs)
28
+
29
+ # Compute Text-Video similarity.
30
+ # t2v_sim: float matrix of size [num_texts, num_videos] indicating similarity.
31
+ t2v_sim = v2t_sim.T
32
+
33
+ # Compute Video-Video distance.
34
+ # v2v_dists: float vector of size [1, num_videos] indicating distance to query video embedding.
35
+ v2v_dists = video_clip.compute_dist_videoq(model, video_embs[0], video_embs)
36
+ ```
37
+
38
+ For a more detailed demo of how to use the model, see the [colab](https://colab.research.google.com/drive/1kVzoQUS3phupujY-8Bym0nHezRRyd0YQ).