Trying to do Object detection on a batch of images with different sizes.
I have 10 images in my batch:
from transformers import pipeline
from PIL import Image
# If doing CPU inference, set device="cpu" instead.
obj_detector = pipeline("object-detection", model="facebook/detr-resnet-50", device="cuda:0", do_pad=False)
outputs = obj_detector([Image.fromarray(image_array) for image_array in batch], top_k=1, batch_size=10)
batch
is a list of image numpy arrays with each image having a different height and width.
But run into this issue
RuntimeError: The expanded size of the tensor (1066) must match the existing size (800) at
non-singleton dimension 1. Target sizes: [1066, 1066]. Tensor sizes: [1066, 800]