Links
Comment on page

Upload Custom 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 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, and Classification
After successfully training your custom YOLOv5, YOLOv7 or YOLOv8 model, use the .deploy() function to upload your model weights back to your Roboflow Object Detection project.
Model weights uploads are only available for dataset versions without a trained model (i.e not yet trained with Roboflow Train, and no YOLOv5, YOLOv7 or YOLOv8 model weights uploaded).
NOTE: 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).

Upload Custom Weights

Python SDK
You need the roboflow>=1.0.1 Python package version to use the .deploy() command.
To upload custom weights, use the model.deploy() method in the Python SDK.
version = project.version(1)
version.deploy("model-type", "path/to/training/results/")
The following model types are supported:
  • yolov5, yolov5-seg
  • yolov7, yolov7-seg
  • yolov8, yolov8-seg, yolov8-cls
If weights upload is attempted for dataset versions that already have a trained model (a Roboflow Train model or uploaded YOLOv5, YOLOv7 or YOLOv8 weights) then you will receive a RuntimeError - "This version already has a trained model. Please generate and train a new version in order to upload model to Roboflow."
If upload is attempted for a model architecture that is not yet supported for weights upload, then you will receive a ValueError.

Next Steps

  1. 1.
    Test out your model in the Deploy Tab.
  2. 2.
    Deploy Your Model with Roboflow Deploy.
  3. 3.
    Improve Your Model with Active Learning.
Last modified 4mo ago