Running Roboflow Inference

Run Roboflow inference from ALPON X5 AI or ALPON X4 through ALPON Cloud: create a Roboflow workflow, package a small inference-sdk client in an ARM64 container, push it to the Sixfab Container Registry, and deploy it with your Roboflow API key, workspace, and workflow ID.

Deploy Roboflow Inference on ALPON

Run AI-based image inference from your ALPON X5 AI or ALPON X4 with Roboflow. This guide creates a Roboflow workflow, packages a small inference-sdk client in an ARM64 container that sends images to the Roboflow hosted API, and deploys it through ALPON Cloud so it runs continuously on the device.

ALPON X5 AI ALPON X4 Roboflow Computer vision
ALPON · Tutorial · Containers · Computer vision
How do I deploy Roboflow inference on ALPON?

Create a workflow in Roboflow and copy its API key, workspace name, and workflow ID. Build an ARM64 container that uses the Roboflow inference-sdk to send an image to the hosted API, push it to your Sixfab Container Registry, then use the Applications → Deploy panel on ALPON Cloud to launch it on your ALPON X5 AI or ALPON X4 with the ROBOFLOW_API_KEY, ROBOFLOW_WORKSPACE, and ROBOFLOW_WORKFLOW_ID environment variables. Inference results appear in the container logs.

Overview

Roboflow is a computer vision platform for building, training, and deploying image models and workflows. This guide sends images from a container on an ALPON X5 AI or ALPON X4 to the Roboflow hosted API and returns inference results. Processing is remote rather than on-device, so latency, data handling, usage limits, and availability depend on the network and your Roboflow plan.

The application workflow is simple: the app is dockerized, the container is deployed to the ALPON via ALPON Cloud, and the deployed application runs continuously on the device. The steps below are identical on ALPON X4 and ALPON X5 AI.

Hosted inference needs internet access

Hosted inference requires an internet connection with enough upstream bandwidth for the submitted images. Review the Roboflow API's current authentication, privacy, and rate-limit documentation before production use.

Before you start

You need an ALPON X5 AI or ALPON X4 registered on ALPON Cloud with internet access, a Roboflow account, and Docker installed on your build machine to build and push the image. New to container deployment? Start with Containerize Apps for ALPON.

  1. 1

    Create a workflow in Roboflow

    Go to app.roboflow.com and sign up or log in. In the left menu, select Workflows → Create a Workflow.

    Roboflow left menu with Workflows selected and the Create a Workflow button
    Workflows → Create a Workflow in the Roboflow left menu.

    Add a model by clicking Add a Model, then select Object Detection model.

    Roboflow workflow editor with the Add a Model button
    Click Add a Model in the workflow editor.
    Roboflow model type picker with Object Detection model selected
    Select Object Detection model.

    Add a model by clicking Browse Pre-trained Models, then select YOLOv8.

    Roboflow Browse Pre-trained Models option
    Click Browse Pre-trained Models.
    Roboflow pre-trained model list with YOLOv8 selected
    Select YOLOv8 from the pre-trained models.

    Save the workflow.

    Roboflow workflow editor with the YOLOv8 model block and the Save button
    Save the workflow.

    Go to Settings → API Keys and copy your API key.

    Roboflow Settings menu with the API Keys entry
    Open Settings → API Keys.
    Roboflow API Keys page with the copy button for the API key
    Copy your Roboflow API key.

    In the workflow view, click Deploy to see the required environment variables — the workspace name and workflow ID. You’ll need them in step 5.

    Roboflow workflow Deploy panel showing the workspace name and workflow ID
    The Deploy panel lists the workspace name and workflow ID.
  2. 2

    Write the Roboflow inference app

    Package your Roboflow client as a Docker container. Create a directory on your build machine with the following Dockerfile and main.py:

    Dockerfile
    FROM python:3.11-slim
    
    WORKDIR /app
    
    RUN pip install --no-cache-dir inference-sdk
    
    COPY main.py .
    
    CMD ["python", "main.py"]
    python · main.py
    # main.py
    import os
    import time
    from inference_sdk import InferenceHTTPClient
    
    API_URL = os.getenv("ROBOFLOW_API_URL", "https://serverless.roboflow.com")
    API_KEY = os.getenv("ROBOFLOW_API_KEY")
    WORKSPACE_NAME = os.getenv("ROBOFLOW_WORKSPACE")
    WORKFLOW_ID = os.getenv("ROBOFLOW_WORKFLOW_ID")
    IMAGE_PATH = os.getenv("IMAGE_PATH", "/data/image.jpg")
    
    if not all([API_KEY, WORKSPACE_NAME, WORKFLOW_ID]):
        raise EnvironmentError("Missing required environment variables.")
    
    client = InferenceHTTPClient(api_url=API_URL, api_key=API_KEY)
    
    while True:
        try:
            result = client.run_workflow(
                workspace_name=WORKSPACE_NAME,
                workflow_id=WORKFLOW_ID,
                images={"image": IMAGE_PATH},
                use_cache=True
            )
            print("Inference result:", result)
        except Exception as e:
            print("Error during inference:", e)
        time.sleep(60)
    Image inputs only

    The Roboflow API supports only image inputs. If you want to use a video or live feed, you must extract frames and send them one by one (edge inference is not available on ALPON X4).

    You may also modify the code to use a USB camera via cv2.VideoCapture(), though this is not officially supported in the cloud-based flow.

  3. 3

    Build the container image

    In the folder containing your Dockerfile and main.py, build the image for the device’s arm64 architecture:

    bash · build the image
    docker buildx build --platform linux/arm64 --load -t roboflow-inference .
  4. 4

    Add the Roboflow inference container

    Make the roboflow-inference image available to your device by pushing it to your Sixfab Container Registry, so deployments are fast and repeatable. Log in to Sixfab Registry, click + Add Container, and follow the prompts to push the roboflow-inference image.

    Pushing images to the Sixfab Container Registry

    For the full walkthrough of tagging and pushing an image, see Update Containers from the Sixfab Container Registry.

  5. 5

    Deploy the container on ALPON

    Open your device in ALPON Cloud, go to the Applications section, and click + Deploy. In the Deploy Container window, use these settings:

    Container Name roboflow-inference (or your preferred name)
    Image The roboflow-inference image and tag you pushed to the Sixfab Container Registry.
    Environment Click + Add More in the Environment section and add the variables in the table below, with the values from your Roboflow workspace and workflow (step 1).
    KeyValueDescription
    ROBOFLOW_API_KEYYour Roboflow API keyAPI key from Roboflow Settings → API Keys
    ROBOFLOW_WORKSPACEYour Roboflow workspace nameFrom your Roboflow account
    ROBOFLOW_WORKFLOW_IDYour Roboflow workflow IDFrom your Roboflow Workflow configuration
    ROBOFLOW_API_URLOptional, default https://serverless.roboflow.comRoboflow API base URL (optional)
    IMAGE_PATHPath to input image on deviceE.g., /data/image.jpg (optional)

    Click + Deploy to launch the Roboflow inference container on the device.

  6. 6

    Check the deployment and inference results

    Once the deployment completes, the roboflow-inference container is running on the target ALPON device and sends the image to the Roboflow hosted API every 60 seconds. Check the Applications tab in ALPON Cloud for real-time status, and open the container logs to see each result:

    ALPON Cloud · container logs
    Inference result: [{ ... }]

    If the log shows Missing required environment variables., check the three required variables from step 5; if it shows Error during inference:, confirm the device has internet access and that the image exists at IMAGE_PATH.

Ready when…
  • The roboflow-inference container shows as running in the Applications section.
  • The container logs print Inference result: with predictions from your Roboflow workflow.

Your Roboflow inference application is now running continuously on the ALPON. Adjust main.py to feed it your own images or camera frames.

Production image policy: Replace floating :latest references with a reviewed immutable tag or digest, then record the selected version for rollback.


Did this page help you?