Hello intel team,
I've used openvinotoolkit/training_extensions/pytorch_toolkit/instance_segmentation/ to train an instance segmentation model with the following command:
python3 tools/train.py --dataset coco2017 --max_image_size 480 640 --bs 8 --bs_per_gpu 2 --lr 0.02 --max_iter 1000 --drop_lr 60000 80000 --model segmentoly.rcnn.model_zoo.resnet_fpn_mask_rcnn.ResNeXt152FPNMaskRCNN --load_backbone data/pretrained_models/converted/imagenet/detectron/resnext152.pth
but when I try to convert to onnx with the script provided in the training extensions:
python3 tools/convert_to_onnx.py --model segmentoly.rcnn.model_zoo.resnet_fpn_mask_rcnn.ResNeXt152FPNMaskRCNN --ckpt outputs/MaskRCNN/Oct28-21-05-30/ckpt/model_step_1000.pth --input_size 480 640 -nc 2 --show_flops --output_file openvino_mrcnn.onnx
I get the following error:
RuntimeError: tuple appears in op that does not forward tuples, unsupported kind: prim::PythonOp (VisitNode at /pytorch/torch/csrc/jit/passes/lower_tuples.cpp:135)
In some pytorch forums I read that it could be because of the DataParallel used in the training, I've changed it but got the same result.
any idea what it could be ?
Thanks in advance.
Greetings,
From the source that you were referring, it seems that these are validated with:
I'm not sure whether if you are using newer versions of any of this would be the cause.
Anyway, you can cross check your steps with this: https://www.youtube.com/watch?v=wmRNqg_7Eo0
Sincerely,
Iffa
In addition to that, try to run the demo on their PyTorch model and then do the evaluation.
Command examples are below.
$ python3 tools/demo.py \
--dataset coco_2017_val \
--ckpt data/pretrained_models/converted/coco/detectron/mask_rcnn_resnet50_fpn_2x.pth \
--mean_pixel 102.9801 115.9465 122.7717 \
--fit_window 800 1333 \
--video 0 \
--delay 1 \
--show_fps \
pytorch \
--model segmentoly.rcnn.model_zoo.resnet_fpn_mask_rcnn.ResNet50FPNMaskRCNN \
--show_flops
$ python3 tools/test.py \
--dataset coco_2017_val \
--ckpt data/pretrained_models/converted/coco/detectron/mask_rcnn_resnet50_fpn_2x.pth \
--mean_pixel 102.9801 115.9465 122.7717 \
--fit_max 800 1333 \
pytorch \
--model segmentoly.rcnn.model_zoo.resnet_fpn_mask_rcnn.ResNet50FPNMaskRCNN \
--show_flops
Also, the workaround for DataParallel from PyTorch forums as OpenVINO here just utilizes PyTorch capabilities might be correct. Please see this topic https://github.com/pytorch/pytorch/issues/13397
Sincerely,
Iffa
Greetings,
Intel will no longer monitor this thread since we have provided a solution. If you need any additional information from Intel, please submit a new question.
Sincerely,
Iffa
For more complete information about compiler optimizations, see our Optimization Notice.