rubenvillegas / iclr2017mcnet

Tensorflow implementation of the ICLR 2017 paper: Decomposing Motion and Content for Natural Video Sequence Prediction

Home Page:https://sites.google.com/a/umich.edu/rubenevillegas/iclr2017

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RuntimeError

mengyaaa opened this issue · comments

When I ran this code, I encountered the following problem: RuntimeError: The ffmpeg plugin does not work on Python 2.x,but when I input: python then: import ffmpeg,there is no problem,I can't figure out the reason, can someone help me?thx~

The whole error message is:
Traceback (most recent call last):
File "train_kth.py", line 180, in
main(**vars(args))
File "train_kth.py", line 98, in main
for f,p,img_sze,k,t in zip(tfiles,paths,shapes,Ks, Ts))
File "/usr/lib/python2.7/dist-packages/joblib/parallel.py", line 810, in call
self.retrieve()
File "/usr/lib/python2.7/dist-packages/joblib/parallel.py", line 757, in retrieve
raise exception
joblib.my_exceptions.JoblibRuntimeError: JoblibRuntimeError


Multiprocessing exception:
...........................................................................
/home/lab226/Desktop/iclr2017mcnet-master/src/train_kth.py in ()
175 default=100000, help="Number of iterations")
176 parser.add_argument("--gpu", type=int, nargs="+", dest="gpu", required=True,
177 help="GPU device id")
178
179 args = parser.parse_args()
--> 180 main(**vars(args))
181
182
183
184

...........................................................................
/home/lab226/Desktop/iclr2017mcnet-master/src/train_kth.py in main(lr=0.0001, batch_size=8, alpha=1.0, beta=0.02, image_size=128, K=10, T=10, num_iter=100000, gpu=[3])
93 Ks = np.repeat(np.array([K]),batch_size,axis=0)
94 paths = np.repeat(data_path, batch_size,axis=0)
95 tfiles = np.array(trainfiles)[batchidx]
96 shapes = np.repeat(np.array([image_size]),batch_size,axis=0)
97 output = parallel(delayed(load_kth_data)(f, p,img_sze, k, t)
---> 98 for f,p,img_sze,k,t in zip(tfiles,paths,shapes,Ks, Ts))
f = <open file '../data/KTH/train_data_list_trimmed.txt', mode 'r'>
tfiles = array(['person01_walking_d4 282 362\n', 'person0...son01_walking_d4 171 247\n'],
dtype='|S33')
paths = array(['../data/KTH/', '../data/KTH/', '../data/.../data/KTH/', '../data/KTH/'],
dtype='|S12')
shapes = array([128, 128, 128, 128, 128, 128, 128, 128])
Ks = array([10, 10, 10, 10, 10, 10, 10, 10])
Ts = array([10, 10, 10, 10, 10, 10, 10, 10])
99 for i in xrange(batch_size):
100 seq_batch[i] = output[i][0]
101 diff_batch[i] = output[i][1]
102

...........................................................................
/usr/lib/python2.7/dist-packages/joblib/parallel.py in call(self=Parallel(n_jobs=8), iterable=<generator object >)
805 if pre_dispatch == "all" or n_jobs == 1:
806 # The iterable was consumed all at once by the above for loop.
807 # No need to wait for async callbacks to trigger to
808 # consumption.
809 self._iterating = False
--> 810 self.retrieve()
self.retrieve = <bound method Parallel.retrieve of Parallel(n_jobs=8)>
811 # Make sure that we get a last message telling us we are done
812 elapsed_time = time.time() - self._start_time
813 self._print('Done %3i out of %3i | elapsed: %s finished',
814 (len(self._output), len(self._output),


Sub-process traceback:

RuntimeError Tue Feb 26 13:15:35 2019
PID: 6435 Python 2.7.12: /usr/bin/python2
...........................................................................
/usr/lib/python2.7/dist-packages/joblib/parallel.py in call(self=<joblib.parallel.BatchedCalls object>)
67 def init(self, iterator_slice):
68 self.items = list(iterator_slice)
69 self._size = len(self.items)
70
71 def call(self):
---> 72 return [func(*args, **kwargs) for func, args, kwargs in self.items]
func =
args = ('person01_walking_d4 282 362\n', '../data/KTH/', 128, 10, 10)
kwargs = {}
self.items = [(, ('person01_walking_d4 282 362\n', '../data/KTH/', 128, 10, 10), {})]
73
74 def len(self):
75 return self._size
76

...........................................................................
/home/lab226/Desktop/iclr2017mcnet-master/src/utils.py in load_kth_data(f_name='person01_walking_d4 282 362\n', data_path='../data/KTH/', image_size=128, K=10, T=10)
88
89 def load_kth_data(f_name, data_path, image_size, K, T):
90 flip = np.random.binomial(1,.5,1)[0]
91 tokens = f_name.split()
92 vid_path = data_path + tokens[0] + "_uncomp.avi"
---> 93 vid = imageio.get_reader(vid_path,"ffmpeg")
vid = undefined
vid_path = '../data/KTH/person01_walking_d4_uncomp.avi'
94 low = int(tokens[1])
95 high = np.min([int(tokens[2]),vid.get_length()])-K-T+1
96 if low == high:
97 stidx = 0

...........................................................................
/home/lab226/.local/lib/python2.7/site-packages/imageio/core/functions.py in get_reader(uri='../data/KTH/person01_walking_d4_uncomp.avi', format=<Format FFMPEG - Many video formats and cameras (via ffmpeg)>, mode='?', **kwargs={})
138 raise ValueError(
139 "Could not find a format to read the specified file " "in mode %r" % mode
140 )
141
142 # Return its reader object
--> 143 return format.get_reader(request)
format.get_reader = <bound method FfmpegFormat.get_reader of <Format...G - Many video formats and cameras (via ffmpeg)>>
request = <imageio.core.request.Request object>
144
145
146 def get_writer(uri, format=None, mode="?", **kwargs):
147 """ get_writer(uri, format=None, mode='?', **kwargs)

...........................................................................
/home/lab226/.local/lib/python2.7/site-packages/imageio/core/format.py in get_reader(self=<Format FFMPEG - Many video formats and cameras (via ffmpeg)>, request=<imageio.core.request.Request object>)
159 select_mode = request.mode[1] if request.mode[1] in "iIvV" else ""
160 if select_mode not in self.modes:
161 raise RuntimeError(
162 "Format %s cannot read in mode %r" % (self.name, select_mode)
163 )
--> 164 return self.Reader(self, request)
self.Reader = <class 'imageio.plugins.ffmpeg.Reader'>
self = <Format FFMPEG - Many video formats and cameras (via ffmpeg)>
request = <imageio.core.request.Request object>
165
166 def get_writer(self, request):
167 """ get_writer(request)
168

...........................................................................
/home/lab226/.local/lib/python2.7/site-packages/imageio/core/format.py in init(self=<imageio.plugins.ffmpeg.Reader object>, format=<Format FFMPEG - Many video formats and cameras (via ffmpeg)>, request=<imageio.core.request.Request object>)
209 self.__closed = False
210 self._BaseReaderWriter_last_index = -1
211 self._format = format
212 self._request = request
213 # Open the reader/writer
--> 214 self._open(**self.request.kwargs.copy())
self._open = <bound method Reader._open of <imageio.plugins.ffmpeg.Reader object>>
self.request.kwargs.copy =
215
216 @Property
217 def format(self):
218 """ The :class:.Format object corresponding to the current

...........................................................................
/home/lab226/.local/lib/python2.7/site-packages/imageio/plugins/ffmpeg.py in _open(self=<imageio.plugins.ffmpeg.Reader object>, loop=False, size=None, dtype=None, pixelformat=None, print_info=False, ffmpeg_params=None, input_params=None, output_params=None, fps=None)
255 input_params=None,
256 output_params=None,
257 fps=None,
258 ):
259 # Get generator functions
--> 260 self._ffmpeg_api = _get_ffmpeg_api()
self._ffmpeg_api = undefined
261 # Process input args
262 self._arg_loop = bool(loop)
263 if size is None:
264 self._arg_size = None

...........................................................................
/home/lab226/.local/lib/python2.7/site-packages/imageio/plugins/ffmpeg.py in _get_ffmpeg_api()
56
57 def _get_ffmpeg_api():
58 global _ffmpeg_api
59 if _ffmpeg_api is None:
60 if sys.version_info < (3,):
---> 61 raise RuntimeError("The ffmpeg plugin does not work on Python 2.x")
62 try:
63 import imageio_ffmpeg
64 except ImportError:
65 raise ImportError(

RuntimeError: The ffmpeg plugin does not work on Python 2.x

When I ran this code, I encountered the following problem: RuntimeError: The ffmpeg plugin does not work on Python 2.x,but when I input: python then: import ffmpeg,there is no problem,I can't figure out the reason, can someone help me?thx~

Do you have multiple versions of python installed on your machine? If so, the 'python' command may be linked to python 3.x, thus the ffmpeg can be successfully imported.

I will go ahead and close the issue since it was related to your machine setup, and it seems @u112358 helped. Thanks @u112358!!

Hello. I also faced this problem. My python is 2.7.12 which is run under a virtual environment. I installed all requirements including ffmpeg installed with conda. And I cannot pip install imageio-ffmpeg because it only supports python 3.4+. How did you resolve it ? Thank you very much !

i just can't figure out how @u112358 's method, run python2 and link python3?
so i just gave up.

I try to use Python 3 instead, and some tweaks.
xrange->range
def deconv2d
output_shape=np.int32(out_shape), ---> add np.int32()

and it seems it can run smoothly
(test on test_ucf101.py only, results seems ok)

btw, i also need, conda install -c conda-forge imageio-ffmpeg
no matter python2 or python3