Skip to content

Commit 612440a

Browse files
committed
Merge branch 'docs/unified_model_dataset_plugin' of https://github.com/voxel51/fiftyone into docs/unified_model_dataset_plugin
2 parents 93b7e77 + 862dd03 commit 612440a

12 files changed

+404
-63
lines changed

docs/source/enterprise/api_connection.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ API Connection
66
.. default-role:: code
77

88
This page describes how to create API keys and configure your
9-
:ref:`SDK installation <enterprise-python-sdk>` to connect to your Enterprise
10-
deployment's API.
9+
:ref:`SDK installation <enterprise-python-sdk>` to connect to your FiftyOne
10+
Enterprise deployment.
1111

1212
All actions taken via API connections are authenticated based on the user
1313
associated with the API key, which means that concepts like user roles and

docs/source/enterprise/app.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ description, and tags for the dataset:
126126

127127
.. note::
128128

129-
What next? Use the :ref:`Enterprise Python SDK <enterprise-python-sdk>` to upload new
129+
What next? Use the
130+
:ref:`FiftyOne Enterprise Python SDK <enterprise-python-sdk>` to upload new
130131
samples, labels, and metadata to your dataset. A common approach is to
131-
automate this process via :ref:`cloud functions <enterprise-cloud-functions>`.
132+
automate this process via
133+
:ref:`cloud functions <enterprise-cloud-functions>`.
132134

133135
.. _enterprise-using-datasets:
134136

Lines changed: 329 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,329 @@
1+
.. _enterprise-getting-started:
2+
3+
Getting Started with FiftyOne Enterprise
4+
========================================
5+
6+
.. default-role:: code
7+
8+
Follow this guide to create your first dataset in FiftyOne Enterprise 🚀
9+
10+
Configure cloud credentials
11+
---------------------------
12+
13+
An :ref:`admin user <enterprise-admin>` must configure cloud credentials
14+
**once** for a deployment in order for users to view datasets:
15+
16+
.. image:: /images/enterprise/getting_started_cloud_creds.gif
17+
:alt: getting-started-cloud-creds
18+
:align: center
19+
20+
.. _enterprise-getting-started-sdk:
21+
22+
Create a dataset via the SDK
23+
----------------------------
24+
25+
Install the FiftyOne Enterprise Python SDK
26+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27+
28+
1. Navigate to the **Settings > API keys** page
29+
2. Copy and execute the provided bash command to install the SDK in your
30+
virtual environment
31+
32+
.. image:: /images/enterprise/getting_started_install_sdk.gif
33+
:alt: getting-started-install-sdk
34+
:align: center
35+
36+
If you plan to work with video datasets, you'll also need to install
37+
`FFmpeg <https://ffmpeg.org>`_:
38+
39+
.. tabs::
40+
41+
.. group-tab:: Linux
42+
43+
.. code-block:: shell
44+
45+
sudo apt install -y ffmpeg
46+
47+
.. group-tab:: macOS
48+
49+
.. code-block:: python
50+
51+
brew install ffmpeg
52+
53+
.. group-tab:: Windows
54+
55+
You can download a Windows build from
56+
`here <https://ffmpeg.org/download.html#build-windows>`_. Unzip it and be
57+
sure to add it to your path.
58+
59+
Connect to your deployment
60+
~~~~~~~~~~~~~~~~~~~~~~~~~~
61+
62+
To connect to your FiftyOne Enterprise deployment, you must provide your
63+
:ref:`API URI and API key <enterprise-api-connection>`:
64+
65+
.. code-block:: shell
66+
67+
export FIFTYONE_API_URI=XXXXXXXX
68+
export FIFTYONE_API_KEY=YYYYYYYY
69+
70+
You can create an API key and locate your deployment's URI on the
71+
**Settings > API keys** page of the FiftyOne Enterprise App:
72+
73+
.. image:: /images/enterprise/api_key_generate.png
74+
:alt: api-key-generate
75+
:align: center
76+
77+
You can use the :ref:`fiftyone config <cli-fiftyone-config>` CLI method to
78+
verify that you have correctly configured your API URI and API key:
79+
80+
.. code-block:: shell
81+
82+
$ fiftyone config
83+
{
84+
...
85+
"api_uri": "XXXXXXXX",
86+
"api_key": "YYYYYYYY",
87+
...
88+
}
89+
90+
You can also verify that your API connection is working correctly by executing
91+
the following method:
92+
93+
.. code-block:: python
94+
95+
# if this fails, you may have the open source SDK installed
96+
import fiftyone.management as fom
97+
98+
# if this succeeds, your API connection is working
99+
fom.test_api_connection()
100+
101+
Set cloud credentials locally
102+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
103+
104+
Next, configure the appropriate environment variables to register your
105+
:ref:`cloud credentials <enterprise-cloud-credentials>` in your local
106+
environment:
107+
108+
.. tabs::
109+
110+
.. group-tab:: AWS
111+
112+
Set the following environment variables:
113+
114+
.. code-block:: bash
115+
116+
export AWS_ACCESS_KEY_ID=...
117+
export AWS_SECRET_ACCESS_KEY=...
118+
export AWS_DEFAULT_REGION=...
119+
120+
.. group-tab:: GCP
121+
122+
Set the following environment variable:
123+
124+
.. code-block:: bash
125+
126+
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/your/service-account-key.json"
127+
128+
.. group-tab:: Azure
129+
130+
Set the following environment variables:
131+
132+
.. code-block:: bash
133+
134+
export AZURE_STORAGE_ACCOUNT=...
135+
export AZURE_STORAGE_KEY=...
136+
137+
.. group-tab:: MinIO
138+
139+
Set the following environment variables:
140+
141+
.. code-block:: bash
142+
143+
export MINIO_ACCESS_KEY_ID=...
144+
export MINIO_SECRET_ACCESS_KEY=...
145+
export MINIO_DEFAULT_REGION=...
146+
147+
Refer to :ref:`this page <enterprise-cloud-media>` for more information about
148+
interacting with cloud-backed media in FiftyOne Enterprise.
149+
150+
Import your data
151+
~~~~~~~~~~~~~~~~
152+
153+
The example code below shows the basic pattern for creating new datasets and
154+
populating them via the FiftyOne Enterprise Python SDK:
155+
156+
.. tabs::
157+
158+
.. group-tab:: AWS
159+
160+
.. code-block:: python
161+
162+
import fiftyone as fo
163+
import fiftyone.core.storage as fos
164+
165+
dataset = fo.Dataset("<name>")
166+
167+
s3_files = fos.list_files("s3://<bucket>/<prefix>", abs_paths=True)
168+
169+
samples = []
170+
for s3_uri in s3_files:
171+
if s3_uri.lower().endswith(".jpeg"):
172+
sample = fo.Sample(filepath=s3_uri)
173+
samples.append(sample)
174+
175+
dataset.add_samples(samples)
176+
177+
# You must mark the dataset as persistent to access it in the UI
178+
dataset.persistent = True
179+
180+
.. group-tab:: GCP
181+
182+
.. code-block:: python
183+
184+
import fiftyone as fo
185+
import fiftyone.core.storage as fos
186+
187+
dataset = fo.Dataset("<name>")
188+
189+
gcs_files = fos.list_files("gs://<bucket>/<prefix>", abs_paths=True)
190+
191+
samples = []
192+
for gcs_uri in gcs_files:
193+
if gcs_uri.lower().endswith(".jpeg"):
194+
sample = fo.Sample(filepath=gcs_uri)
195+
samples.append(sample)
196+
197+
dataset.add_samples(samples)
198+
199+
# You must mark the dataset as persistent to access it in the UI
200+
dataset.persistent = True
201+
202+
.. group-tab:: Azure
203+
204+
.. code-block:: python
205+
206+
import fiftyone as fo
207+
import fiftyone.core.storage as fos
208+
209+
dataset = fo.Dataset("<name>")
210+
211+
azure_files = fos.list_files(
212+
"https://<storage-account>.blob.core.windows.net/<container>/<prefix>",
213+
abs_paths=True,
214+
)
215+
216+
samples = []
217+
for azure_uri in azure_files:
218+
if azure_uri.lower().endswith(".jpeg"):
219+
sample = fo.Sample(filepath=azure_uri)
220+
samples.append(sample)
221+
222+
dataset.add_samples(samples)
223+
224+
# You must mark the dataset as persistent to access it in the UI
225+
dataset.persistent = True
226+
227+
.. group-tab:: MinIO
228+
229+
.. code-block:: python
230+
231+
import fiftyone as fo
232+
import fiftyone.core.storage as fos
233+
234+
dataset = fo.Dataset("<name>")
235+
236+
minio_files = fos.list_files(
237+
"https://minio.example.com/<bucket>/<prefix>",
238+
abs_paths=True,
239+
)
240+
241+
samples = []
242+
for minio_uri in minio_files:
243+
if minio_uri.lower().endswith(".jpeg"):
244+
sample = fo.Sample(filepath=minio_uri)
245+
samples.append(sample)
246+
247+
dataset.add_samples(samples)
248+
249+
# You must mark the dataset as persistent to access it in the UI
250+
dataset.persistent = True
251+
252+
Refer to :ref:`this page <importing-datasets>` for more information about
253+
importing your media and labels into FiftyOne via Python.
254+
255+
Compute metadata
256+
~~~~~~~~~~~~~~~~
257+
258+
All datasets/views provide a builtin
259+
:meth:`compute_metadata() <fiftyone.core.collections.SampleCollection.compute_metadata>`
260+
method that you can invoke to efficiently populate the `metadata` field of your
261+
samples with basic media type-specific metadata such as file size and
262+
image/video dimensions for all samples in a collection:
263+
264+
.. code-block:: python
265+
266+
dataset.compute_metadata()
267+
268+
sample = dataset.first()
269+
print(sample.metadata)
270+
271+
It is highly recommended to keep the `metadata` field populated for all samples
272+
of your datasets because it provides useful information upon which to
273+
search/filter and it enables the sample grid's tiling algorithm to run more
274+
efficiently.
275+
276+
You can verify that all samples in a dataset/view have metadata as follows:
277+
278+
.. code-block:: python
279+
280+
assert len(dataset.exists("metadata", False)) == 0
281+
282+
.. _enterprise-getting-started-ui:
283+
284+
Create a dataset via the UI
285+
---------------------------
286+
287+
.. note::
288+
289+
An admin must follow :ref:`these instructions <enterprise-plugins-install>`
290+
to install the
291+
`@voxel51/io <https://github.com/voxel51/fiftyone-plugins/blob/main/plugins/io/README.md>`_
292+
and
293+
`@voxel51/utils <https://github.com/voxel51/fiftyone-plugins/blob/main/plugins/utils/README.md>`_
294+
plugins in order for users to perform imports and compute metadata via the
295+
FiftyOne Enterprise UI.
296+
297+
Import your data
298+
~~~~~~~~~~~~~~~~
299+
300+
To create a new dataset, click on the "New dataset" button in the upper right
301+
corner of the FiftyOne Enterprise homepage. A pop-up will appear alowing you to
302+
choose a name and optional description/tags for the dataset:
303+
304+
.. image:: /images/enterprise/create_dataset.png
305+
:alt: create-dataset
306+
:align: center
307+
308+
You can then use the **import_samples** operator to import media and labels
309+
stored in a cloud storage bucket:
310+
311+
.. image:: /images/enterprise/getting_started_import_samples.gif
312+
:alt: getting-started-install-sdk
313+
:align: center
314+
315+
Compute metadata
316+
~~~~~~~~~~~~~~~~
317+
318+
You can use the **compute_metadata** operator to efficiently populate the
319+
`metadata` field of your samples with basic media type-specific metadata such
320+
as file size and image/video dimensions for all samples in a collection:
321+
322+
.. image:: /images/enterprise/getting_started_schedule_compute_metadata.gif
323+
:alt: getting-started-compute-metadata
324+
:align: center
325+
326+
It is highly recommended to keep the `metadata` field populated for all samples
327+
of your datasets because it provides useful information upon which to
328+
search/filter and it enables the sample grid's tiling algorithm to run more
329+
efficiently.

docs/source/enterprise/index.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ pages on this site apply to Enterprise deployments as well.
6868
:button_text: Install the SDK
6969
:button_link: installation.html
7070

71+
.. customcalloutitem::
72+
:header: Getting Started
73+
:description: Learn how to upload your first dataset to FiftyOne Enterprise.
74+
:button_text: Upload your first dataset
75+
:button_link: getting_started.html
76+
7177
.. customcalloutitem::
7278
:header: Cloud-backed media
7379
:description: Integrate FiftyOne Enterprise with your media stored in the cloud.
@@ -161,6 +167,7 @@ pages on this site apply to Enterprise deployments as well.
161167

162168
Overview <overview>
163169
Installation <installation>
170+
Getting Started <getting_started>
164171
API connection <api_connection>
165172
Cloud-backed media <cloud_media>
166173
Roles and permissions <roles_and_permissions>

0 commit comments

Comments
 (0)