This project is a showcase of Deep leaarning
inference engine implemented as fullstack Rust web applications.
The Deep learning frameworks used by this application are PyTorch
and TensorFlow
.
Both frameworks are already ported to rust
from native C/C++
library. The purpose of this project is to build powerful fullstack webb application that has Deep Learning
capabilities. By leveraging rust
high performance web backend, the inference engine is way better than python
in term of performance and easy integration with frontend compared to C++
.
Features :
- Object detection : This feature uses
PyTorch
pretrained model generated byTorchScript
- Face detection : This features use
TensorFlow
pretrainedmtcnn
model.
links:
- https://cetra3.github.io/blog/face-detection-with-tensorflow-rust/
- https://github.com/cetra3/mtcnn
- https://github.com/LaurentMazare/tch-rs
This feature is a simple computer vision
image classification. Uploaded image will be feeded into PyTorch
pretrained model via REST
API. The backend will response the object detection results in a JSON format. Then, the front end
web displays it into the page. The result labels are displayed as list of chips
components between title and uploaded image
.
This project was bootstrapped with Create Rust App.
- stable Rust
- Diesel CLI
- if using postgres,
cargo install diesel_cli --no-default-features --features postgres
- if using sqlite,
cargo install diesel_cli --no-default-features --features sqlite-bundled
- if using postgres,
- cargo-watch to recompile on change:
cargo install cargo-watch
(allows runningcargo watch -x run -i frontend/
for continuous compilation; see "available scripts")
- In development, the
.env
file is read (use.env.example
for reference) - In production, environment variables are sourced directly
In the project directory, you can run:
Runs the app in development mode and watches for changes. Visit http://localhost:3000 to view it.
Any frontend changes should instantly appear. Backend changes will need to recompile.
Needs cargo-watch
installed, see requirements.
To test/debug issues with the production build, set the debug-assertions
to true
for [profile.dev]
in Cargo.toml
. This way, development-only code paths are discarded and instead, production-only code paths are included.
Alternatively, use cargo run
to run the app in development mode without watching for file changes.
Builds a production-ready build.
Generates the typescript types from rust code marked with tsync
.
Outputs to frontend/src/types/rust.d.ts
.
# frontend
cd frontend && yarn && yarn start
# backend
cargo watch -x run -i frontend/
-
diesel migration generate <migration_name>
-
diesel migration run
-
diesel migration revert
-
diesel database setup
-
diesel database reset
docker build -t image-name .
docker run -e SECRET_KEY=123 -e DATABASE_URL=postgres://postgres:postgres@localhost/database -p 3000:3000 image-name