This is a desktop application that uses SqueezeNet, a pre-trained machine learning model, to detect the predominant object in an image selected by the user from a file.
Note: SqueezeNet was trained to work with image sizes of 224x224, so you must provide an image of size 224X224.
- Install Rustup
- Install cargo-winrt through command prompt. Until Rust 1.46 is released, cargo-winrt should be installed through the winrt-rs git repository.
cargo install --git https://github.com/microsoft/winrt-rs cargo-winrt
- This project requires Rust 1.46, which is currently in Beta. Rust release dates can be found here. Rust Beta features can be enabled by running the following commands through command prompt in this current project directory after installation of Rustup :
rustup install betarustup override set beta
- Install the WinRT nuget dependencies with this command:
cargo winrt install - Build the project by running
cargo buildfor debug andcargo build --releasefor release. - Run the sample by running this command through the command prompt.
cargo winrt run- Another option would be to run the executable directly. Should be
<git enlistment>\Samples\RustSqueezeNet\target\debug\rust_squeezenet.exe
- Another option would be to run the executable directly. Should be
C:\Repos\Windows-Machine-Learning\Samples\RustSqueezeNet> cargo winrt run
Finished installing WinRT dependencies in 0.47s
Finished dev [unoptimized + debuginfo] target(s) in 0.12s
Running `target\debug\rust_squeezenet.exe`
Loading model C:\Repos\Windows-Machine-Learning\RustSqueezeNet\target\debug\Squeezenet.onnx
Creating session
Loading image file C:\Repos\Windows-Machine-Learning\RustSqueezeNet\target\debug\kitten_224.png
Evaluating
Results:
tabby tabby cat 0.9314611
Egyptian cat 0.06530659
tiger cat 0.0029267797