DEV Community

Yuki Kimoto
Yuki Kimoto

Posted on

How to generate an executable file for an AI program using SPVM ?

Wouldn't you like to output a single executable file from your AI program? Then, you can run the AI โ€‹โ€‹program just by copying the executable file to the Raspberry Pi. Here's how to achieve this using SPVM. Here's an example of image recognition using MINIST as an example of AI using deep learning.

SPVM program

This is an AI program to recognize images using MINIST data.

It is writen by SPVM and SPVM::R.

Install dependent modules.

cpanm SPVM
cpanm SPVM::Errno
cpanm SPVM::File::Basename
cpanm SPVM::File::Spec
cpanm SPVM::FindBin
cpanm SPVM::Math
cpanm SPVM::Regex
cpanm SPVM::Sys
cpanm SPVM::Time::Local
cpanm SPVM::Time::Piece
cpanm SPVM::IO
cpanm SPVM::R

Execute an SPVM program.

spvm -I network_lib/SPVM my_minist_app.spvm

Generate an executable file and execute it.

spvmcc -I network_lib/SPVM -o my_minist_app my_minist_app.spvm

./my_minist_app

I'm not an AI expert, but if you are, I think you can modify this.

If you're interested in parallelization using threads and goroutines, see also:

Top comments (1)

Collapse
 
yukikimoto profile image
Yuki Kimoto

Please feel free to comment.