Skip to content

Add support for flow batches in flow_to_image #5308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 28, 2022

Conversation

NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Jan 28, 2022

Follow up to #5134 and to #5091, this PR adds support for batches of flows to the flow_to_image() util.

CC @oke-aditya

@facebook-github-bot
Copy link

facebook-github-bot commented Jan 28, 2022

💊 CI failures summary and remediations

As of commit a1add53 (more details on the Dr. CI page):


  • 2/2 failures introduced in this PR

🕵️ 1 new failure recognized by patterns

The following CI failures do not appear to be due to upstream breakages:

See CircleCI build unittest_linux_gpu_py3.8 (1/1)

Step: "Run tests" (full log | diagnosis details | 🔁 rerun)

test/test_utils.py::test_flow_to_image_errors[i...type torch.float] �[33mSKIPPED�[0m�[31m [ 99%]�[0m
test/test_utils.py::test_draw_keypoints_colored[red] �[33mSKIPPED�[0m (We're ...)�[31m [ 99%]�[0m

test/test_utils.py::test_draw_keypoints_colored[#FF00FF] �[33mSKIPPED�[0m (We...)�[31m [ 99%]�[0m

test/test_utils.py::test_draw_keypoints_colored[colors2] �[33mSKIPPED�[0m (We...)�[31m [ 99%]�[0m

test/test_utils.py::test_draw_keypoints_errors �[33mSKIPPED�[0m (We're in a C...)�[31m [ 99%]�[0m

test/test_utils.py::test_flow_to_image[True] �[33mSKIPPED�[0m (We're in a Cir...)�[31m [ 99%]�[0m

test/test_utils.py::test_flow_to_image[False] �[33mSKIPPED�[0m (We're in a Ci...)�[31m [ 99%]�[0m

test/test_utils.py::test_flow_to_image_errors[input_flow0-Input flow should have shape] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_utils.py::test_flow_to_image_errors[input_flow1-Input flow should have shape] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_utils.py::test_flow_to_image_errors[input_flow2-Input flow should have shape] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_utils.py::test_flow_to_image_errors[input_flow3-Input flow should have shape] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_utils.py::test_flow_to_image_errors[input_flow4-Flow should be of dtype torch.float] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_video_gpu_decoder.py::TestVideoGPUDecoder::test_frame_reading �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_video_gpu_decoder.py::TestVideoGPUDecoder::test_seek_reading[/home/circleci/project/test/assets/videos/v_SoccerJuggling_g23_c01.avi-8.0-True] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_video_gpu_decoder.py::TestVideoGPUDecoder::test_seek_reading[/home/circleci/project/test/assets/videos/v_SoccerJuggling_g23_c01.avi-8.0-False] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_video_gpu_decoder.py::TestVideoGPUDecoder::test_seek_reading[/home/circleci/project/test/assets/videos/v_SoccerJuggling_g24_c01.avi-8.0-True] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_video_gpu_decoder.py::TestVideoGPUDecoder::test_seek_reading[/home/circleci/project/test/assets/videos/v_SoccerJuggling_g24_c01.avi-8.0-False] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_video_gpu_decoder.py::TestVideoGPUDecoder::test_seek_reading[/home/circleci/project/test/assets/videos/R6llTwEh07w.mp4-10.0-True] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_video_gpu_decoder.py::TestVideoGPUDecoder::test_seek_reading[/home/circleci/project/test/assets/videos/R6llTwEh07w.mp4-10.0-False] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_video_gpu_decoder.py::TestVideoGPUDecoder::test_seek_reading[/home/circleci/project/test/assets/videos/SOX5yA1l24A.mp4-11.0-True] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_video_gpu_decoder.py::TestVideoGPUDecoder::test_seek_reading[/home/circleci/project/test/assets/videos/SOX5yA1l24A.mp4-11.0-False] �[33mSKIPPED�[0m�[31m [ 99%]�[0m

test/test_video_gpu_decoder.py::TestVideoGPUDecoder::test_seek_reading[/home/circleci/project/test/assets/videos/WUzgd7C1pWA.mp4-11.0-True] �[33mSKIPPED�[0m�[31m [ 99%]�[0m


1 failure not recognized by patterns:

Job Step Action
CircleCI cmake_macos_cpu curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
sh conda.sh -b
source $HOME/miniconda3/bin/activate
conda install -yq conda-build cmake
packaging/build_cmake.sh
🔁 rerun

This comment was automatically generated by Dr. CI (expand for details).

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

Copy link
Contributor

@datumbox datumbox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

raise ValueError(f"Input flow should have shape (2, H, W), got {flow.shape}.")
orig_shape = flow.shape
if flow.ndim == 3:
flow = flow[None] # Add batch dim
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One small doubt.

Does this modify flow inplace?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the 2 objects may be a view on the same underlying memory, but they're different objects

In [1]: import torch
torch.tensor
In [2]: a = torch.tensor([1, 2])

In [3]: b = a[None]

In [4]: b is a
Out[4]: False

In [5]: a, b
Out[5]: (tensor([1, 2]), tensor([[1, 2]]))

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarification. Will note this.

@NicolasHug NicolasHug added module: utils other if you have no clue or if you will manually handle the PR in the release notes labels Jan 28, 2022
@NicolasHug NicolasHug merged commit 9fa8000 into pytorch:main Jan 28, 2022
facebook-github-bot pushed a commit that referenced this pull request Feb 3, 2022
Summary: flow bartches support.

Reviewed By: kazhang

Differential Revision: D33927500

fbshipit-source-id: b0cfa9f6d6ca2cb19f66a183755c488f495ece98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/default cla signed module: utils other if you have no clue or if you will manually handle the PR in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants