Skip to content
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

[documentation] video API documentation and wrapper #2778

Merged
merged 21 commits into from Oct 9, 2020

Conversation

bjuncek
Copy link
Contributor

@bjuncek bjuncek commented Oct 8, 2020

To be seen if it has impact on performance due to additional python binding

@codecov
Copy link

codecov bot commented Oct 8, 2020

Codecov Report

Merging #2778 into master will increase coverage by 0.27%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2778      +/-   ##
==========================================
+ Coverage   73.18%   73.45%   +0.27%     
==========================================
  Files          96       96              
  Lines        8417     8541     +124     
  Branches     1316     1338      +22     
==========================================
+ Hits         6160     6274     +114     
- Misses       1857     1873      +16     
+ Partials      400      394       -6     
Impacted Files Coverage Δ
torchvision/io/__init__.py 100.00% <100.00%> (ø)
torchvision/extension.py 63.07% <0.00%> (-5.11%) ⬇️
torchvision/ops/boxes.py 97.61% <0.00%> (+2.21%) ⬆️
torchvision/ops/deform_conv.py 75.94% <0.00%> (+4.98%) ⬆️
torchvision/ops/roi_pool.py 80.00% <0.00%> (+5.00%) ⬆️
torchvision/ops/ps_roi_pool.py 80.55% <0.00%> (+5.55%) ⬆️
torchvision/ops/roi_align.py 76.92% <0.00%> (+5.95%) ⬆️
torchvision/ops/ps_roi_align.py 80.00% <0.00%> (+6.66%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b217165...5503861. Read the comment docs.

Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I've left a set of comments, let me know what you think

torchvision/io/_video_opt.py Outdated Show resolved Hide resolved
torchvision/io/__init__.py Show resolved Hide resolved
torchvision/io/__init__.py Outdated Show resolved Hide resolved
torchvision/io/__init__.py Outdated Show resolved Hide resolved
Comment on lines +30 to +32
if _HAS_VIDEO_OPT:

class Video:
Copy link
Member

Choose a reason for hiding this comment

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

For a follow-up PR: given that we are wrapping our C++ class in a python class, we don't need to have this as is, and we can instead implement everything outside the guard, but have a guard at instantiation time.

Something like

if _HAS_VIDEO_OPT:
    def _has_video_opt():
        return True
else:
    def _has_video_opt():
        return False

class Video:
    def __init__(self, path, stream):
        # check if video_opt is available
        if not _has_video_opt():
            raise RuntimeError(...)
        ...

In here, we create a function _has_video_opt to make the class work with torchscript (which doesn't support globals).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added to the list of issues to address

torchvision/io/__init__.py Show resolved Hide resolved
docs/source/io.rst Outdated Show resolved Hide resolved
docs/source/io.rst Outdated Show resolved Hide resolved
docs/source/io.rst Outdated Show resolved Hide resolved
docs/source/io.rst Outdated Show resolved Hide resolved
Co-authored-by: Francisco Massa <fvsmassa@gmail.com>
Copy link
Member

@fmassa fmassa left a comment

Choose a reason for hiding this comment

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

Thanks!

@fmassa fmassa merged commit d537965 into pytorch:master Oct 9, 2020
bryant1410 pushed a commit to bryant1410/vision-1 that referenced this pull request Nov 22, 2020
* initial API documentation attempt

* test the docs

* initial commit

* updating test to match the registration

* adding the warning on unsucessful import

* Try to do conditional import

* Simple fix?

* clearing up docs

* docstring commit

* Adding types in arguments

Co-authored-by: Francisco Massa <fvsmassa@gmail.com>

* reverting warning commit

* addressing Francisco's comments

* Apply suggestions from code review

Co-authored-by: Francisco Massa <fvsmassa@gmail.com>

* Revert "reverting warning commit"

This reverts commit bd1a3dd.

* Revert "adding the warning on unsucessful import"

This reverts commit afef7df.

* remove warnings import

Co-authored-by: Francisco Massa <fvsmassa@gmail.com>
vfdev-5 pushed a commit to Quansight/vision that referenced this pull request Dec 4, 2020
* initial API documentation attempt

* test the docs

* initial commit

* updating test to match the registration

* adding the warning on unsucessful import

* Try to do conditional import

* Simple fix?

* clearing up docs

* docstring commit

* Adding types in arguments

Co-authored-by: Francisco Massa <fvsmassa@gmail.com>

* reverting warning commit

* addressing Francisco's comments

* Apply suggestions from code review

Co-authored-by: Francisco Massa <fvsmassa@gmail.com>

* Revert "reverting warning commit"

This reverts commit bd1a3dd.

* Revert "adding the warning on unsucessful import"

This reverts commit afef7df.

* remove warnings import

Co-authored-by: Francisco Massa <fvsmassa@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants