Skip to content
This repository has been archived by the owner on Oct 13, 2021. It is now read-only.

RuntimeError: Unexpected error on find the converter for op <class 'mrcnn.model.BatchNorm'> #715

Open
RyuAmakaze opened this issue May 25, 2021 · 1 comment

Comments

@RyuAmakaze
Copy link

RyuAmakaze commented May 25, 2021

I'm trying to convert a MaskRCNN model (.h5) to .onnx with keras2onnx.

Execution code
keras2onnx.convert_keras(model.keras_model, "test1.onnx", target_opset=11)

Error message
RuntimeError: Unexpected error on find the converter for op <class 'mrcnn.model.BatchNorm'>
MaskRCNN's BatchNorm corresponds to BatchNormalization in onnx's Operator Schemas,
but the names are different, so we get an error.

System information
OS Platform and Distribution : windows10
ONNX version : 1.9.0
Python version: : 3.7.10
keras2onnx : 1.8.0
tensorflow-gpu =1.14.0 (MaskRCNN is not well compatible with tf2.x.)
keras : 2.2.4

Reproduction instructions
using maskRCNN


import config
import mrcnn.model as modellib
import os
from mrcnn import utils

model = modellib.MaskRCNN(mode="training", config=config,
model_dir="logs/model")
config = Config()

MODEL_PATH = 'mask_all.h5'
model.load_weights(MODEL_PATH, by_name=True,
exclude=["mrcnn_class_logits", "mrcnn_bbox_fc",
"mrcnn_bbox", "mrcnn_mask"])

import keras2onnx
keras2onnx.convert_keras(model.keras_model, "mask_all.onnx", target_opset=11)

Expected behavior
Mask_all.onnx is generated by converting mask_all.h5.

@RyuAmakaze
Copy link
Author

Just edit operator definitions?
If it's solution, I would like to know how to edit the operator definition.

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

No branches or pull requests

1 participant