How to export maskdino into onnx format?
Hi Team, After initial evaluation am planning to export model into onnx format using detectron2 deploy tools.
But, Am running into following error, on build_model(cfg) call.
KeyError: "No object named 'MaskDINO' found in 'META_ARCH' registry!"
I made following changes in setup_cfg() method of export_model.py
def setup_cfg(args):
cfg = get_cfg()
# cuda context is initialized before creating dataloader, so we don't fork anymore
cfg.DATALOADER.NUM_WORKERS = 0
add_pointrend_config(cfg)
add_deeplab_config(cfg) # <---
add_maskdino_config(cfg) # <---
cfg.merge_from_file(args.config_file)
cfg.merge_from_list(args.opts)
cfg.freeze()
return cfg
Is there any way I can resolve this? Please guide me here.
Hi Team If I understand, I have to import maskdino somewhere in export_model.py right?
We did not try oonx before, so we could not offer any suggestions now.
Have you tried any other method for exporting model?
MaskDINO uses a lot of Mask2Former codes and Mask2Former currently won’t work with onnx.
Mask2Former actually can be export to onnx with opset version >= 16. But the prediction is just messed up.
If you want try, check demo/demo..py and demo/predictor.py. It creates a DefaultPredictor and DefaultPredictorhas an attribute model. This model is basically a PyTorch model. So you can export it to onnx using torch.onnx.export().
@MeAmarP did you resolve the issue?
Any progress on this? How would one deploy this model in production? Which exporting formats can this model be exported to?
I got the same error when I tried to convert my MASK DINO model to onnx using detectron export_model.py file. Any progress on this?