Lenna Yolo Plugin
This plugin runs the yolo model to label objects in images.
Test it on lenna.app.
You can test the lib by detecting objects in two images.
cargo run
The results are:
wasm-pack test --node
The plugin can build python bindings.
Create a virtual environment for python.
virtualenv -p python3 .venv
source .venv/bin/activate
pip install .
Import lenna_mobilenet_plugin in a python environment.
from PIL import Image
from numpy import asarray
import lenna_yolo_plugin
print(lenna_yolo_plugin.description())
image = Image.open('assets/dog.jpg')
data = asarray(image)
print(data.shape)
config = lenna_yolo_plugin.default_config()
processed = lenna_yolo_plugin.process(config, data)
print(processed.shape)
Image.fromarray(processed).save('lenna_test_out.png')
Run the python test file which loads the lenna.png and converts it.
pip install pillow numpy
python src/test.py
Find an example in example.ipynb
pip install jupyter
jupyter notebook example.ipynb
The yolo model runs build with tract:
time cargo test default --release --no-default-features --features=yolo
real 0m0,499s
user 0m0,379s
sys 0m0,123s
The yolov8 model runs build with candle:
time cargo test default --release --no-default-features --features=yolo
real 0m0,660s
user 0m1,346s
sys 0m0,099s
The model is from tiny-yolov2 on onnx.
The class names are from voc names on darknet.
The yolov8 model is from Candle Yolo Example licensed under MIT.
"YOLO9000: Better, Faster, Stronger" arXiv:1612.08242