Skip to main content

Roboflow Python


roboflow logo


Roboflow streamlines your computer vision pipeline - upload data, label it, download datasets, train models, deploy models, and repeat.

The Roboflow Python Package is a python wrapper around the core Roboflow web application and REST API.

We also maintain an open source set of CV utililities and notebook tutorials in Python:

Installation

To install this package, please use Python 3.6 or higher.

Install from PyPi (Recommended):

pip install roboflow

Install from Source:

git clone https://github.com/roboflow-ai/roboflow-python.git
cd roboflow-python
python3 -m venv env
source env/bin/activate
pip3 install -r requirements.txt

Authentication

import roboflow
roboflow.login()

Quickstart

Datasets

Download any of over 200,000 public computer vision datasets from Roboflow Universe. Label and download your own datasets on app.roboflow.com.

import roboflow
dataset = roboflow.download_dataset(dataset_url="universe.roboflow.com/...", model_format="yolov8")
#ex. dataset = roboflow.download_dataset(dataset_url="https://universe.roboflow.com/joseph-nelson/bccd/dataset/1", model_format="yolov8")
print(dataset.location)

Models

Predict with any of over 50,000 public computer vision models. Train your own computer vision models on app.roboflow.com or train upload your model from open source models - see https://github.com/roboflow/notebooks

img_url = "https://media.roboflow.com/quickstart/aerial_drone.jpeg?updatedAt=1678743716455"
universe_model_url = "https://universe.roboflow.com/brad-dwyer/aerial-solar-panels/model/6"

model = roboflow.load_model(model_url=universe_model_url)
pred = model.predict(img_url, hosted=True)
pred.plot()

Library Structure

The Roboflow python library is structured by the core Roboflow application objects.

Workspace (workspace.py) --> Project (project.py) --> Version (version.py)

from roboflow import Roboflow
rf = Roboflow()
workspace = rf.workspace("WORKSPACE_URL")
project = workspace.project("PROJECT_URL")
version = project.version("VERSION_NUMBER")

The workspace, project, and version parameters are the same that you will find in the URL addresses at app.roboflow.com and universe.roboflow.com.

Within the workspace object you can perform actions like making a new project, listing your projects, or performing active learning where you are using predictions from one project's model to upload images to a new project.

Within the project object, you can retrieve metadata about the project, list versions, generate a new dataset version with preprocessing and augmentation settings, train a model in your project, and upload images and annotations to your project.

Within the version object, you can download the dataset version in any model format, train the version on Roboflow, and deploy your own external model to Roboflow.

Contributing

If you want to extend our Python library or if you find a bug, please open a PR!

Also be sure to test your code the unittest command at the /root level directory.

Run tests:

python -m unittest

When creating new functions, please follow the Google style Python docstrings. See example below:

def example_function(param1: int, param2: str) -> bool:
    """Example function that does something.

    Args:
        param1: The first parameter.
        param2: The second parameter.

    Returns:
        The return value. True for success, False otherwise.

    """

We provide a Makefile to format and ensure code quality. Be sure to run them before creating a PR.

# format code with `black` and `isort`
make style

# check code with flake8
make check_code_quality

Note These tests will be run automatically when you commit thanks to git hooks.

Metadata

Release files for roboflow 1.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for roboflow 1.1.4
File Size Uploaded Provenance Actions
roboflow-1.1.4.tar.gz 49.4 kB Without provenance Details for roboflow-1.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for roboflow 1.1.4
File Interpreter ABI Platform Actions
roboflow-1.1.4-py3-none-any.whl Python 3 none any Details for roboflow-1.1.4-py3-none-any.whl

Total release size: 107.0 kB

Release files / roboflow-1.1.4.tar.gz

Download URL roboflow-1.1.4.tar.gz
Size 49.4 kB
Tags Source
SHA-256 checksum
How to use checksums
5b3b5dc93a170c0b6136e05ad4eb69345ee8b841e8bf02eb0d83fb195b9c2e23
BLAKE2b-256 checksum
How to use checksums
c0fd1f6266cb59c6da1c20ae9b5ac99c26f5a9cc9398775532cbdd2e85c2483a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17

Release files / roboflow-1.1.4-py3-none-any.whl

Download URL roboflow-1.1.4-py3-none-any.whl
Size 57.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5b78d3581d091ee7d86890fbf75bce6697dcdb900d7cc6c142a6e208c043036
BLAKE2b-256 checksum
How to use checksums
771cb6a244353965f74b3dad9c2a8726856d3e0eeb3e2e5c9e65e56dc6e7188b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17

Security for roboflow 1.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.4 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page