nine9
nine9

Reputation: 147

How to setup coremltools convert model output shape using yolo.h5

I try to convert h5 to iOS mlModel.

I follow Quick Start to get h5 file by this link.

https://github.com/qqwweee/keras-yolo3

Then, I use coremltools to convert h5 to mlModel

this is my code

mlModel = coremltools.converters.keras.convert('./yoloDone.h5',
                                            input_names='image',
                                            image_input_names='image',
                                            input_name_shape_dict={'image': [None, 416, 416, 3]})

But I find some error in output shape.

This is correct output.

enter image description here

This is my output, the type is not same.

enter image description here

The correct model, output1 is 255x13x13.

But my model, output1 is 1x1x255x13x13.

What should I do to edit ?

Upvotes: 0

Views: 622

Answers (1)

Matthijs Hollemans
Matthijs Hollemans

Reputation: 7892

1x1x255x13x13 is the same thing as 255x13x13 except that you have 5 dimensions instead of 3.

If you want the mlmodel to output 255x13x13, you'll have to fill in the output shape in the spec.description.output using coremltools.

Upvotes: 1

Related Questions