-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Passing OpenCV Mat as Tensorflow input #2220
Labels
Comments
Indexers are efficient: https://bytedeco.org/news/2014/12/23/third-release/ |
So something like this? I was wondering whether it would be better to pass a pointer to the Mat (and avoid loading the floats into java memory at all), but that didn't seem to work. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Firstly, thanks for a great project, it's fun to work with!
I have an
org.bytedeco.opencv.opencv_core.Mat
object that I have prepared into the correct shape, format & scaling to pass to a tensorflow lite model. I'm having trouble populating the model input tensor correctly.I've got it working by iterating over the rows and cols of the image and copying the image pixels one by one into a
float[]
and callinginput.put()
on the float array. However, that seems inefficient, and I was hoping that I could do something likeinput.put(image)
, but that isn't working, or at least the model outputs aren't correct.Could you give me any pointers (!) on how to efficiently copy/pass the Mat as a tensorflow input?
Thanks in advance.
The text was updated successfully, but these errors were encountered: