Error in pre-processing of the test_images

hii @nvidias

I am trying to load an classification engine model in python script and pass an image directory which contains sub-folders (sub-folders are different classes) after running the script getting error:
Traceback (most recent call last):
File “”, line 116, in
test_case = load_normalized_test_case(test_image, h_input)
File “”, line 59, in load_normalized_test_case
np.copyto(pagelocked_buffer, normalize_image(
File “”, line 50, in normalize_image
image_arr = np.asarray(image.resize((w, h), Image.ANTIALIAS)).transpose([2, 0, 1]) .astype(trt.nptype(trt.float32)).ravel()
ValueError: axes don’t match array

I am attaching my scrip here (5.0 KB)
Any help will be appreciable

Please check if your images are 1 channel or 3 channels.

@Morganh hii
my images are of 3 channels.
what should I implement?

First, make sure TensorRT/samples/python/introductory_parser_samples at master · NVIDIA/TensorRT · GitHub can run successfully against your images.

1 Like

link which you have shared here I can pass .engine model instead of uff and onxx?

Refer to Inferring resnet18 classification etlt model with python - #12 by Morganh

@Morganh hey … thanks
able to run it.