The C++ frontend of PyTorch seems not completed to me. If we want to train a model in Python and deploy that model in C++, we have to do hard about code porting. And I think most likely is the part of data preprocessing which could be implemented by torchvision in Python, but it’s missing in C++.
torchvision package in Python mainly have 2 modules:
For C++ to use these,
torchvision.models I think may be easily ported by JIT. The painful part is the
torchvision.transform. If I used the code from the module in training phase, does it mean that I have to implement the same transforms in C++ now? Is the torchvision for C++ in schedule?
Indeed, torchvision C++ support isn’t matching Python support.
However, @ShahriarSS is doing some good work on it, so the gap is getting smaller.
My guess is that most people use OpenCV to do transforms or do them manually. (Personally, I incorporated things like “normalizing” into the traced/scripted model last time I did this.)
Hi Thomas. The progress in TorchVision’s C++ side: Models have been written and I will start working on Transforms soon.
Hi sshahriarSS, is there a github repo that you working on?
The models exist in TorchVision repository which can be installed using cmake.
Great, saw it already on the master branch
thanks for your work. Any update for Transforms in C++?
Hi @erict. It has been a while since I worked on torchvision and I have some incomplete PRs there. Unfortunately I don’t have the time to work on Transforms or other stuff right now.
ok i will try to do something by myself based on your work. If i get something useful i will share here. Have you some hints on which could be the best way? for example i’m planning to use opencv to do some transform. Do you think could be a good starting point?
@erict I suggest you open an issue in torchvision and discuss the design there and then start. This way you will know how to start and it’ll be approved by torchvision. Feel free to mention me so I can help.