lsrock1 / maskrcnn_benchmark.cpp

Implementation maskrcnn-benchmark, pytorch c++ frontend
MIT License
81 stars 23 forks source link

Will make a minimal standalone inference on model? #10

Open lucasjinreal opened 4 years ago

lucasjinreal commented 4 years ago

A minimal standalone forward c++ project would be better.

And directly trace model out using python branch.

lucasjinreal commented 4 years ago

Can we download the traced model or how do we traced c++ torch model from python repo?

lsrock1 commented 4 years ago

@jinfagang

  1. Practically you are right and initial purpose of this repo was minimal inference engine.
  2. I tried but couldn't export working model from python using only jit because of nms, sorting argorithm for max proposal, etc. So, i traced only backbone and head, others(out of deep learning) are implemented in c++.
lucasjinreal commented 4 years ago

@lsrock1 Do u trace from maskrcnn-benmark, do you have any fork on how to trace it? I think only backbone and head would be enough for inference.

lsrock1 commented 4 years ago

@jinfagang I am not sure this script is what you want. https://github.com/lsrock1/maskrcnn_benchmark.cpp/blob/master/python_utils/to_jit.py This python script saves weights separately. I loaded these files and merge in cpp.

lucasjinreal commented 4 years ago

Why do u save them separate? Does they can be traced into a single model?

lsrock1 commented 4 years ago

I couldn't because of untracable logic. Even If model can be traced in single model, logics must be replaced with cpp implementation, code will be dirty. I will upload minimal code only for inference.

gemmit commented 4 years ago

@lsrock1 can we just use the torch.jit.trace command to trace the maskrcnn detection model from torchvision? Had multiple issues while trying to do that. Did you try that already? A forward pass with the traced model should give the detections and masks as far as I understand. @jinfagang did you have any success in tracing from python trained weights to c++?