hanleycolorlab / video2vision

Pipeline for producing animal-view videos
GNU General Public License v3.0
20 stars 0 forks source link

Video saving as .tif on windows, gives FileExistsError #1

Open QJamison opened 1 year ago

QJamison commented 1 year ago

Accidentally hit enter. Here is the issue and error code:

Cell #19 for video on Windows


FileExistsError Traceback (most recent call last) Cell In[19], line 19 16 line_pipe.set_batch_size(8) 18 line_pipe.set_all_paths(UV_PATH, VIS_PATH, ANIMAL_OUT_PATH, HUMAN_OUT_PATH) ---> 19 rtn = line_pipe.run() 21 print(tabulate(rtn.items()))

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\video2vision\pipeline.py:246, in Pipeline.run(self) 244 # Run the operator on the inputs. 245 try: --> 246 out = op'operator' 247 except ResetPipeline: 248 # Clear all inputs prior to returning to the start of 249 # the for loop. 250 op_times[op_name] += (time.perf_counter() - op_start)

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\video2vision\operators.py:119, in Operator.call(self, xs) 113 # copy performs a shallow copy. That is, if x is a dictionary, it 114 # creates a new dictionary, but the values are all the same as the 115 # original values. This avoids copying images - which would be wasteful 116 # of both memory and compute - but allows the apply method to modify 117 # the dictionary in-place. 118 xs = tuple(copy(_coerce_to_dict(x)) for x in xs) --> 119 return self.apply(xs)

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\video2vision\io.py:420, in Writer.apply(self, x) 418 else: 419 for t in range(image.shape[2]): --> 420 self._write(image[:, :, t, :], names[t])

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\video2vision\io.py:481, in Writer._write(self, image, name) 479 else: 480 if os.path.exists(path): --> 481 raise FileExistsError(path) 482 save(image, path)

FileExistsError: C:/My Pics/Work/GMU/Thesis/2023-07-31/WindowVid\humans\C0052-C0051.tif


Fixed by changing write_2_idx = line_pipe.add_operator(v2v.Writer()) to write_2_idx = line_pipe.add_operator(v2v.Writer(extension='mp4'))

Mark-Lowell commented 1 year ago

My apologies, I didn't see this for the longest time. I need to make a permanent fix for this, but as a temporary fix, go to that cell and change:

write_2_idx = line_pipe.add_operator(v2v.Writer())

To:

write_2_idx = line_pipe.add_operator(v2v.Writer(extension='mp4'))