nielsr HF Staff commited on
Commit
c1faf11
·
1 Parent(s): 512c4e3

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +25 -0
README.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ This contains 16 frames of the "eating-spaghetti" video of the Kinetics-400 dataset, with the following frame indices being used: [164 168 172 176 181 185 189 193 198 202 206 210 215 219 223 227].
2
+
3
+ This is the code:
4
+
5
+ ```
6
+ from decord import VideoReader, cpu
7
+ from huggingface_hub import hf_hub_download
8
+ import numpy as np
9
+
10
+ file_path = hf_hub_download(
11
+ repo_id="nielsr/video-demo", filename="eating_spaghetti.mp4", repo_type="dataset"
12
+ )
13
+ vr = VideoReader(file_path, num_threads=1, ctx=cpu(0))
14
+
15
+ # get 16 frames
16
+ vr.seek(0)
17
+ indices = [164 168 172 176 181 185 189 193 198 202 206 210 215 219 223 227]
18
+
19
+ # create a list of NumPy arrays
20
+ video = [buffer[i] for i in range(buffer.shape[0])]
21
+
22
+ video_numpy = np.array(video)
23
+ with open('spaghetti_video.npy', 'wb') as f:
24
+ np.save(f, video_numpy)
25
+ ```