- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi,
I was following this Hello Classification C++ example and rather than reading a raw image, wanted to read an already saved tensor file eg. this file (this is from an example about using wasi-nn and uses this tool to convert image into a tensor file) and perform the inference.
I tried changing the lines 515-60 in this code to the following (basically reading raw bytes of the file and create the Tensor object):
But on running this it just gives a Segmentation Fault at this step
Weirdly, I tried to do a similar thing in Python (as shown below) and it works perfectly.
Any suggestions on how I can go about making it work?
Link kopiert
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi Omkar2,
Thanks for reaching out to us.
I’ve validated Hello Classification Python Sample by loading image file (tensor format) as input data.
Could you please share your C++ inference script with us for replication purposes?
Regards,
Wan
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi Wan
Have attached the C++ file, most things are the same as the Hello Classification example but some arguments have been added . Once compiled the usage should be as follows:
`./hello_classification <model_root_path> <model_name> <tensor_file_path> <tensor_height> <tensor_width> <precision> <device>`
eg. `./hello_classification public/mobilenet-v2/FP32 mobilenet-v2 tensor-1x224x224x3-f32.bgr 224 224 f32 CPU`
Please do let me know if any other information will help!
Thanks,
Omkar
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi Omkar2,
Thanks for sharing your information with us.
We encountered the same issue when running your custom Hello Classification C++ sample. We’re investigating this issue and we’ll get back to you at the earliest.
Regards,
Wan
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi Omkar2,
Thank you for your patience, we do suggest to change infer_request.set_input_tensor(input_tensor) in Step 7 to infer_request.get_input_tensor() while importing the tensor file.
ov::InferRequest allows you to get input/output tensors by tensor name, index, port, and without any arguments, if a model has only one input or output.
Additional information can be obtained in OpenVINO™ Inference Request. Thank you.
Regards,
Wan
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi Wan,
Thanks for getting back. I didn't quite understand how get_input_tensor() helps when we need to give our input tensor.
If you could share the code (main.cpp) that you used to make this work with the tensor file, it would be really helpful.
Thanks,
Omkar
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi Wan,
The get_input_tensor() definitely doesn't work (as it a getter method). The model just uses some default tensor value and produces the output, if you use another tensor file it will produce the same results (see the screenshots below as tested).
Please do let me know if there is any solution to fix the set_input_tensor method.
Thanks,
Omkar
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi Omkar2,
Thanks for your information.
We encountered the same issue as you when using the get_input_tensor() with another image as an input. We're investigating this issue and we'll update you at the earliest.
Regards,
Wan
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi Okmar2,
Thanks for your patience.
Segmentation fault is a specific kind of error caused by accessing memory, there is a discussion on segmentation fault can be found in https://stackoverflow.com/questions/2346806/what-is-a-segmentation-fault/2346849#2346849
It is suggested to remove "&" in ov::Tensor input_tensor = ov::Tensor(input_type, input_shape, data);.
The "&" may be one of the reasons caused the segmentation fault error previously.
Thank you.
Regards,
Wan
- Als neu kennzeichnen
- Lesezeichen
- Abonnieren
- Stummschalten
- RSS-Feed abonnieren
- Kennzeichnen
- Anstößigen Inhalt melden
Hi Omkar2,
Thanks for your question.
This thread will no longer be monitored since we have provided information.
If you need any additional information from Intel, please submit a new question.
Best regards,
Wan
- RSS-Feed abonnieren
- Thema als neu kennzeichnen
- Thema als gelesen kennzeichnen
- Diesen Thema für aktuellen Benutzer floaten
- Lesezeichen
- Abonnieren
- Drucker-Anzeigeseite