Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 45 additions & 2 deletions CLI-COMMANDS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,21 @@ $ roboflow --help
```

```
usage: roboflow [-h] {login,download,upload,import,infer,project,workspace} ...
usage: roboflow [-h] {login,download,upload,import,infer,search-export,project,workspace} ...

Welcome to the roboflow CLI: computer vision at your fingertips 🪄

options:
-h, --help show this help message and exit

subcommands:
{login,download,upload,import,infer,project,workspace}
{login,download,upload,import,infer,search-export,project,workspace}
login Log in to Roboflow
download Download a dataset version from your workspace or Roboflow Universe.
upload Upload a single image to a dataset
import Import a dataset from a local folder
infer perform inference on an image
search-export Export search results as a dataset
project project related commands. type 'roboflow project' to see detailed command help
workspace workspace related commands. type 'roboflow workspace' to see detailed command help
```
Expand Down Expand Up @@ -245,3 +246,45 @@ roboflow infer -w roboflow-58fyf -m rock-paper-scissors-sxsw/11 ~/scissors.png
"prediction_type": "ObjectDetectionModel"
}
```

## Example: search and export a dataset

Use Roboflow's search to query images across your workspace and export matching results as a dataset. This is useful when you want to create a dataset from specific search criteria (e.g. images with a certain class, tag, or other metadata).

```bash
$ roboflow search-export --help
```
```
usage: roboflow search-export [-h] [-f FORMAT] [-w WORKSPACE] [-l LOCATION] [-d DATASET] [-g ANNOTATION_GROUP] [-n NAME] [--no-extract] query

positional arguments:
query Search query (e.g. 'tag:annotate' or '*')

options:
-h, --help show this help message and exit
-f FORMAT Annotation format (default: coco)
-w WORKSPACE Workspace url or id (uses default workspace if not specified)
-l LOCATION Local directory to save the export
-d DATASET Limit export to a specific dataset (project slug)
-g ANNOTATION_GROUP Limit export to a specific annotation group
-n NAME Optional name for the export
--no-extract Skip extraction, keep the zip file
```

Export all images tagged "annotate" in COCO format:

```bash
$ roboflow search-export "tag:annotate"
```

Export images containing a specific class, limited to one dataset, in COCO format:

```bash
$ roboflow search-export "class:person" -f coco -d my-dataset -l ~/exports/people
```

```
Export started (id=abc123). Polling for completion...
Downloading search export to /Users/tony/exports/people: 100%|██████████| 5420/5420 [00:02<00:00, 2710.00it/s]
Search export extracted to /Users/tony/exports/people
```
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,28 @@ predictions = model.predict(img_url, hosted=True).json()
print(predictions)
```

### Search and Export

Search for images across your workspace and export matching results as a ready-to-use dataset:

```python
workspace = rf.workspace()

# Export images matching a search query
workspace.search_export(
query="class:person", # search query (e.g. "tag:review", "class:dog", "*")
format="coco", # annotation format: coco, yolov8, yolov5, voc, etc.
dataset="my-project", # optional: limit to a specific project
location="./my-export", # optional: output directory
)
```

Or from the CLI:

```bash
roboflow search-export "class:person" -f coco -d my-project -l ./my-export
```

## Library Structure

The Roboflow Python library is structured using the same Workspace, Project, and Version ontology that you will see in the Roboflow application.
Expand Down
22 changes: 22 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,28 @@ predictions = model.predict(img_url, hosted=True).json()
print(predictions)
```

### Search and Export

Search for images across your workspace and export matching results as a ready-to-use dataset:

```python
workspace = rf.workspace()

# Export images matching a search query
workspace.search_export(
query="class:person", # search query (e.g. "tag:review", "class:dog", "*")
format="coco", # annotation format: coco, yolov8, yolov5, voc, etc.
dataset="my-project", # optional: limit to a specific project
location="./my-export", # optional: output directory
)
```

Or from the CLI:

```bash
roboflow search-export "class:person" -f coco -d my-project -l ./my-export
```

## Library Structure

The Roboflow Python library is structured using the same Workspace, Project, and Version ontology that you will see in the Roboflow application.
Expand Down