Comments (6)
Hi @voegtlel , thank you for the feature request. Can you detail exactly what you mean by a "file-like object"? What Python type would that be exactly? Thank you!
from vision.
Hi @NicolasHug,
sure, but I can only refer to the documentation of pyav
av.open(file, mode='r', **kwargs)
Main entrypoint to opening files/streams.Parameters:
file (str) β The file to open, which can be either a string or a file-like object.
Although I must admit, that this is misleading, because typing only states str
as type, but the documented string says, that file-like objects are allowed. I believe they refer to io, which is also what I'd understand:
The io module provides Pythonβs main facilities for dealing with various types of I/O. There are three main types of I/O: text I/O, binary I/O and raw I/O. These are generic categories, and various backing stores can be used for each of them. A concrete object belonging to any of these categories is called a file object. Other common terms are stream and file-like object.
from vision.
Do you think this is already handled by some of the private APIs like _read_video_from_memory
?
For context, the video decoders of torchvision aren't really maintained lately and we hope to provide better support for video decoding soon. It is possible for us to address some minor improvements as long as they're super easy, but big changes may not be in scope for torchvision. TBH, it's still not clear to me what exactly this feature request is about (i.e. what types need to be supported), so it's hard for me to give you a definite answer just yet
from vision.
I could imagine that this API could solve it as well. Effectively, this request is about allowing streams in the old api, which is not possible right now because of this line: https://github.com/pytorch/vision/blob/main/torchvision/io/video.py#L270 which expects a filename, but the pyav api could also handle a BytesIO
object. I.e. if that line would be like:
if not isinstance(filename, io.IOBase) and not os.path.exists(filename):
from vision.
Thanks for the details.
OK, I guess we can move the if not os.path.exists(filename):
within the if get_video_backend() != "pyav":
block and just let pyav do its own input checking.
from vision.
Related Issues (20)
- AttributeError: module 'torchvision.transforms' has no attribute 'v2' HOT 1
- Run all torchvision models in one script. HOT 1
- Build fails: error: unknown type name 'j_decompress_ptr' HOT 3
- Differences in CPU vs CUDA resize for uint8 images HOT 2
- Enable Video models for other tasks
- Can't use gaussian_blur if sigma is a tensor on gpu HOT 3
- Mask r-cnn training runs infinitely without output or error HOT 1
- detection AnchorGenerator Source code issues HOT 1
- Video Reader's get_metadata function fails on videos with sound HOT 3
- Difficulty building on macOS HOT 3
- -
- Typo at `permutate_channels`
- retinanet num_classes includes the background HOT 4
- MPS test jobs are failing HOT 3
- Add vision-language models HOT 1
- Add mobilenetv4 support and pretrained models? HOT 5
- cutmix alpha argument in references/classification/transforms.py HOT 1
- torchvision manywheel py 3.11, cuda failure HOT 6
- MacOS test job are failing and install `torch-2.2.0.dev20231010`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vision.