- Rust 48.3%
- Kotlin 24.1%
- Typst 14.3%
- Python 10.5%
- Nix 2.8%
|
|
||
|---|---|---|
| app | ||
| gradle | ||
| model-python | ||
| model-rs | ||
| poster | ||
| .envrc | ||
| .gitattributes | ||
| .gitignore | ||
| build.gradle.kts | ||
| Cargo.lock | ||
| Cargo.toml | ||
| flake.lock | ||
| flake.nix | ||
| gradle.properties | ||
| gradlew | ||
| gradlew.bat | ||
| local.properties | ||
| logs.md | ||
| README.md | ||
| requirements.txt | ||
| settings.gradle.kts | ||
/!\ Validation is broken in model-rs.
Train
The whole repo uses https://www.kaggle.com/datasets/ronanpickell/b100-lego-detection-dataset.
To train, after unzipping the dataset, these are the commands ran:
Run pip install -r requirements.txt
model-python:
LIBTORCH=~/.local/lib/python3.11/site-packages/torch LIBTORCH_USE_PYTORCH=1 LD_LIBRARY_PATH=~/.local/lib/python3.11/site-packages/torch/lib LD_PRELOAD=~/.local/lib/python3.11/site-packages/torch/lib/libtorch_cuda.so python model-python/main.py train --data-path data/b200c-detection/ --epochs 40 --batch-size 50 --lr 1e-3 --no-pre-trained-weights
model-rs:
RUST_BACKTRACE=1 LIBTORCH=~/.local/lib/python3.11/site-packages/torch LIBTORCH_USE_PYTORCH=1 LD_LIBRARY_PATH=~/.local/lib/python3.11/site-packages/torch/lib LD_PRELOAD=~/.local/lib/python3.11/site-packages/torch/lib/libtorch_cuda.so cargo run --release -- train-faster-rcnn --data-path data/b200c-detection --epochs 40 --learning-rate 1e-3 --device=1 --batch-size=16
to run the android app, copy the generated mobile weights to the app's app/src/main/assets.
Last runs
I usually put the run logs in logs.md for future reference.
Run inference
To run inference,
model-python:
python model-python/main.py predict --model data/model-python/faster_rcnn.pt --classes-file data/model-python/classes.txt --image input.png --output-image output.png --threshold 0.7 --device -1
model-rs:
cargo run --release -- predict --model data/model-rs/faster_rcnn --image input.png --output-image output.png --num-classes 200 --classes-file data/model-rs/classes.txt --threshold 0.7