Skip to content

Commit

Permalink
Make read_video_meta_data_from_memory and read_video_from_memory priv…
Browse files Browse the repository at this point in the history
…ate (#2077) (#2084)

Summary:
Pull Request resolved: #2077

Pull Request resolved: facebookresearch/SlowFast#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: Francisco Massa <[email protected]>
  • Loading branch information
fmassa and fmassa committed Apr 9, 2020
1 parent 1ae7f5c commit b68adcf
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 52 deletions.
8 changes: 4 additions & 4 deletions test/test_video_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1183,8 +1183,8 @@ def test_probe_video_from_memory(self):
probe_result = torch.ops.video_reader.probe_video_from_memory(video_tensor)
self.check_probe_result(probe_result, config)

def test_read_video_meta_data_from_memory_script(self):
scripted_fun = torch.jit.script(io.read_video_meta_data_from_memory)
def test_probe_video_from_memory_script(self):
scripted_fun = torch.jit.script(io._probe_video_from_memory)
self.assertIsNotNone(scripted_fun)

for test_video, config in test_videos.items():
Expand All @@ -1205,7 +1205,7 @@ def test_read_video_from_memory_scripted(self):
audio_start_pts, audio_end_pts = 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)

for test_video, _config in test_videos.items():
Expand All @@ -1219,6 +1219,7 @@ def test_read_video_from_memory_scripted(self):
width,
height,
min_dimension,
max_dimension,
[video_start_pts, video_end_pts],
video_timebase_num,
video_timebase_den,
Expand All @@ -1228,7 +1229,6 @@ def test_read_video_from_memory_scripted(self):
[audio_start_pts, audio_end_pts],
audio_timebase_num,
audio_timebase_den,
max_dimension,
)
# FUTURE: check value of video / audio frames

Expand Down
4 changes: 0 additions & 4 deletions torchvision/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
)
from .video import (
read_video,
read_video_from_memory,
read_video_meta_data_from_memory,
read_video_timestamps,
write_video,
)
Expand All @@ -22,8 +20,6 @@
"write_video",
"read_video",
"read_video_timestamps",
"read_video_meta_data_from_memory",
"read_video_from_memory",
"_read_video_from_file",
"_read_video_timestamps_from_file",
"_probe_video_from_file",
Expand Down
44 changes: 0 additions & 44 deletions torchvision/io/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,47 +347,3 @@ def read_video_timestamps(filename, pts_unit="pts"):
pts = [x * video_time_base for x in pts]

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,
)

0 comments on commit b68adcf

Please sign in to comment.