Upload Custom Model Weights

Roboflow offers the ability to upload model weights for your custom-trained models to your Roboflow projects for model deployment.

Once you've completed training your custom model, upload your model weights back to your Roboflow project to take advantage of Roboflow Inference.

Model Support

Model weights uploads are currently available for:

  • YOLOv5 (n, s, m, l, x) Object Detection and Instance Segmentation

  • YOLOv7 Instance Segmentation (yolov7-seg)

  • YOLOv8 (n, s, m, l, x) Object Detection, Instance Segmentation, Classification, and Keypoint Detection

  • YOLOv9 (n, s, m, l, x) Object Detection

  • YOLOv10 (n, s, m, l, x) Object Detection

  • YOLOv11 (n, s, m, l, x) Object Detection, Instance Segmentation

  • YOLOv12 (n, s, m, l, x) Object Detection

  • YOLO-NAS (s, m, l) Object Detection

  • RF-DETR (rfdetr-base, rfdetr-large) Object Detection

  • Florence-2 (base, large) Multimodal

  • PaliGemma (3b-pt-224, 3b-pt-448, 3b-pt-896) Multimodal

  • PaliGemma 2 (3b-pt-224, 3b-pt-448, 3b-pt-896) Multimodal

Larger model sizes provide better training results. However, the larger the model size, the slower the training time, and inference (model prediction) speed. Consider whether you're looking for real-time inference on fast-moving objects or video feeds (better to use a smaller model), or you are processing data after it is collected, and more concerned with higher prediction accuracy (choose a larger model).

Versioned vs. Versionless Models Upload

Roboflow provides two distinct approaches for deploying models to your projects, each serving different use cases and organizational needs. The choice between versioned and versionless deployments depends on whether you need to track model evolution alongside dataset versions or want to share models across multiple projects in your workspace.

  • Versionless Deployments

    • Tied to the workspace level

    • Can be deployed to multiple projects simultaneously

    • Ideal for sharing models across different projects within the same workspace

  • Versioned Deployments

    • Tied to specific project versions

    • One model per dataset version

    • Ideal for tracking model evolution alongside dataset versions

    • Ideal for using model on Label Assist

    • Ideal for using model as checkpoint for training other models

Upload Custom Weights

Before starting, make sure you have roboflow>=1.1.53 to use the versionless deploy.

To upload versionless custom weights, use the workspace.deploy_model method in the Python SDK.

Usage

workspace.deploy_model(
    model_type="yolov8",  # Type of the model
    model_path="path/to/model",  # Path to model directory
    project_ids=["project1", "project2"],  # List of project IDs
    model_name="my-model",  # Name for the model (must have at least 1 letter, and accept numbers and dashes)
    filename="weights/best.pt"  # Path to weights file (default)
)

Parameters

  • model_type (str): The type of model being deployed (e.g., "yolov8", "yolov11")

  • model_path (str): File path to the directory containing the model weights

  • project_ids (list[str]): List of project IDs to deploy the model to

  • model_name (str): Name to identify the model - (must have at least 1 letter, and accept numbers and dashes)

  • filename (str, optional): Name of the weights file (defaults to "weights/best.pt")

Example

from roboflow import Roboflow

rf = Roboflow(api_key="YOUR_API_KEY")
workspace = rf.workspace("YOUR_WORKSPACE")

workspace.deploy_model(
  model_type="yolov8",
  model_path="./runs/train/weights",
  project_ids=["project-1", "project-2", "project-3"],
  model_name="my-custom-model"
)

Next Steps

  1. Check out your model in the "Models" tab of Roboflow

  2. Run your model locally with Roboflow Inference Server.

Last updated

Was this helpful?