> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/guides/model-training.md).

# Model Training

This guide takes you from a 30 second video to a trained object detection model you can call from an API. Roboflow pulls frames from the video, Auto Label draws the boxes, and trains the model on the dataset. In this example we'll create potato detection model, but you can swap in your own object.

{% stepper %}
{% step %}

### Create a project

Sign in at [app.roboflow.com](https://app.roboflow.com), or create an account if you do not have one. Open the "Projects" tab and create a [Project](/datasets/create-a-project.md). This guide uses the Object Detection project type and the Traditional annotation tool.

{% embed url="<https://media.roboflow.com/quickstart/step1.mp4>" %}
{% endstep %}

{% step %}

### Upload your data

[Upload your data](/datasets/adding-data.md) to the project. Roboflow takes images, videos, annotation files, and PDFs. This guide uploads a 30 second video and pulls 1.4 frames per second from it, which gives 42 images. If you have no data yet, you can [import a dataset from Roboflow Universe](/datasets/adding-data/roboflow-universe.md) instead.

{% embed url="<https://media.roboflow.com/quickstart/step2.mp4>" %}
{% endstep %}

{% step %}

### Label with Auto Label

Select [Auto Label](/annotate/ai-labeling/automated-annotation-with-autodistill.md) and type a class name or a short description of your object (here: `potato`). We'll set the confidence threshold a bit higher than the default. A high threshold means Auto Label only keeps boxes it is sure about. It may miss a few potatoes, but adding a missing box during review is quicker than fixing a wrong box.

{% embed url="<https://media.roboflow.com/quickstart/step3-autolabel.mp4>" %}
{% endstep %}

{% step %}

### Review the annotations

Check Auto Label's work on each image. If the boxes look right, approve the image (`A`). If not, you can remove, fix, or add boxes manually or with [Smart Select](/annotate/ai-labeling/enhanced-smart-polygon-with-sam.md), which draws a box for you when you click an object. We'll go through all 42 images so all are approved.

{% embed url="<https://media.roboflow.com/quickstart/step4-verify-labelassist.mp4>" %}
{% endstep %}

{% step %}

### Create a version and train

We add the approved images to your dataset and [split them into train, validation, and test sets](/datasets/dataset-versions/create-a-dataset-version.md). We'll use [RF-DETR](/deploy/supported-models/rf-detr.md) (Medium), as it's fast and accurate detection model built by Roboflow. Then create a dataset version and start training.

While the model trains, you can watch [live training graphs](/train/training-results.md). This model finishes in about 45 minutes, and you get an email when it is done. Open the model to see its [evaluation metrics](/train/evaluate-trained-models.md) (mAP, precision, recall, and F1).

{% embed url="<https://media.roboflow.com/quickstart/step5-version-training.mp4>" %}
{% endstep %}

{% step %}

### Deploy the model

Now you can run the model. Use it in a [Workflow](/workflows/what-is-workflows.md), or deploy it on its own. This guide uses the cloud-hosted [Serverless Hosted API](/deploy/serverless-hosted-api-v2.md). On your model's deploy page, copy the Python script, install dependencies, point it at one of your own images, and run it. The script prints the model's predictions as JSON.

{% embed url="<https://media.roboflow.com/quickstart/step6-deploy.mp4>" %}
{% endstep %}

{% step %}

### Visualize the results

To see the bounding boxes, draw them on the image with [supervision](https://supervision.roboflow.com), Roboflow's open-source annotation library. Install it with `pip install supervision`, then load the JSON predictions and draw a box around each potato. Add these lines to the original Python script:

```python
detections = sv.Detections.from_inference(result)

image = cv2.imread(image_path)
image = sv.BoxAnnotator().annotate(image, detections)

cv2.imwrite("annotated.jpg", image)
```

Each box marks a potato the model found:

<figure><img src="/files/zxVsBGh4a1mMJayIpFL5" alt="Potatoes on a conveyor, each marked with a bounding box"><figcaption><p>The trained model's predictions drawn on a frame with supervision.</p></figcaption></figure>
{% endstep %}
{% endstepper %}

## Where to go next

* Build a [Workflow](/workflows/create-a-workflow.md) around your model to chain it with logic, visualizations, and other steps.
* Run the model on your own hardware. See [Run a Model Locally](/guides/run-a-model-locally.md); you need the model\_id from your version page (in our case that's `erikrf/potatoes-daysm-1-rfdetr-medium-t1`).
* Run the model on video streams. See [Run a Model on a Video](/guides/run-a-model-on-a-video.md).
* Improve accuracy by labeling more images and retraining. See [Evaluate Trained Models](/train/evaluate-trained-models.md).
