MobileFace icon indicating copy to clipboard operation
MobileFace copied to clipboard

port face detection to TVM

Open kaishijeng opened this issue 5 years ago • 12 comments

I attempted to port your trained model to TVM which is a good framework to speed up on arm device (like RK3399). Unfortunately, there are some operators in your model seem not supported in TVM.

"infer_range" and "_arange" are not supported in TVM. NotImplementedError: Operator: _arange is not supported in nnvm.

Can these 2 operators replaced by other operators?

Thanks.,

kaishijeng avatar Mar 27 '19 18:03 kaishijeng

@kaishijeng I'm not sure clearly where are used the operators of "infer_range" and "_arange" in my detection v1 model now. In fact, the detection v1 model is trained based on YOLOV3 code implemented by the official GluonCV. If you can port the official YOLOV3 model to TVM or can you try it firstly? My mode will also work if the official GluonCV YOLOV3 model can be ported rightly.

BTW, welcome to pull requests to share your TVM model for arm to this repo. :)

becauseofAI avatar Mar 28 '19 07:03 becauseofAI

Try to use gluon to downdload yolo3_mobilenet1.0_voc below: model_zoo.get_model('yolo3_mobilenet1.0_voc', pretrained=True)

It has an error: of Pretrained model for yolo3_mobilenet1_0_voc is not available as below:

Traceback (most recent call last): File "./demo_webcam.py", line 9, in net = gcv.model_zoo.get_model('yolo3_mobilenet1.0_voc', pretrained=True) File "build/bdist.linux-aarch64/egg/gluoncv/model_zoo/model_zoo.py", line 201, in get_model File "build/bdist.linux-aarch64/egg/gluoncv/model_zoo/yolo/yolo3.py", line 630, in yolo3_mobilenet1_0_voc File "build/bdist.linux-aarch64/egg/gluoncv/model_zoo/yolo/yolo3.py", line 476, in get_yolov3 File "build/bdist.linux-aarch64/egg/gluoncv/model_zoo/model_store.py", line 138, in get_model_file File "build/bdist.linux-aarch64/egg/gluoncv/model_zoo/model_store.py", line 108, in short_hash ValueError: Pretrained model for yolo3_mobilenet1_0_voc is not available.

kaishijeng avatar Mar 28 '19 08:03 kaishijeng

@kaishijeng yolo3_mobilenet1_0_voc download url is: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/models/yolo3_mobilenet1.0_voc-3b47835a.zip

It's an official bug. I have opened an issue to fix it.

becauseofAI avatar Mar 28 '19 11:03 becauseofAI

It works with your link. However, it has only *.param and TVM needs network definition in *.json so it can do the conversion

Thanks,

kaishijeng avatar Mar 28 '19 16:03 kaishijeng

@kaishijeng You can export the GluonCV format (*.params contains net and param together) to MXNet format (model is divided into *.json and *.params ) using the code: export_network.py

becauseofAI avatar Mar 29 '19 03:03 becauseofAI

Thanks fo r the export_network.py.

Same error with yolo3_mobile1.0_voc in tvm as below; NotImplementedError: Operator: _arange is not supported in nnvm.

kaishijeng avatar Mar 29 '19 04:03 kaishijeng

@kaishijeng So it seems that this problem needs to be solved by the official developers. You can open issues to the TVM and GluonCV community.

Good luck and look forward to feedback. :)

becauseofAI avatar Mar 29 '19 05:03 becauseofAI

port the model to ncnn is ok

aa12356jm avatar Apr 04 '19 14:04 aa12356jm

port the model to ncnn is ok

@aa12356jm Can you pull requests to share your nccn model for arm to this repo? :)

becauseofAI avatar Apr 30 '19 07:04 becauseofAI

ok,i will do it tomorrow

aa12356jm avatar Apr 30 '19 14:04 aa12356jm

Can you confirm what is the image size for 20ms/50 FPS metric calculation ?

mdv3101 avatar Jun 24 '19 12:06 mdv3101

Can you confirm what is the image size for 20ms/50 FPS metric calculation ?

Resize the image short edge to 256.

becauseofAI avatar Oct 11 '19 05:10 becauseofAI