You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to write a script to perform inference of a set of images from a tensorrt engine that I have generated from a model trained with pytorch (specifically an efficientnet B1) using this repository.
However, I am seeing that when doing the inference with the sample images the result is much worse using the engine than using the model directly in pytorch.
The problem seems to be in the preprocessing of the images, so I have looked at the methods that handle this to try to replicate it in my script and be able to preprocess the images before the engine does the inference. The problem is that I can't load any image because I get the following error when I run the code:
for i in image_list:
im = np.array(Image.open(i)).astype(np.float32)
im = cv2.imread(i).astype(np.float32)
im_preprocessed = tf_preprocessing.preprocess_image(im,
is_training=False,
use_bfloat16=False,
image_size=IMAGE_SIZE,
interpolation='bicubic')
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float).
Do you know how could I resolve this problem to preprocess my set of images and try to perform inference again?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I am trying to write a script to perform inference of a set of images from a tensorrt engine that I have generated from a model trained with pytorch (specifically an efficientnet B1) using this repository.
However, I am seeing that when doing the inference with the sample images the result is much worse using the engine than using the model directly in pytorch.
The problem seems to be in the preprocessing of the images, so I have looked at the methods that handle this to try to replicate it in my script and be able to preprocess the images before the engine does the inference. The problem is that I can't load any image because I get the following error when I run the code:
for i in image_list:
ValueError: Failed to convert a NumPy array to a Tensor (Unsupported object type float).
Do you know how could I resolve this problem to preprocess my set of images and try to perform inference again?
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions