Skip to content

Commit f245d51

Browse files
committed
Update view example
1 parent a85e275 commit f245d51

File tree

1 file changed

+38
-20
lines changed

1 file changed

+38
-20
lines changed

notebooks/view.ipynb

+38-20
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"metadata": {},
77
"outputs": [],
88
"source": [
9-
"%pip install fiftyone"
9+
"%pip install fiftyone notebook ipywidgets"
1010
]
1111
},
1212
{
@@ -15,28 +15,46 @@
1515
"metadata": {},
1616
"outputs": [],
1717
"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",
2019
"\n",
21-
"# List available zoo datasets\n",
22-
"print(foz.list_zoo_datasets())\n",
20+
"datasets = fo.list_datasets()\n",
2321
"\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",
3236
"\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",
3739
"\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"
4058
]
4159
}
4260
],
@@ -56,7 +74,7 @@
5674
"name": "python",
5775
"nbconvert_exporter": "python",
5876
"pygments_lexer": "ipython3",
59-
"version": "3.10.11"
77+
"version": "3.11.10"
6078
}
6179
},
6280
"nbformat": 4,

0 commit comments

Comments
 (0)