- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there!
I have a network to perform inference on with OpenVINO. The input data (images from file) should be normalized by subtracting mean and dividing by standard deviation, but the data comes from different sources and we normalize per source type, so the general "--mean_values" and "--scale_values" when converting the model to IR cannot be used since they hold constant values for all input images.
I think the way to go here is to do the normalization myself, which seems very easy since opencv allows for quick element-wise operations on Mat, but I have trouble with making a Blob of a float Mat to set as input for the InferRequest. I used wrapMat2Blob for uint8 Mats that imread returns, but I could not find a way to do something similar when the mat is of datatype float. Could anyone point me in the right direction on how to get this working? Thanks!
I'm working in C++ by the way :)
Kind regards,
Rutger
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Got it working with the following code, with input being a cv::Mat of type CV_32FC3
TensorDesc tDesc( Precision::FP32, { 1, (size_t)input.channels(), (size_t)input.size().height, (size_t)input.size().width }, Layout::NHWC ); Blob::Ptr imgBlob = make_shared_blob<float>(tDesc, (float*)input.data);
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Got it working with the following code, with input being a cv::Mat of type CV_32FC3
TensorDesc tDesc( Precision::FP32, { 1, (size_t)input.channels(), (size_t)input.size().height, (size_t)input.size().width }, Layout::NHWC ); Blob::Ptr imgBlob = make_shared_blob<float>(tDesc, (float*)input.data);
![](/skins/images/C4F7392A5C68ACA60290C9576F107044/responsive_peak/images/icon_anonymous_message.png)
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page