| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
…ideo-v2 Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
|
|
||
|
|
||
| class VideoTensorMixin: | ||
| @staticmethod |
There was a problem hiding this comment.
maybe briefly explain why we went for a static method here
Sorry, something went wrong.
There was a problem hiding this comment.
In .validate() of VideoNdArray we want to call the validation for general VideoNdArray (by calling super().validate()), and secondly we want to add a video specific shape check (and respectively for torch). As far as I know it's not possible to specify in super() which parent class to go to, instead it just goes to through all the parent classes and stops when it find a corresponding method. Therefore we have to call the second check explicitly. When calling it as as VideoTensorMixin.validate() the information of the child class gets lost though, which we need to get the corresponding comp backend. Therefore the changes in the signature and to staticmethod.
Sorry, something went wrong.
There was a problem hiding this comment.
If you wan to use a specific superclass implementation, instead of using super() you can do something like:
SuperclassThatYouWant.foo(*inputs)Or if you need to pass the subclass cls:
SuperclassThatYouWant.foo.__func__(cls, *inputs)This unbinds foo from the class, so you can give it any cls argument that you want.
You can see this in the __class_getitem__ implementation of NdArray.
Sorry, something went wrong.
There was a problem hiding this comment.
oh nice, thanks! This works, but mypy complains:
docarray/typing/tensor/video/video_ndarray.py:34: error: "Callable[[VideoTensorMixin], VideoTensorMixin]" has no attribute "__func__" [attr-defined]
Do u know what to do here to satisfy mypy?
Sorry, something went wrong.
There was a problem hiding this comment.
Ah ok just saw that in __class_getitem__ of NdArray it is being ignored ( # type: ignore), will add that here too then
Sorry, something went wrong.
| comp_backend = cls.get_comp_backend() | ||
|
|
||
| if ( | ||
| comp_backend.n_dim(value) not in [3, 4] # type: ignore |
There was a problem hiding this comment.
why do we need to ignore the type ?
Sorry, something went wrong.
There was a problem hiding this comment.
Without it mypy complains, I think because value in validate_shape can be an instance of VideoTensor, in our use case either VideoNdArray or VideoTorchTensor but the .n_dim methods have a specified input class respectiveley to their comp backend (np.ndarray or torch.Tensor). Therefore mypy complains that value is not an NdArray for NumpyCompBackend.n_dim() (or torch tensor for torch comp backend):
docarray/typing/tensor/video/video_tensor_mixin.py:22: error: Argument 1 to "n_dim" of "TorchCompBackend" has incompatible type "T"; expected "Tensor" [arg-type]
docarray/typing/tensor/video/video_tensor_mixin.py:22: error: Argument 1 to "n_dim" of "NumpyCompBackend" has incompatible type "T"; expected "ndarray[Any, Any]" [arg-type]
Sorry, something went wrong.
There was a problem hiding this comment.
I think this is this issue that has to be fixed using the ugly overloads.
Sorry, something went wrong.
There was a problem hiding this comment.
@JohannesMessner need ur help there we did not manage to debug this. I don't understand why it is not working and why we have different TypeVar in AbstractCompBackend
Sorry, something went wrong.
There was a problem hiding this comment.
overload was not working here, because the Mixin should not know about the classes VideoNdArray and VideoTorchTensor
Sorry, something went wrong.
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
There was a problem hiding this comment.
I added some comments. PR looks great ! Looking forward to have video support
Sorry, something went wrong.
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
…ideo-v2 Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
No, still not so sure about this, I think that it is due to the encoding when storing to the file and decoding when reading from a file. I opened an issue on their Gitter as well as Github, but no response yet. I looked at a couple of examples over several iterations of loading and saving and for all it seemed to oscillate a little bit in the RGB values for the first 1 to 3 iterations, and then stayed the same. |
Sorry, something went wrong.
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
Signed-off-by: anna-charlotte <charlotte.gerhaher@jina.ai>
|
📝 Docs are deployed on https://ft-feat-add-video-v2--jina-docs.netlify.app 🎉 |
Sorry, something went wrong.
| """ | ||
|
|
||
| url: Optional[VideoUrl] | ||
| audio: Optional[Audio] = Audio() |
There was a problem hiding this comment.
why not None as a default value ?
Sorry, something went wrong.
There was a problem hiding this comment.
The .load() from VideoUrl returns an AudioNdArray (and some other stuff), which can't be written to video.audio.tensor if video.audio == None.
Sorry, something went wrong.
There was a problem hiding this comment.
okay makes sense
Sorry, something went wrong.
cannot approve bc of knee problem
| Back | FazBrowse Home | New Git URL |
Add support for video files to docarray v2
Goals: