MCPcopy Create free account
hub / github.com/GZWSAMA/OnePoseviaGen / process_tensor

Function process_tensor

app.py:176–196  ·  view source on GitHub ↗
(video_path, fps)

Source from the content-addressed store, hash-verified

174 return video_tensor
175
176def process_tensor(video_path, fps):
177 # import decord
178 import torchvision.transforms as T
179 video_tensor = load_video_with_opencv(video_path)
180 # Resize to ensure minimum side is 336
181 h, w = video_tensor.shape[2:]
182 scale = 336 / min(h, w)
183 if scale < 1:
184 new_h, new_w = int(h * scale), int(w * scale)
185 video_tensor = T.Resize((new_h, new_w))(video_tensor)
186
187 video_tensor = video_tensor[::fps].float()[:MAX_FRAMES_OFFLINE]
188
189 # Move to GPU
190 video_tensor = video_tensor.cuda()
191 print(f"Video tensor shape: {video_tensor.shape}, device: {video_tensor.device}")
192
193 # run vggt
194 # process the image tensor
195 video_tensor = preprocess_image(video_tensor)[None]
196 return video_tensor
197
198def process_and_save_rgb(video_path, user_temp_dir, fps):
199 from torchvision.utils import save_image

Callers 2

process_and_save_rgbFunction · 0.85
gpu_run_trackerFunction · 0.85

Calls 5

preprocess_imageFunction · 0.90
printFunction · 0.85
load_video_with_opencvFunction · 0.70
floatMethod · 0.45
cudaMethod · 0.45

Tested by

no test coverage detected