This project demonstrates a crowd counting model built with PyTorch and deployed using various frameworks such as Flask, FastAPI, Express.js, and others.
For non-Python-based frameworks like Express.js or deployment on mobile devices, the model needs to be converted into a cross-platform format.
One common approach is to use the Open Neural Network Exchange (ONNX) format.
- Use your existing PyTorch model architecture (usually implemented as a class).
- Load the trained PyTorch model weights (typically saved as a
.pthfile). - Export the PyTorch model to ONNX using
torch.onnx.export().
For detailed instructions on converting a PyTorch model to ONNX, please refer to the folder
00-convert-to-onnx.
I aim to demonstrate how to easily integrate PyTorch-based models into various software systems.
Currently, this project includes demonstrations using backend frameworks such as Flask, FastAPI, and Express.js.
In the near future, I plan to extend these demonstrations to native or mobile device deployment as well.