Spaces:
Running
on
L40S
Running
on
L40S
add log
Browse files- utils/dc_utils.py +2 -0
- video_depth_anything/video_depth.py +2 -0
utils/dc_utils.py
CHANGED
@@ -16,6 +16,7 @@ from decord import VideoReader, cpu
|
|
16 |
def read_video_frames(video_path, process_length, target_fps=-1, max_res=-1, dataset="open"):
|
17 |
|
18 |
vid = VideoReader(video_path, ctx=cpu(0))
|
|
|
19 |
original_height, original_width = vid.get_batch([0]).shape[1:3]
|
20 |
height = original_height
|
21 |
width = original_width
|
@@ -32,6 +33,7 @@ def read_video_frames(video_path, process_length, target_fps=-1, max_res=-1, dat
|
|
32 |
frames_idx = list(range(0, len(vid), stride))
|
33 |
if process_length != -1 and process_length < len(frames_idx):
|
34 |
frames_idx = frames_idx[:process_length]
|
|
|
35 |
frames = vid.get_batch(frames_idx).asnumpy()
|
36 |
|
37 |
return frames, fps
|
|
|
16 |
def read_video_frames(video_path, process_length, target_fps=-1, max_res=-1, dataset="open"):
|
17 |
|
18 |
vid = VideoReader(video_path, ctx=cpu(0))
|
19 |
+
print("==> original video shape: ", (len(vid), *vid.get_batch([0]).shape[1:]))
|
20 |
original_height, original_width = vid.get_batch([0]).shape[1:3]
|
21 |
height = original_height
|
22 |
width = original_width
|
|
|
33 |
frames_idx = list(range(0, len(vid), stride))
|
34 |
if process_length != -1 and process_length < len(frames_idx):
|
35 |
frames_idx = frames_idx[:process_length]
|
36 |
+
print(f"==> final processing shape: {len(frames_idx), *vid.get_batch([0]).shape[1:]}")
|
37 |
frames = vid.get_batch(frames_idx).asnumpy()
|
38 |
|
39 |
return frames, fps
|
video_depth_anything/video_depth.py
CHANGED
@@ -71,6 +71,8 @@ class VideoDepthAnything(nn.Module):
|
|
71 |
input_size = int(input_size * 1.78 / ratio)
|
72 |
input_size = round(input_size / 14) * 14
|
73 |
|
|
|
|
|
74 |
transform = Compose([
|
75 |
Resize(
|
76 |
width=input_size,
|
|
|
71 |
input_size = int(input_size * 1.78 / ratio)
|
72 |
input_size = round(input_size / 14) * 14
|
73 |
|
74 |
+
print(f'==> infer lower bound input size: {input_size}')
|
75 |
+
|
76 |
transform = Compose([
|
77 |
Resize(
|
78 |
width=input_size,
|