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:
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:
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.buildversion: "1"kernel: linuxkit/kernel:6.6.13output: _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: /healthThe 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.runversion: "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.sockThe 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:
space build . -t wildfire-segmenter:devspace run --name wildfire-dev wildfire-segmenter:dev --runtime run.yamlIn another terminal, watch the service:
space psspace report --jsonspace logs wildfire-devFind the wildfire-segmenter IP address in the report, then submit an image:
curl --fail \ --data-binary @scene.tif \ http://<service-ip>:8080/inferThe 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.
On-board inference reduces the result to a mask that fits in a contact window that could not carry the complete scene.
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:
- NVIDIA Jetson TX2i for CUDA and TensorRT.
- Xilinx VCK190 for Vitis AI and FPGA execution.
- Kalray Coolidge for many-core execution on its MPPA processor array.
Build and publish the release composition:
space build . \ -t ghcr.io/<your-org>/wildfire-composition:1 \ --release \ --signing-profile releasespace push ghcr.io/<your-org>/wildfire-composition:1Check the image selected for the board, the CPU architecture, the isolation method, and the accelerator assigned to the service:
space deploy ghcr.io/<your-org>/wildfire-composition:1 \ --target <target> \ --planDeploy the release after reviewing those values:
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.