Muhammad Taqi Raza
commited on
Commit
·
e758433
1
Parent(s):
6f3d83d
video process resolution
Browse files
inference/v2v_data/demo.py
CHANGED
@@ -13,7 +13,7 @@ import torch.nn.functional as F
|
|
13 |
from transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
|
14 |
from qwen_vl_utils import process_vision_info
|
15 |
|
16 |
-
def get_center_crop_resolution(original_resoultion, target_aspect_ratio=(3, 4)):
|
17 |
target_h, target_w = target_aspect_ratio
|
18 |
aspect_ratio = target_w / target_h
|
19 |
|
@@ -24,8 +24,8 @@ def get_center_crop_resolution(original_resoultion, target_aspect_ratio=(3, 4)):
|
|
24 |
crop_w = original_w
|
25 |
crop_h = int(crop_w / aspect_ratio)
|
26 |
|
27 |
-
resized_h =
|
28 |
-
resized_w =
|
29 |
|
30 |
h_ratio = resized_h / original_h
|
31 |
w_ratio = resized_w / original_w
|
@@ -117,7 +117,7 @@ class GetAnchorVideos:
|
|
117 |
frame_shape = vr[0].shape # (H, W, 3)
|
118 |
ori_resolution = frame_shape[:2]
|
119 |
print(f"==> original video shape: {frame_shape}")
|
120 |
-
target_resolution = get_center_crop_resolution(ori_resolution)
|
121 |
print(f"==> target video shape resized: {target_resolution}")
|
122 |
|
123 |
prompt = self.get_caption(opts, opts.video_path)
|
|
|
13 |
from transformers import Qwen2_5_VLForConditionalGeneration, AutoTokenizer, AutoProcessor
|
14 |
from qwen_vl_utils import process_vision_info
|
15 |
|
16 |
+
def get_center_crop_resolution(original_resoultion, height = 576, width = 1024,target_aspect_ratio=(3, 4)):
|
17 |
target_h, target_w = target_aspect_ratio
|
18 |
aspect_ratio = target_w / target_h
|
19 |
|
|
|
24 |
crop_w = original_w
|
25 |
crop_h = int(crop_w / aspect_ratio)
|
26 |
|
27 |
+
resized_h = height # previous 576
|
28 |
+
resized_w = width # previous 1024
|
29 |
|
30 |
h_ratio = resized_h / original_h
|
31 |
w_ratio = resized_w / original_w
|
|
|
117 |
frame_shape = vr[0].shape # (H, W, 3)
|
118 |
ori_resolution = frame_shape[:2]
|
119 |
print(f"==> original video shape: {frame_shape}")
|
120 |
+
target_resolution = get_center_crop_resolution(original_resoultion = ori_resolution, height = opts.height, width = opts.width)
|
121 |
print(f"==> target video shape resized: {target_resolution}")
|
122 |
|
123 |
prompt = self.get_caption(opts, opts.video_path)
|