This respository has been hijacked to build the image classification program used by the OPS-SAT SmartCam app on the European Space Agency's OPS-SAT spacecraft. This is by no means a permanent solution. It is an overklill hack to take advantage of TensorFlow's Bazel build system so that the program can be quickly compiled for the spacecraft's ARM32 architecture.
The image classification source code is in the //tensorflow/lite/c
directory. The commands in the following instructions are executed from this repository's home directory.
During development you might want build the program with the default GNU toolchain so that you can run it in on your local environment:
bazel build -c opt //tensorflow/lite/c:image_classifier
You can build for the spacecraft's ARM32 architecture once you are ready to uplink the program to space:
bazel build --config=elinux_armhf -c opt //tensorflow/lite/c:image_classifier
Run the cleanup script. It will collect all required files into a single folder with the appropriate file structure:
./c_cleanup.sh
The cleanup script also writes a bash script that will create the expected symbolic links for the program. This script needs to be executed on the spacecraft after installing the app.
Commit the bin directory created by the cleanup script into the root directory of the OPS-SAT SmartCam GitHub repository. Follow the insturctions in that repo's README to deploy the app to the spacecraft.
The following needs to be moved to the OPS-SAT SmartCam GitHub repository:
- The compiled TensorFlow Lite C API library.
- The
main.c
image classifier source code. - The
ujpeg.cc
andujpeg.h
source code for jpeg decoding.
Afterwhich, a build script needs to be written to compile main.c
with the ARM32 GNU toolchain. For step 1, the TensorFlow Lite C API library can be compiled with Bazel:
./bazel build -c opt //tensorflow/lite/c:tensorflowlite_c