1. Supported datasets
1.1. Support various common dataset formats
- docs.voxel51.com/user guide/dataset creation/datasets.html#supported import formats
- In addition, what datasets are on the zoo, you can load the corresponding datasets here
- Available Zoo Datasets — FiftyOne 0.20.1 documentation
2. Download the dataset from the cloud
2.1. Visualizing the COCO dataset
2.1.1. Open from browser
import fiftyone as fo
import fiftyone.zoo as foz
加载官方数据集coco2017,因为训练集太大,所以我们只下载验证集
dataset = foz.load_zoo_dataset(
"coco-2017",
split="validation",
dataset_name="evaluate-detections-tutorial",
)
通过fo来打开app可视化:
session = fo.launch_app() 打开APP
session.dataset = dataset 添加数据集
session.wait() 官网给的示例没有这一句,记得加上,不然程序不会等待,在网页中看不到我们要的效果
2.1.2. Open the operation page in the APP
the code
import fiftyone as fo
import fiftyone.zoo as foz
dataset = foz.load_zoo_dataset("quickstart")
session = fo.launch_app(dataset,port = 5151,desktop=True) # 没有指定port则默则5151
session.wait() # 官网给的示例没有这一句,记得加上,不然程序不会等待,在网页中看不到我们要的效果
- Read the cifar10 dataset
the code
import fiftyone as fo
import fiftyone.zoo as foz
# 加载官方数据集coco2017,因为训练集太大,所以我们只下载验证集
dataset = foz.load_zoo_dataset(
"cifar10",
split="test",
dataset_name="evaluate-detections-tutorial",
)
# 通过fo来打开app可视化:
session = fo.launch_app() # 打开APP
session.dataset = dataset # 添加数据集
session.wait() # 官网给的示例没有这一句,记得加上,不然程序不会等待,在网页中看不到我们要的效果
3. Read custom format dataset
3.1. Visualizing the VOC dataset
3.1.1. Format requirements
The data in vc format only needs to put the image in the data folder, and then put the label in the labels folder
<dataset_dir>/
data/
<uuid1>.<ext>
<uuid2>.<ext>
...
labels/
<uuid1>.xml
<uuid2>.xml
...
3.1.2. Code
Read the entire dataset folder
import fiftyone as fo
# A name for the dataset
name = "my-dataset"
# The directory containing the dataset to import
dataset_dir = "dataset/RBC"
# The type of the dataset being imported
dataset_type = fo.types.VOCDetectionDataset # for example
dataset = fo.Dataset.from_dir(
dataset_dir=dataset_dir,
dataset_type=dataset_type,
name=name,
)
session = fo.launch_app() # 打开APP
session.dataset = dataset # 添加数据集
session.wait() # 官网给的示例没有这一句,记得加上,不然程序不会等待,在网页中看不到我们要的效果
Specify paths to images and annotations
import fiftyone as fo
name = "my-dataset-1"
data_path = "dataset/RBC/data"
labels_path = "dataset/RBC/labels"
dataset = fo.Dataset.from_dir(
dataset_type=fo.types.VOCDetectionDataset,
data_path=data_path,
labels_path=labels_path,
name=name,
)
session = fo.launch_app() # 打开APP
session.dataset = dataset # 添加数据集
session.wait() # 官网给的示例没有这一句,记得加上,不然程序不会等待,在网页中看不到我们要的效果