Skip to main content

Roboflow Python Library


roboflow logo

Website • Docs • Blog • Twitter • Linkedin • Universe

Roboflow makes managing, preprocessing, augmenting, and versioning datasets for computer vision seamless. This is the official Roboflow python package that interfaces with the Roboflow API. Key features of Roboflow:

Installation:

To install this package, please use Python 3.6 or higher. We provide three different ways to install the Roboflow package to use within your own projects.

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

Quickstart

import roboflow

# Instantiate Roboflow object with your API key
rf = roboflow.Roboflow(api_key=YOUR_API_KEY_HERE)

# List all projects for your workspace
workspace = rf.workspace()

# Load a certain project, workspace url is optional
project = rf.project("PROJECT_ID")

# List all versions of a specific project
project.versions()

# Upload image to dataset
project.upload("UPLOAD_IMAGE.jpg")

# Retrieve the model of a specific project
project.version("1").model

# predict on a local image
prediction = model.predict("YOUR_IMAGE.jpg")

# Predict on a hosted image
prediction = model.predict("YOUR_IMAGE.jpg", hosted=True)

# Plot the prediction
prediction.plot()

# Convert predictions to JSON
prediction.json()

# Save the prediction as an image
prediction.save(output_path='predictions.jpg')

Using this package for a specifc project

If you have a specific project from your workspace you'd like to run in a notebook follow along on this tutorial Downloading Datasets from Roboflow for Training (Python)

Selecting the format you'd like your project to be exported as while choosing the show download code option will display code snippets you can use in either Jupyter or your terminal. These code snippets will include your api_key, project, and workspace names.

Alt Text

Deving locally

  1. clone repo
  2. create a virtual env: virtualenv local_dev
  3. activate virtual env: source local_dev/bin/activate
  4. install packages from repo: pip3 install -e ".[dev]"
  5. create script on top level of ROBOFLOW-PYTHON and reference local roboflow directory: from roboflow import Roboflow
  6. when done, uptick the pip package minor version number in setup.py
  7. manually add any new dependencies to the requirements.txt and list of dependencies in setup.py (careful not to overwrite any packages that might screw up backwards dependencies for object detection, etc.)

Code Quality

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

# format your code with `black` and `isort` run
make style
# check code with flake8
make check_code_quality

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

Tests

You need to have the following env variables,

ROBOFLOW_API_KEY="<YOUR_ROBOFLOW_API>"
PROJECT_NAME="<YOUR_PROJECT_NAME>"
PROJECT_VERSION="" # by default "1"

Then, assuming you have installed the dev packages (pip install -e ".[dev]), you can run the tests

python -m unittest

Metadata

Release files for roboflow 0.2.15

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 0.2.15
File Size Uploaded Provenance Actions
roboflow-0.2.15.tar.gz 18.7 kB Without provenance Details for roboflow-0.2.15.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for roboflow 0.2.15
File Interpreter ABI Platform Actions
roboflow-0.2.15-py2-none-any.whl Python 2 none any Details for roboflow-0.2.15-py2-none-any.whl

Total release size: 47.7 kB

Release files / roboflow-0.2.15.tar.gz

Download URL roboflow-0.2.15.tar.gz
Size 18.7 kB
Tags Source
SHA-256 checksum
How to use checksums
e81578c4daa1c4947acde9581801ed10c3b1669f49bd77aa954103e3b1f84cc5
BLAKE2b-256 checksum
How to use checksums
4cd424f24cb253f5f000c092cf3af722a344394472698a6edacb6f131fa80521
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4

Release files / roboflow-0.2.15-py2-none-any.whl

Download URL roboflow-0.2.15-py2-none-any.whl
Size 28.9 kB
Tags Python 2
SHA-256 checksum
How to use checksums
3da71099f6baa8dbec0e6abc10be153f6f752a7cdc287d7dd12043b28a205557
BLAKE2b-256 checksum
How to use checksums
ed92b43a3158b5ea41496a8ceb03aed42b1e472f1d0efb95e6b5eeae4ba326e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.4

Security for roboflow 0.2.15

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

0.2.15 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