Hello,
I am trying to use an object detector with ORTT, but getting a ValueError.
I tried out several object detectors like retinanet, SSD, DETR, and others. The error message is the same (ValueError: Invalid item in shape: floor...)
I have resized the input image to a fixed size like (300x300, 512x512, 800x800, or others) but still getting the same error.
Attached is the screenshot of my trace-back. I am using the docker image from the stable diffusion example: https://github.com/microsoft/onnxruntime-training-examples/tree/master/StableDiffusion-finetune (the training of stable diffusion works without an error).
Do you have an idea what is causing this issue and how to resolve it? Many thanks!
The code is:
from transformers import DetrForObjectDetection, DetrImageProcessor
import torch
from PIL import Image
import requests
from torch_ort import ORTModule
model = DetrForObjectDetection.from_pretrained("facebook/detr-resnet-50")
model = ORTModule(model)
image_processor = DetrImageProcessor.from_pretrained("facebook/detr-resnet-50")
model.eval()
url = "http://images.cocodataset.org/val2017/000000039769.jpg"
image = Image.open(requests.get(url, stream=True).raw)
image = image.resize((800, 800))
inputs = image_processor(images=image, return_tensors="pt")
with torch.no_grad():
outputs = model(**inputs)
