Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tinyyolov3's test data is wrong #237

Closed
snnn opened this issue Nov 8, 2019 · 10 comments
Closed

Tinyyolov3's test data is wrong #237

snnn opened this issue Nov 8, 2019 · 10 comments

Comments

@snnn
Copy link
Contributor

snnn commented Nov 8, 2019

2019-11-08 12:48:51.317577463 [E:onnxruntime:Default, runner.cc:479 RunTaskImpl] tinyyolov3:output=yolonms_layer_1:2:expect tensor(float) got tensor(int32)
2019-11-08 12:48:51.317648314 [E:onnxruntime:Default, runner.h:76 finish] tinyyolov3: type mismatch. Dataset:/data/testdata/m/opset11/tinyyolov3/test_data_set_0

@snnn
Copy link
Contributor Author

snnn commented Nov 8, 2019

@SiR0N
Copy link

SiR0N commented Nov 11, 2019

Hi, I also face this problem with the model at running:
sess = rt.InferenceSession("yolov3tiny.onnx")

error:

 self._sess.load_model(path_or_bytes)
RuntimeError: [ONNXRuntimeError] : 10 : INVALID_GRAPH : Load model from yolov3tiny.onnx failed:Node:Resize Node (Resize) has input size 3 not in range [min=2, max=2].

@EmmaNingMS
Copy link
Contributor

@jiafatom

@jiafatom
Copy link
Contributor

Updated the test data and checked in here

@snnn snnn closed this as completed Nov 11, 2019
@jiafatom
Copy link
Contributor

@SiR0N you are using the old onnxruntime, the error msg shows the number of input for Resize is 2, however, opset 11 has changed this. Please use onnxruntime 1.0+ to test.

@snnn
Copy link
Contributor Author

snnn commented Nov 11, 2019

Hi @SiR0N
Which onnxruntime version were you using?

@SiR0N
Copy link

SiR0N commented Nov 12, 2019

hi, @jiafatom and @snnn I upgrade it to 1.0.0 and now it "works" (I used 0.4.0 before)

Now I face another problem, it is related to the inputs.

image_data = preprocess(image)
image_size = np.array([image.size[1], image.size[0]], dtype=np.float).reshape(1, 2)

def inference(sess, preprocessed_image, image_size):
 
    input_name = sess.get_inputs()[0].name
    input_name2 = sess.get_inputs()[1].name
    output_name0 = sess.get_outputs()[0].name
    output_name1 = sess.get_outputs()[1].name
    output_name2 = sess.get_outputs()[2].name


    boxes, scores, indices = sess.run([output_name0, output_name1, output_name2],
                                      {input_name: preprocessed_image, input_name2: image_size}) #error here

    return boxes, scores, indices

print(rt.__version__)
sess = rt.InferenceSession("yolov3tiny.onnx")


boxes, scores, indices = inference(sess, image_data, image_size)

Error:

return self._sess.run(output_names, input_feed, run_options)
onnxruntime.capi.onnxruntime_pybind11_state.InvalidArgument: [ONNXRuntimeError] : 2 : INVALID_ARGUMENT : Unexpected input data type. Actual: (class onnxruntime::NonOnnxType<double>) , expected: (class onnxruntime::NonOnnxType<float>)


@jiafatom
Copy link
Contributor

This error means that it needs a input of type float, but the data you provided is of type double, can you convert your data?

@SiR0N
Copy link

SiR0N commented Nov 12, 2019

I tried that and it did not work

boxes, scores, indices = sess.run([output_name0, output_name1, output_name2],
                                      {input_name: preprocessed_image.astype(float), input_name2: image_size.astype(float)})

and they are already float:

image = Image.open('dog.jpg')

image_data = preprocess(image)
image_size = np.array([image.size[1], image.size[0]], dtype=np.float).reshape(1, 2)

def preprocess(img):
    model_image_size = (416, 416)
    boxed_image = letterbox_image(img, tuple(reversed(model_image_size)))
    image_data = np.array(boxed_image, dtype='float32')
    image_data /= 255.
    image_data = np.transpose(image_data, [2, 0, 1])
    image_data = np.expand_dims(image_data, 0)
    
    return image_data

@jiafatom
Copy link
Contributor

Here is an example that we run every day and it works fine. Choose is_tiny_yolo=True

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants