Skip to content

Run AI inference

An existing inference service can run as an OCI image in SpaceOS and route its result to ground. The same manifests support wildfire segmentation and other compiled models.

Prerequisites

  • The quickstart running on your computer.
  • An inference service that builds from a Dockerfile. The service accepts POST /infer, returns {"accepted":true}, and writes each result to the SpaceOS frame bus.
  • A registry that can store the service image.

The service uses two SpaceOS data paths: the data link, a separately granted high-throughput path for sensor data, and the frame bus, the CCSDS path carrying telemetry and command messages between partitions and ground.

Step 1: Build the service image

Build an ARM64 image and push it to your registry:

Terminal window
docker buildx build \
--platform linux/arm64 \
-t ghcr.io/<your-org>/wildfire-segmenter:1 \
--push \
.

Use a multi-architecture image when you also want to run the service on an x86-64 development computer:

Terminal window
docker buildx build \
--platform linux/amd64,linux/arm64 \
-t ghcr.io/<your-org>/wildfire-segmenter:1 \
--push \
.

Step 2: Add the service to a composition

Create build.yaml:

schema: space.build
version: "1"
kernel: linuxkit/kernel:6.6.13
output: _build/spaceos
partitions:
payload:
init: pid1
disk: true
services:
- name: wildfire-segmenter
image: ghcr.io/<your-org>/wildfire-segmenter:1
runtime: oci
isolation: runc
interfaces:
- type: ip
bridges: [payload-net]
- type: frame_bus
apids: [0x120, 0x12F]
send_to: [ground]
- type: data_link
link: sensor-input
mbps: 200
mode: stream
healthcheck:
type: http
port: 8080
path: /health

The data link carries source imagery into the service. The frame bus carries small results and status messages. Keep large image products on the data link or in content-addressed storage.

Step 3: Set memory and CPU placement

Create run.yaml:

schema: space.run
version: "1"
image: _build/spaceos
partitions:
payload:
memory: 2048
apids: [0x120, 0x12F]
send_to: [ground]
services:
- name: wildfire-segmenter
isolation: runc
cpus: [0, 1]
relay:
from: payload
to: [ground]
ground:
port: 8080
socket: /tmp/spaceos/ground.sock

The service name must match build.yaml. The APID range and send_to list limit which frames the payload partition may send.

Step 4: Run inference locally

Build the composition and start it under the local runner:

Terminal window
space build . -t wildfire-segmenter:dev
space run --name wildfire-dev wildfire-segmenter:dev --runtime run.yaml

In another terminal, watch the service:

Terminal window
space ps
space report --json
space logs wildfire-dev

Find the wildfire-segmenter IP address in the report, then submit an image:

Terminal window
curl --fail \
--data-binary @scene.tif \
http://<service-ip>:8080/infer

The service accepts the input and answers:

{"accepted":true}

Open http://localhost:8080 to see the result message on APID 0x120. An APID is the CCSDS number that labels a telemetry stream.

Infrared satellite scene of a wildfire, with active fronts visible as bright lines against burned ground. Binary mask marking the active fire fronts found in the scene.
The scene submitted to the service, and the mask it returns. The mask is a few kilobytes; the scene is tens of megabytes.

On-board inference reduces the result to a mask that fits in a contact window that could not carry the complete scene.

A sensor or local test client sends an image to the inference service. The service runs the compiled model and returns a small result through the SpaceOS frame bus.

Step 5: Select an accelerator target

Keep the service name and OCI image unchanged. Select a board with the GPU, FPGA, or AI engine required by the image. Space CLI checks the board’s profile before it prepares the release.

Select an accelerator target that supports the compiled model:

Build and publish the release composition:

Terminal window
space build . \
-t ghcr.io/<your-org>/wildfire-composition:1 \
--release \
--signing-profile release
space push ghcr.io/<your-org>/wildfire-composition:1

Check the image selected for the board, the CPU architecture, the isolation method, and the accelerator assigned to the service:

Terminal window
space deploy ghcr.io/<your-org>/wildfire-composition:1 \
--target <target> \
--plan

Deploy the release after reviewing those values:

Terminal window
space deploy ghcr.io/<your-org>/wildfire-composition:1 --target <target>
space status <deploy-id>

Step 6: Return only the useful result

Write compact detections, masks, or scores to the frame bus. Keep the original sensor product on board unless the mission requests it. This reduces the bytes sent over the space link and lets the ground system act on the result sooner.