33def initialize (param ):
44 print ("Installing packages for vid_vec_rep_resnet" )
55
6- global TextBlob , os , np , cv2 , qr , torch , data , models , transforms , Image , FFmpeg , wget
7- global imagenet_transform , ImageListDataset , VideoAnalyzer , gendata , compress_video
6+ global TextBlob , os , np , cv2 , qr , torch , data , models , transforms , Image , wget #, FFmpeg
7+ global imagenet_transform , ImageListDataset , VideoAnalyzer , gendata # , compress_video
88
99 import os
1010 import numpy as np
@@ -15,7 +15,7 @@ def initialize(param):
1515 import torchvision .models as models
1616 import torchvision .transforms as transforms
1717 from PIL import Image
18- from ffmpy import FFmpeg
18+ # from ffmpy import FFmpeg
1919 import wget
2020
2121 imagenet_transform = transforms .Compose (
@@ -26,6 +26,7 @@ def initialize(param):
2626 ]
2727 )
2828
29+ '''
2930 def compress_video(fname):
3031 newname = "/tmp/compressed.mp4"
3132 FNULL = open(os.devnull, "w")
@@ -38,6 +39,8 @@ def compress_video(fname):
3839 ff.run(stdout=FNULL, stderr=FNULL)
3940 # os.remove(fname)
4041 return newname
42+ '''
43+
4144
4245 def gendata (vid_analyzer ):
4346 # average vector
@@ -205,11 +208,11 @@ def run(file):
205208 fname = file ["path" ]
206209 fsize = os .path .getsize (fname ) / 1e6
207210 print ("original size: " , fsize )
208- if fsize < 10 :
209- print ("compressing video" )
210- fname = compress_video (fname )
211- fsize = os .path .getsize (fname ) / 1e6
212- print ("compressed video size: " , fsize )
211+ # if fsize < 10:
212+ # print("compressing video")
213+ # fname = compress_video(fname)
214+ # fsize = os.path.getsize(fname) / 1e6
215+ # print("compressed video size: ", fsize)
213216 if fsize > 10 :
214217 raise Exception ("Video too large" )
215218
@@ -219,7 +222,7 @@ def run(file):
219222
220223 doable , error_msg = vid_analyzer .check_constraints ()
221224
222- os .remove (fname )
225+ # os.remove(fname)
223226
224227 if not doable :
225228 raise "Unsupported Video. Cannot index video."
0 commit comments