Deploy Model Endpoint for YOLOv8
YOLOv8 is the latest model in the YOLO (You Only Look Once) series — a highly efficient family of models used for object detection and classification in computer vision tasks.
Overview
This tutorial will cover the following:
- A step-by-step guide on Model Endpoint creation and video object detection using YOLOv8
- Creating a Model Endpoint with custom model weights
We’ll use the pre-built YOLOv8 container for this tutorial. You can also build a custom container using Custom Inference if needed.
Using the pre-built container eliminates the need to create a custom API handler — platform automatically generates one for you.
A Guide on Model Endpoint Creation and Video Processing Using YOLOv8
Step 1: Create a Model Endpoint for YOLOv8
- Go to the AI Platform.
- Choose your project.
- Open the Model Endpoints section.
- Click Create Endpoint.
- Select YOLOv8 in the framework list.
- Choose an appropriate GPU or CPU plan.
- Optionally, set environment variables.
- In Model Details, skip the custom model selection to use default weights.
- Click Create to deploy the endpoint.
If you wish to use your own trained weights, refer to Creating a Model Endpoint with custom weights.
Step 2: Generate Your API Token
Each model endpoint requires a valid Auth Token for API access.
- Navigate to API Tokens in your project.
- Create a new API Token or use an existing one.
- Copy the Auth Token value for later use.
Step 3: Perform Object Detection on a Video
Prerequisites
- Create a bucket in E2E Object Storage.
- Upload your input video file to that bucket.
- Ensure your model endpoint is in Ready state.
Then, get the Sample API Request from the endpoint page.
Below is a sample Python script for processing a video:
Click to expand code
import requests
# Enter your auth token here
auth_token = "your-auth-token"
url = "https://jupyterlabs.e2enetworks.net/project/p-<project-id>/endpoint/is-<inference-id>/predict"
payload = {
"input": "$INPUT_VIDEO_FILE_NAME", # Path to input video in the bucket
"bucket_name": "$BUCKET_NAME", # Bucket name
"access_key": "$ACCESS_KEY", # Access key of the bucket
"secret_key": "$SECRET_KEY" # Secret key of the bucket
}
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {auth_token}'
}
response = requests.post(url, json=payload, headers=headers)
print(response.content) # Returns JOB_ID for tracking video processing
You’ll receive a JOB_ID in the response. Use it to track the video processing status.
Step 4: Track Video Processing Status
Use the following script to check job status:
Click to expand code
import requests
auth_token = "your-auth-token"
url = "https://jupyterlabs.e2enetworks.net/project/p-<project-id>/endpoint/is-<inference-id>/status/$JOB_ID"
headers = {
'Content-Type': 'application/json',
'Authorization': f'Bearer {auth_token}'
}
response = requests.get(url, headers=headers)
print(response.content)
Ensure the following before running:
- Correct Auth Token is provided.
- Correct bucket name, access key, secret key, and job ID are specified.
Video output files are in .avi format. Only .avi outputs are supported currently.
Once complete, your processed video will appear in the bucket under yolov8/outputs/.
Creating Model Endpoint with Custom Model Weights
You can deploy your own fine-tuned YOLOv8 weights by following these steps:
Step 1: Define a Model in Dashboard
- Go to AI Platform.
- Choose a project.
- Open the Model section.
- Click Create Model.
- Name your model (e.g.,
yolov8-custom). - Select Model Type as Custom.
- Click CREATE.
- Copy the Setup Host command from the Setup MinIO CLI tab.
If you forget to copy the Setup Host command, you can revisit the model’s detail page to retrieve it.
Step 2: Upload the Model to EOS (E2E Object Storage)
Use the MinIO CLI to upload your model file.
# Go to Dashboard → Models → Select your model → Setup MinIO CLI tab.
# Example copy command:
mc cp -r <MODEL_NAME>.pt yolov8/yolov8-custom-854588
Ensure the uploaded file is in .pt (PyTorch) format — other formats are not supported.
To list directories before uploading:
$HOME/.cache/huggingface/hub
Step 3: Create an Endpoint for Custom Model
Follow the same steps from Model Endpoint creation , but select your uploaded custom model under Model Details.
If the model is not in the root bucket directory, specify its path in the Model Path field during endpoint creation.
Ensure the .pt extension is correct and the file path is valid.
Your YOLOv8 model endpoint is now deployed and ready for inference using either pre-trained or custom-trained weights!