|
6 | 6 | "metadata": {},
|
7 | 7 | "outputs": [],
|
8 | 8 | "source": [
|
9 |
| - "%pip install fiftyone" |
| 9 | + "%pip install fiftyone notebook ipywidgets" |
10 | 10 | ]
|
11 | 11 | },
|
12 | 12 | {
|
|
15 | 15 | "metadata": {},
|
16 | 16 | "outputs": [],
|
17 | 17 | "source": [
|
18 |
| - "import fiftyone as fo # pyright: ignore[reportMissingImports]\n", |
19 |
| - "import fiftyone.zoo as foz # pyright: ignore[reportMissingImports]\n", |
| 18 | + "import fiftyone as fo\n", |
20 | 19 | "\n",
|
21 |
| - "# List available zoo datasets\n", |
22 |
| - "print(foz.list_zoo_datasets())\n", |
| 20 | + "datasets = fo.list_datasets()\n", |
23 | 21 | "\n",
|
24 |
| - "#\n", |
25 |
| - "# Load the COCO-2017 validation split into a FiftyOne dataset\n", |
26 |
| - "#\n", |
27 |
| - "# This will download the dataset from the web, if necessary\n", |
28 |
| - "#\n", |
29 |
| - "dataset = foz.load_zoo_dataset(\n", |
30 |
| - " \"coco-2017\", split=\"validation\", label_types=[\"segmentations\"], shuffle=True, max_samples=500\n", |
31 |
| - ")\n", |
| 22 | + "# Delete each dataset\n", |
| 23 | + "for dataset_name in datasets:\n", |
| 24 | + " fo.delete_dataset(dataset_name)" |
| 25 | + ] |
| 26 | + }, |
| 27 | + { |
| 28 | + "cell_type": "code", |
| 29 | + "execution_count": null, |
| 30 | + "metadata": {}, |
| 31 | + "outputs": [], |
| 32 | + "source": [ |
| 33 | + "import fiftyone as fo\n", |
| 34 | + "from fiftyone.types.dataset_types import COCODetectionDataset\n", |
| 35 | + "import fiftyone.zoo as foz\n", |
32 | 36 | "\n",
|
33 |
| - "# Give the dataset a new name, and make it persistent so that you can\n", |
34 |
| - "# work with it in future sessions\n", |
35 |
| - "# dataset.name = \"coco-2017-validation-seg-example-50\"\n", |
36 |
| - "# dataset.persistent = True\n", |
| 37 | + "data_path = \"/workspaces/pytorchcocotools/data/images/train2017\"\n", |
| 38 | + "labels_path = \"/workspaces/pytorchcocotools/data/annotations/instances_train2017.json\"\n", |
37 | 39 | "\n",
|
38 |
| - "# Visualize the in the App\n", |
39 |
| - "session = fo.launch_app(dataset)" |
| 40 | + "# Create the dataset\n", |
| 41 | + "dataset = fo.Dataset.from_dir(\n", |
| 42 | + " dataset_type=COCODetectionDataset,\n", |
| 43 | + " data_path=data_path,\n", |
| 44 | + " labels_path=labels_path,\n", |
| 45 | + " name=\"my-coco-train-2017-kps\",\n", |
| 46 | + " max_samples=5000,\n", |
| 47 | + ")" |
| 48 | + ] |
| 49 | + }, |
| 50 | + { |
| 51 | + "cell_type": "code", |
| 52 | + "execution_count": null, |
| 53 | + "metadata": {}, |
| 54 | + "outputs": [], |
| 55 | + "source": [ |
| 56 | + "session = fo.launch_app(dataset, address=\"0.0.0.0\") # pyright: ignore[reportArgumentType] # noqa: S104\n", |
| 57 | + "session" |
40 | 58 | ]
|
41 | 59 | }
|
42 | 60 | ],
|
|
56 | 74 | "name": "python",
|
57 | 75 | "nbconvert_exporter": "python",
|
58 | 76 | "pygments_lexer": "ipython3",
|
59 |
| - "version": "3.10.11" |
| 77 | + "version": "3.11.10" |
60 | 78 | }
|
61 | 79 | },
|
62 | 80 | "nbformat": 4,
|
|
0 commit comments