Roboflow + YOLOv5

Export Roboflow datasets in YOLOv5 PyTorch TXT, train YOLOv5 in our notebooks, then upload the weights to serve the model from Roboflow's API or your own hardware.

YOLOv5 is Ultralytics' PyTorch object detection model, trained from its own GitHub repository rather than the ultralytics package. Roboflow does not train YOLOv5 in the app, so training happens in your own environment, typically one of our notebooks.

Roboflow exports any version as YOLOv5 PyTorch TXT and writes the data.yaml for you. Our notebooks cover YOLOv5 detection, instance segmentation and classification. When training finishes, version.deploy() with model_type yolov5 uploads the run folder; for YOLOv5 the folder must include opt.yaml with the image size and batch size. The model then runs on the Serverless Hosted API or Roboflow Inference.

How to connect YOLOv5 to Roboflow

5 steps
  1. Label and generate a version

    Annotate in Roboflow or upload existing labels, then generate a dataset version.

  2. Export as YOLOv5 PyTorch TXT

    Choose YOLOv5 PyTorch TXT on export, or call version.download("yolov5") in Python. You get images, one label txt per image and a data.yaml.

  3. Train in the YOLOv5 notebook

    Open the YOLOv5 object detection notebook in roboflow/notebooks, paste in your dataset download snippet and run train.py.

  4. Upload the weights

    Call version.deploy(model_type="yolov5", model_path="<run folder>"). The folder needs weights/best.pt and opt.yaml with imgsz and batch_size.

  5. Run the model

    Call your model by its project and version ID through the Serverless Hosted API, a Dedicated Deployment or a self-hosted Inference server.

What teams build with YOLOv5

  • Keep an existing YOLOv5 pipeline

    Swap in better-labeled data from Roboflow without changing your YOLOv5 training code.

  • Serve YOLOv5 weights without building a server

    Upload best.pt and call it over HTTP, or in a Workflow next to other models.

Questions

No. Our docs list YOLOv5 as upload and export only. For in-app training, choose RF-DETR, YOLO26 or YOLO11.

The training run folder with weights/best.pt and an opt.yaml that includes imgsz (or img_size) and batch_size. YOLOv5 upload does not use the ultralytics package.

YOLOv5 is AGPL-3.0. Running it on Roboflow cloud includes a commercial license for every user, including the free plan. Commercial self-hosting needs our Enterprise license add-on.

Yes. YOLOv8 reads the same YOLOv5 PyTorch TXT layout, so one export trains either model.

Why are companies choosing Roboflow?

The end-to-end platform for vision AI: create datasets, train models and deploy to production.

  • Flexible deployment modes

    Move from a scalable cloud API to edge hardware like NVIDIA Jetson without managing complex dependencies.

  • Integrated workflow builder

    Combine multiple AI models, custom business logic and third-party integrations into one production-ready pipeline in a low-code editor.

  • Model monitoring and alerts

    Dashboards track confidence, inference time and request volume for your deployed models, and email alerts tell your team when confidence suddenly drops.

View all
Get started

Build on the Platform

For developers, engineers, and technical founders who want to get hands on. Try the free tier; the docs are open.

Bring it into your operation

For heads of AI, operations leaders, and enterprise teams. Bring a known problem, or work with us to find the first one worth taking on.