-
Notifications
You must be signed in to change notification settings - Fork 24
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
Bug? Input tensor size mismatch for RGB image inference #150
Comments
I run the official example: |
|
I Fixed it. now: |
@Dong148, looks like you were running into the same essential problem as #143: using an older version of the bindings with a new version of the upstream library will surface some breaking changes that OpenVINO introduced. The plan is to add a version check in #149 that, once released, should prevent this confusion in the future. |
Summary:
I am encountering an issue where the input tensor size does not match the size of the RGB image data when attempting to perform inference using the openvino-rs library.
Code:
`
fn run_image_rbg(&mut self, image: &RgbImage) -> Result<Vec, OpenVINOInferSessionError> {
let (width ,height) = image.dimensions().into();
let (width,height) =(width as i64,height as i64);
`
Runtime error:
source slice length (847356) does not match destination slice length (317760)
Steps to Reproduce:
Load an PNG with dimensions 482x586 as RGBImage .
Create a Tensor with ElementType::U8 and Shape(586,482,3)
Prepare the image data, which results in a buffer of size 847356 (482 * 586 * 3).
Attempt to create an input tensor and copy the image data into it using the run_image_rbg function.
Expected Behavior:
The input tensor should be allocated with the correct size to accommodate the image data, and the data should be copied successfully without any errors.
Environment:
OS: CentOS Stream 9
openvino-rs: 0.7.3
rust: rustc 1.77.2 (25ef9e3d8 2024-04-09) (Red Hat 1.77.2-3.el9)
I have verified that the image dimensions and data size are correct. It appears that there might be an issue with tensor allocation within the library. Please assist in resolving this issue or provide guidance on any additional steps required to correctly prepare the input tensor.
I am a Rust beginner and there might be some misunderstandings or mistakes on my part while using the library. Could it be possible that there is an issue in my code that is causing this mismatch error? Your assistance and guidance would be greatly appreciated.
The text was updated successfully, but these errors were encountered: