Skip to content

Download Voxel51 data

Use the script below to export a FiftyOne (Voxel51) dataset to CSV from your computer. It exports sample metadata only:

  • No image files are downloaded or copied
  • The filepath column is omitted
  • Embedding fields and vector fields are omitted

The example is configured for:

The MongoDB connection does not require a username or password. You must be on an MBARI network or VPN that can reach the server on port 27017.

Install FiftyOne

Create a Python environment and install FiftyOne:

python -m venv .venv
source .venv/bin/activate
python -m pip install fiftyone

Create the export script

Save the following as export_dataset_csv.py:

#!/usr/bin/env python3
"""Export a FiftyOne dataset to CSV without images or embeddings."""

from __future__ import annotations

import argparse
import os
import sys
from pathlib import Path

MONGO_URI = "mongodb://maximilian.shore.mbari.org:27017"
DATABASE_NAME = "fiftyone"
DATASET_NAME = "902111-ISIIS-Deployments_v67_5151"
DEFAULT_OUT = Path.cwd() / f"{DATASET_NAME}.csv"

EXCLUDE_NAME_PARTS = (
    "embedding",
    "embeddings",
    "filepath",
)


def configure_fiftyone() -> None:
    os.environ["FIFTYONE_DATABASE_URI"] = MONGO_URI
    os.environ["FIFTYONE_DATABASE_NAME"] = DATABASE_NAME

    import fiftyone as fo

    fo.config.database_uri = MONGO_URI
    fo.config.database_name = DATABASE_NAME


def is_excluded_field(name: str, field) -> bool:
    lower = name.lower()
    if any(part in lower for part in EXCLUDE_NAME_PARTS):
        return True

    # Exclude VectorField-style embedding storage even when it has another name.
    return "vector" in type(field).__name__.lower()


def csv_fields(dataset) -> list[str]:
    schema = dataset.get_field_schema()
    return [
        name
        for name, field in schema.items()
        if not is_excluded_field(name, field)
    ]


def main() -> int:
    parser = argparse.ArgumentParser(
        description="Export FiftyOne metadata to CSV without images or embeddings."
    )
    parser.add_argument(
        "-o",
        "--output",
        type=Path,
        default=DEFAULT_OUT,
        help=f"Output CSV path (default: {DEFAULT_OUT})",
    )
    parser.add_argument(
        "--list",
        action="store_true",
        help="List available datasets and exit.",
    )
    args = parser.parse_args()

    configure_fiftyone()

    import fiftyone as fo
    import fiftyone.types as fot

    print(f"Connecting to {MONGO_URI}, database={DATABASE_NAME}")
    try:
        names = fo.list_datasets()
    except Exception as exc:
        print(f"ERROR: cannot reach MongoDB/FiftyOne: {exc}", file=sys.stderr)
        print(
            "Check VPN/network access to maximilian.shore.mbari.org:27017.",
            file=sys.stderr,
        )
        return 1

    if args.list:
        print(f"Datasets ({len(names)}):")
        for name in sorted(names):
            print(f"  {name}")
        return 0

    if DATASET_NAME not in names:
        print(f"ERROR: dataset {DATASET_NAME!r} not found.", file=sys.stderr)
        print("Run this script with --list to see available datasets.", file=sys.stderr)
        return 1

    dataset = fo.load_dataset(DATASET_NAME)
    fields = csv_fields(dataset)
    output = args.output.expanduser().resolve()
    output.parent.mkdir(parents=True, exist_ok=True)

    print(f"Dataset: {DATASET_NAME}; samples={len(dataset)}")
    print(f"CSV fields ({len(fields)}): {', '.join(fields)}")
    print(f"Writing: {output}")

    dataset.export(
        dataset_type=fot.CSVDataset,
        labels_path=str(output),
        fields=fields,
        export_media=False,
    )

    print(f"Done: {output} ({output.stat().st_size} bytes)")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())

Export the CSV

Run the script:

python export_dataset_csv.py

The default output is:

902111-ISIIS-Deployments_v67_5151.csv

Choose another output path with --output:

python export_dataset_csv.py --output ~/Desktop/isiis_v67.csv

To confirm connectivity and see the dataset names in the database:

python export_dataset_csv.py --list

Note

export_media=False prevents media files from being copied. Excluding filepath removes the image-path column as well, so the resulting CSV contains metadata only.

Troubleshooting

If the connection fails:

  1. Connect to the MBARI network or VPN.
  2. Confirm that maximilian.shore.mbari.org:27017 is reachable.
  3. Run python export_dataset_csv.py --list.
  4. If the dataset is listed under another MongoDB database, update DATABASE_NAME near the top of the script.

Updated: 2026-07-17