Unverified Commit dec8628d authored by Francisco Massa's avatar Francisco Massa Committed by GitHub
Browse files

Make read_video_meta_data_from_memory and read_video_from_memory private (#2077) (#2084)

Summary:
Pull Request resolved: https://github.com/pytorch/vision/pull/2077

Pull Request resolved: https://github.com/facebookresearch/SlowFast/pull/164

This is a follow-up diff from D18720474

We will be releasing a new version of torchvision soon and the signature of those functions is not ready yet, following my comment in https://our.intern.facebook.com/intern/diff/D18720474/?transaction_id=561239541337402



Reviewed By: stephenyan1231

Differential Revision: D20914571

fbshipit-source-id: 1a7560b8f8e46ab42ef376c50b494a4f73923e94
Co-authored-by: default avatarFrancisco Massa <fmassa@fb.com>
parent c89156ba
...@@ -1183,8 +1183,8 @@ class TestVideoReader(unittest.TestCase): ...@@ -1183,8 +1183,8 @@ class TestVideoReader(unittest.TestCase):
probe_result = torch.ops.video_reader.probe_video_from_memory(video_tensor) probe_result = torch.ops.video_reader.probe_video_from_memory(video_tensor)
self.check_probe_result(probe_result, config) self.check_probe_result(probe_result, config)
def test_read_video_meta_data_from_memory_script(self): def test_probe_video_from_memory_script(self):
scripted_fun = torch.jit.script(io.read_video_meta_data_from_memory) scripted_fun = torch.jit.script(io._probe_video_from_memory)
self.assertIsNotNone(scripted_fun) self.assertIsNotNone(scripted_fun)
for test_video, config in test_videos.items(): for test_video, config in test_videos.items():
...@@ -1205,7 +1205,7 @@ class TestVideoReader(unittest.TestCase): ...@@ -1205,7 +1205,7 @@ class TestVideoReader(unittest.TestCase):
audio_start_pts, audio_end_pts = 0, -1 audio_start_pts, audio_end_pts = 0, -1
audio_timebase_num, audio_timebase_den = 0, 1 audio_timebase_num, audio_timebase_den = 0, 1
scripted_fun = torch.jit.script(io.read_video_from_memory) scripted_fun = torch.jit.script(io._read_video_from_memory)
self.assertIsNotNone(scripted_fun) self.assertIsNotNone(scripted_fun)
for test_video, _config in test_videos.items(): for test_video, _config in test_videos.items():
...@@ -1219,6 +1219,7 @@ class TestVideoReader(unittest.TestCase): ...@@ -1219,6 +1219,7 @@ class TestVideoReader(unittest.TestCase):
width, width,
height, height,
min_dimension, min_dimension,
max_dimension,
[video_start_pts, video_end_pts], [video_start_pts, video_end_pts],
video_timebase_num, video_timebase_num,
video_timebase_den, video_timebase_den,
...@@ -1228,7 +1229,6 @@ class TestVideoReader(unittest.TestCase): ...@@ -1228,7 +1229,6 @@ class TestVideoReader(unittest.TestCase):
[audio_start_pts, audio_end_pts], [audio_start_pts, audio_end_pts],
audio_timebase_num, audio_timebase_num,
audio_timebase_den, audio_timebase_den,
max_dimension,
) )
# FUTURE: check value of video / audio frames # FUTURE: check value of video / audio frames
......
...@@ -11,8 +11,6 @@ from ._video_opt import ( ...@@ -11,8 +11,6 @@ from ._video_opt import (
) )
from .video import ( from .video import (
read_video, read_video,
read_video_from_memory,
read_video_meta_data_from_memory,
read_video_timestamps, read_video_timestamps,
write_video, write_video,
) )
...@@ -22,8 +20,6 @@ __all__ = [ ...@@ -22,8 +20,6 @@ __all__ = [
"write_video", "write_video",
"read_video", "read_video",
"read_video_timestamps", "read_video_timestamps",
"read_video_meta_data_from_memory",
"read_video_from_memory",
"_read_video_from_file", "_read_video_from_file",
"_read_video_timestamps_from_file", "_read_video_timestamps_from_file",
"_probe_video_from_file", "_probe_video_from_file",
......
...@@ -347,47 +347,3 @@ def read_video_timestamps(filename, pts_unit="pts"): ...@@ -347,47 +347,3 @@ def read_video_timestamps(filename, pts_unit="pts"):
pts = [x * video_time_base for x in pts] pts = [x * video_time_base for x in pts]
return pts, video_fps return pts, video_fps
def read_video_meta_data_from_memory(video_data):
# type: (torch.Tensor) -> VideoMetaData
return _video_opt._probe_video_from_memory(video_data)
def read_video_from_memory(
video_data, # type: torch.Tensor
seek_frame_margin=0.25, # type: float
read_video_stream=1, # type: int
video_width=0, # type: int
video_height=0, # type: int
video_min_dimension=0, # type: int
video_pts_range=(0, -1), # type: List[int]
video_timebase_numerator=0, # type: int
video_timebase_denominator=1, # type: int
read_audio_stream=1, # type: int
audio_samples=0, # type: int
audio_channels=0, # type: int
audio_pts_range=(0, -1), # type: List[int]
audio_timebase_numerator=0, # type: int
audio_timebase_denominator=1, # type: int
video_max_dimension=0, # type: int
):
# type: (...) -> Tuple[torch.Tensor, torch.Tensor]
return _video_opt._read_video_from_memory(
video_data,
seek_frame_margin,
read_video_stream,
video_width,
video_height,
video_min_dimension,
video_max_dimension,
video_pts_range,
video_timebase_numerator,
video_timebase_denominator,
read_audio_stream,
audio_samples,
audio_channels,
audio_pts_range,
audio_timebase_numerator,
audio_timebase_denominator,
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment