Update app.py
Browse files
app.py
CHANGED
@@ -40,10 +40,10 @@ helper = DeepCacheSDHelper(pipe=pipe)
|
|
40 |
helper.set_params(
|
41 |
# cache_interval means the frequency of feature caching, specified as the number of steps between each cache operation.
|
42 |
|
43 |
-
cache_interval=
|
44 |
|
45 |
# cache_branch_id identifies which branch of the network (ordered from the shallowest to the deepest layer) is responsible for executing the caching processes.
|
46 |
-
cache_branch_id=
|
47 |
|
48 |
# Opting for a lower cache_branch_id or a larger cache_interval can lead to faster inference speed at the expense of reduced image quality
|
49 |
#(ablation experiments of these two hyperparameters can be found in the paper).
|
@@ -65,7 +65,9 @@ def export_to_video_file(video_frames, output_video_path=None, fps=10):
|
|
65 |
elif isinstance(video_frames[0], Image.Image):
|
66 |
video_frames = [np.array(frame) for frame in video_frames]
|
67 |
|
68 |
-
# Use VP9 codec
|
|
|
|
|
69 |
fourcc = cv2.VideoWriter_fourcc(*'VP90')
|
70 |
h, w, c = video_frames[0].shape
|
71 |
video_writer = cv2.VideoWriter(output_video_path, fourcc, fps, (w, h), True)
|
|
|
40 |
helper.set_params(
|
41 |
# cache_interval means the frequency of feature caching, specified as the number of steps between each cache operation.
|
42 |
|
43 |
+
cache_interval=4,
|
44 |
|
45 |
# cache_branch_id identifies which branch of the network (ordered from the shallowest to the deepest layer) is responsible for executing the caching processes.
|
46 |
+
cache_branch_id=1,
|
47 |
|
48 |
# Opting for a lower cache_branch_id or a larger cache_interval can lead to faster inference speed at the expense of reduced image quality
|
49 |
#(ablation experiments of these two hyperparameters can be found in the paper).
|
|
|
65 |
elif isinstance(video_frames[0], Image.Image):
|
66 |
video_frames = [np.array(frame) for frame in video_frames]
|
67 |
|
68 |
+
# Use VP9 codec - don't freak out: yes, this will throw an exception, but this still works
|
69 |
+
# https://stackoverflow.com/a/61116338
|
70 |
+
# I suspect there is a bug somewhere and the actual hex code should be different
|
71 |
fourcc = cv2.VideoWriter_fourcc(*'VP90')
|
72 |
h, w, c = video_frames[0].shape
|
73 |
video_writer = cv2.VideoWriter(output_video_path, fourcc, fps, (w, h), True)
|