Làm cách nào để tạo các thư mục con hình ảnh trong Python dựa trên nhãn hình ảnh?

FiftyOne cung cấp hỗ trợ gốc để nhập tập dữ liệu từ đĩa ở nhiều định dạng khác nhau và có thể dễ dàng mở rộng để nhập tập dữ liệu ở định dạng

Ghi chú

Nếu dữ liệu của bạn ở định dạng tùy chỉnh, đây là cách dễ nhất để tải dữ liệu của bạn vào FiftyOne

công thức cơ bản

Giao diện để tạo FiftyOne cho dữ liệu của bạn trên đĩa được hiển thị thuận tiện thông qua thư viện Python và CLI. Công thức cơ bản là bạn chỉ cần chỉ định (các) đường dẫn đến dữ liệu trên đĩa và loại tập dữ liệu mà bạn đang tải

con trăn

CLI

Bạn có thể nhập từ đĩa thông qua phương thức xuất xưởng

Nếu dữ liệu của bạn được lưu trữ ở loại bạn đang nhập, thì bạn có thể tải dữ liệu đó bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
55

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)

Ngoài ra, khi nhập tập dữ liệu được gắn nhãn ở định dạng chẳng hạn như , bạn có thể thấy việc cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 để chỉ định độc lập vị trí của phương tiện nguồn trên đĩa và tệp chú thích chứa nhãn cần nhập một cách tự nhiên hơn.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)

Nhiều định dạng như cũng hỗ trợ lưu trữ đường dẫn tệp tuyệt đối đến phương tiện nguồn trực tiếp trong nhãn, trong trường hợp đó, bạn chỉ có thể cung cấp tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57

1
2
3
4
5
6
7
8

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)

Nói chung, bạn có thể chuyển bất kỳ tham số nào cho định dạng mà bạn đang nhập vào. Ví dụ: hầu hết các trình nhập dựng sẵn đều hỗ trợ các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
61,
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
62 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
63 tùy chọn, cung cấp hỗ trợ để nhập một tập hợp con nhỏ của tập dữ liệu lớn tiềm năng

1
2
3
4
5
6
7

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)

Bạn có thể nhập tập dữ liệu từ đĩa vào FiftyOne

Nếu dữ liệu của bạn được lưu trữ ở loại bạn đang nhập, thì bạn có thể tải dữ liệu đó bằng cách cung cấp các tùy chọn

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
64 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
65

# A name for the dataset
NAME=my-dataset

# The directory containing the dataset to import
DATASET_DIR=/path/to/dataset

# The type of the dataset being imported
# Any subclass of `fiftyone.types.Dataset` is supported
TYPE=fiftyone.types.COCODetectionDataset  # for example

# Import the dataset
fiftyone datasets create --name $NAME --dataset-dir $DATASET_DIR --type $TYPE

Ngoài ra, khi nhập bộ dữ liệu được gắn nhãn ở các định dạng chẳng hạn như , bạn có thể thấy việc cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 thông qua để chỉ định độc lập vị trí của phương tiện nguồn trên đĩa và tệp chú thích có chứa nhãn để nhập một cách tự nhiên hơn

# The directory containing the source images
DATA_PATH=/path/to/images

# The path to the COCO labels JSON file
LABELS_PATH=/path/to/coco-labels.json

# Import the dataset
fiftyone datasets create --name my-dataset \
    --type fiftyone.types.COCODetectionDataset \
    --kwargs \
        data_path=$DATA_PATH \
        labels_path=$LABELS_PATH

Nhiều định dạng như cũng hỗ trợ lưu trữ đường dẫn tệp tuyệt đối đến phương tiện nguồn trực tiếp trong nhãn, trong trường hợp đó, bạn chỉ có thể cung cấp tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
0

Nói chung, bạn có thể chuyển bất kỳ tham số nào cho định dạng bạn đang nhập thông qua. Ví dụ: hầu hết các trình nhập dựng sẵn đều hỗ trợ các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
61,
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
62 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
63 tùy chọn, cung cấp hỗ trợ để nhập một tập hợp con nhỏ của tập dữ liệu lớn tiềm năng

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
1

định dạng được hỗ trợ

Mỗi loại tập dữ liệu được hỗ trợ được đại diện bởi một lớp con của , được thư viện Python và CLI sử dụng để chỉ định dạng tập dữ liệu tương ứng khi đọc tập dữ liệu từ đĩa

Loại tập dữ liệu

Sự miêu tả

Thư mục hình ảnh

Danh mục video

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và nhãn phân loại được liên kết của chúng ở định dạng JSON đơn giản

Cây thư mục có các thư mục con xác định bộ dữ liệu phân loại hình ảnh

Cây thư mục có các thư mục con xác định bộ dữ liệu phân loại video

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và nhãn phân loại liên quan của chúng được lưu trữ dưới dạng TFRecords

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng liên quan của chúng được lưu trữ ở định dạng JSON đơn giản

Tập dữ liệu được gắn nhãn bao gồm video và các phát hiện tạm thời được liên kết của chúng ở định dạng JSON đơn giản

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng liên quan của chúng được lưu trong

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng liên quan của chúng được lưu ở định dạng VOC

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng liên quan của chúng được lưu ở định dạng KITTI

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng liên quan của chúng được lưu ở định dạng YOLOv4

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng liên quan của chúng được lưu ở định dạng YOLOv5

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng liên quan của chúng được lưu trữ dưới dạng TFRecords ở định dạng API phát hiện đối tượng TF

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và các phân đoạn ngữ nghĩa liên quan của chúng được lưu trữ dưới dạng hình ảnh trên đĩa

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và nhãn đa tác vụ được liên kết của chúng được lưu trữ ở định dạng hình ảnh CVAT

Tập dữ liệu được gắn nhãn bao gồm các video và nhãn đa tác vụ được liên kết của chúng được lưu trữ ở định dạng video CVAT

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và nhãn đa tác vụ được liên kết của chúng được lưu trữ ở định dạng OpenLABEL

Tập dữ liệu được gắn nhãn bao gồm các video và nhãn đa tác vụ được liên kết của chúng được lưu trữ ở định dạng OpenLABEL

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và các dự đoán đa nhiệm liên quan của chúng được lưu trữ ở định dạng ETA ImageLabels

Tập dữ liệu được gắn nhãn bao gồm các hình ảnh và các dự đoán đa nhiệm liên quan của chúng được lưu ở định dạng Berkeley DeepDrive (BDD)

Tập dữ liệu hình ảnh có dữ liệu hình ảnh và thuộc tính tùy chọn được lưu trữ ở định dạng DICOM

Tập dữ liệu hình ảnh hoặc video có dữ liệu vị trí và nhãn được lưu trữ ở định dạng GeoJSON

Tập dữ liệu hình ảnh có dữ liệu hình ảnh và vị trí địa lý được lưu trữ ở định dạng GeoTIFF

Tập dữ liệu được gắn nhãn bao gồm các video và dự đoán đa nhiệm liên quan của chúng được lưu trữ ở định dạng ETA VideoLabels

Tập dữ liệu bao gồm toàn bộ phương tiện truyền thông nguồn được xuất bản nhiều kỳ và liên kết với nó

Nhập bộ dữ liệu ở định dạng tùy chỉnh bằng cách xác định lớp hoặc lớp của riêng bạn

thư mục hình ảnh

Loại đại diện cho một thư mục hình ảnh

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
2

nơi các tệp có loại MIME không phải hình ảnh bị bỏ qua

Theo mặc định, tập dữ liệu có thể chứa các thư mục con hình ảnh lồng nhau, được liệt kê đệ quy

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ thư mục hình ảnh như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
4

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
5

Để xem thư mục hình ảnh trong Ứng dụng FiftyOne mà không cần tạo bộ dữ liệu FiftyOne liên tục, bạn có thể thực thi

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
6

Thư mục video

Loại đại diện cho một thư mục video

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
2

nơi các tệp có loại MIME không phải video bị bỏ qua

Theo mặc định, tập dữ liệu có thể chứa các thư mục con lồng nhau của video, được liệt kê đệ quy

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ thư mục video như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
9

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
0

Để xem thư mục video trong Ứng dụng FiftyOne mà không cần tạo bộ dữ liệu FiftyOne liên tục, bạn có thể thực thi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
1

FiftyOneImageClassificationDataset

Loại đại diện cho một tập dữ liệu được gắn nhãn bao gồm các hình ảnh và (các) nhãn phân loại được liên kết của chúng được lưu trữ ở định dạng JSON đơn giản

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
2

Trong trường hợp đơn giản nhất,

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
84 có thể là tệp JSON ở định dạng sau

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
3

Nếu trường

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
85 được cung cấp, các giá trị
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
86 là ID lớp được ánh xạ tới chuỗi nhãn lớp thông qua
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
87. Nếu không có trường
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
85 nào được cung cấp, thì các giá trị
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
86 sẽ lưu trữ trực tiếp các chuỗi nhãn

Giá trị mục tiêu trong

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
90 cho hình ảnh không được gắn nhãn là
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
91 (hoặc bị thiếu)

Các UUID cũng có thể là các đường dẫn tương đối như

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
92, trong trường hợp đó, các hình ảnh trong
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93 phải được sắp xếp trong các thư mục con lồng nhau có tên tương ứng hoặc chúng có thể là các đường dẫn tuyệt đối, trong trường hợp đó các hình ảnh có thể có hoặc không có trong
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93

Ngoài ra,

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
84 có thể chứa các dự đoán với độ tin cậy được liên kết và các thuộc tính bổ sung ở định dạng sau

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
4

Bạn cũng có thể tải các phân loại nhiều nhãn ở định dạng này bằng cách lưu trữ danh sách các mục tiêu trong

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
84

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
5

trong đó các giá trị đích trong

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
90 có thể là chuỗi lớp, ID lớp hoặc ký hiệu ở định dạng được mô tả ở trên xác định nhãn lớp, thông tin mật và thuộc tính tùy chọn

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu phân loại hình ảnh được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
7

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
8

Để xem tập dữ liệu phân loại hình ảnh trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
9

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
1

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
2

Ghi chú

Nếu UUID trong nhãn của bạn là đường dẫn tuyệt đối đến phương tiện nguồn, thì bạn có thể bỏ qua tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 từ ví dụ trên

ImageClassificationDirectoryTree

Loại đại diện cho một cây thư mục có các thư mục con xác định bộ dữ liệu phân loại hình ảnh

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
3

Hình ảnh chưa được gắn nhãn được lưu trữ trong thư mục con có tên

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
05

Mỗi thư mục lớp có thể chứa các thư mục con hình ảnh lồng nhau

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ cây thư mục phân loại hình ảnh được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
5

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
6

Để xem cây thư mục phân loại hình ảnh trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
7

VideoPhân loạiThư mụcCây

Loại đại diện cho một cây thư mục có các thư mục con xác định tập dữ liệu phân loại video

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
8

Các video chưa gắn nhãn được lưu trữ trong thư mục con có tên

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
05

Mỗi thư mục lớp có thể chứa các thư mục con lồng nhau của video

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ cây thư mục phân loại video được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

1
2
3
4
5
6
7
8
0

1
2
3
4
5
6
7
8
1

Để xem cây thư mục phân loại video trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

1
2
3
4
5
6
7
8
2

TFImageClassificationDataset

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các hình ảnh và nhãn phân loại liên quan của chúng được lưu trữ dưới dạng TFRecords

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

1
2
3
4
5
6
7
8
3

trong đó các tính năng của TFRecords (có thể bị phân mảnh) được lưu trữ ở định dạng sau

1
2
3
4
5
6
7
8
4

Đối với các mẫu không được gắn nhãn, TFRecords không chứa các tính năng

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
13

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu phân loại hình ảnh được lưu trữ dưới dạng thư mục TFRecords ở định dạng trên như sau

con trăn

CLI

1
2
3
4
5
6
7
8
5

1
2
3
4
5
6
7
8
6

Khi lệnh trên được thực thi, hình ảnh trong TFRecords sẽ được ghi vào

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
16 được cung cấp, điều này là bắt buộc vì bộ dữ liệu FiftyOne phải cung cấp hình ảnh của chúng dưới dạng các tệp riêng lẻ trên đĩa

1
2
3
4
5
6
7
8
7

Khi lệnh trên được thực thi, hình ảnh trong TFRecords sẽ được ghi vào

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
17 được cung cấp, điều này là bắt buộc vì bộ dữ liệu FiftyOne phải cung cấp hình ảnh của chúng dưới dạng các tệp riêng lẻ trên đĩa

Để xem tập dữ liệu phân loại hình ảnh được lưu trữ dưới dạng thư mục TFRecords trong Ứng dụng FiftyOne mà không tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

1
2
3
4
5
6
7
8
8

Ghi chú

Bạn có thể cung cấp đối số

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
18 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54 trong các ví dụ trên để chỉ định trực tiếp đường dẫn đến (các) TFRecord cần tải. Xem để biết chi tiết

FiftyOneImageDetectionDataset

Loại đại diện cho một tập dữ liệu được gắn nhãn bao gồm các hình ảnh và các phát hiện đối tượng được liên kết của chúng được lưu trữ ở định dạng JSON đơn giản

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
2

trong đó

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
84 là một tệp JSON ở định dạng sau

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
0

và nơi tọa độ hộp giới hạn được thể hiện dưới dạng giá trị tương đối trong

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
23

Nếu trường

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
85 được cung cấp, các giá trị
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
86 là ID lớp được ánh xạ tới chuỗi nhãn lớp thông qua
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
87. Nếu không có trường
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
85 nào được cung cấp, thì các giá trị
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
86 sẽ lưu trữ trực tiếp các chuỗi nhãn

Giá trị mục tiêu trong

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
90 cho hình ảnh không được gắn nhãn là
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
91 (hoặc bị thiếu)

Các UUID cũng có thể là các đường dẫn tương đối như

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
92, trong trường hợp đó, các hình ảnh trong
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93 phải được sắp xếp trong các thư mục con lồng nhau có tên tương ứng hoặc chúng có thể là các đường dẫn tuyệt đối, trong trường hợp đó các hình ảnh có thể có hoặc không có trong
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu phát hiện hình ảnh được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
2

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
3

Để xem tập dữ liệu phát hiện hình ảnh được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
4

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
6

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
7

Ghi chú

Nếu UUID trong nhãn của bạn là đường dẫn tuyệt đối đến phương tiện nguồn, thì bạn có thể bỏ qua tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 từ ví dụ trên

FiftyOneTemporalDetectionDataset

Loại đại diện cho một tập dữ liệu được gắn nhãn bao gồm các video và các phát hiện tạm thời được liên kết của chúng được lưu trữ ở định dạng JSON đơn giản

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
2

trong đó

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
84 là một tệp JSON ở định dạng sau

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
9

Phạm vi thời gian của từng lần phát hiện có thể được chỉ định thông qua khóa

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
42, khóa này sẽ chứa số khung
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
43 của lần phát hiện hoặc khóa
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
44, khóa này sẽ chứa dấu thời gian
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
45 của lần phát hiện tính bằng giây

Nếu trường

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
85 được cung cấp, các giá trị
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
86 là ID lớp được ánh xạ tới chuỗi nhãn lớp thông qua
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
87. Nếu không có trường
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
85 nào được cung cấp, thì các giá trị
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
86 sẽ lưu trữ trực tiếp các chuỗi nhãn

Các video không được gắn nhãn có thể có khóa

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
91 (hoặc bị thiếu) trong
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
90

Các UUID cũng có thể là các đường dẫn tương đối như

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
92, trong trường hợp đó, các hình ảnh trong
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93 phải được sắp xếp trong các thư mục con lồng nhau có tên tương ứng hoặc chúng có thể là các đường dẫn tuyệt đối, trong trường hợp đó các hình ảnh có thể có hoặc không có trong
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu phát hiện tạm thời được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

1
2
3
4
5
6
7
1

1
2
3
4
5
6
7
2

Để xem tập dữ liệu phát hiện tạm thời trong Ứng dụng FiftyOne mà không tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

1
2
3
4
5
6
7
3

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

1
2
3
4
5
6
7
5

1
2
3
4
5
6
7
6

Ghi chú

Nếu UUID trong nhãn của bạn là đường dẫn tuyệt đối đến phương tiện nguồn, thì bạn có thể bỏ qua tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 từ ví dụ trên

Bộ dữ liệu phát hiện COCO

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng được liên kết của chúng được lưu trong

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

1
2
3
4
5
6
7
7

trong đó

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
84 là một tệp JSON ở định dạng sau

1
2
3
4
5
6
7
8

Xem thông số kỹ thuật đầy đủ của trường

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
64

Đối với tập dữ liệu chưa được gắn nhãn,

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
84 không chứa trường
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
66

Thuộc tính

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
67 của tệp nhãn mã hóa vị trí của các hình ảnh tương ứng, có thể là bất kỳ vị trí nào sau đây

  • Tên tệp của một hình ảnh trong thư mục

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    93

  • Đường dẫn tương đối như

    # The directory containing the source images
    data_path = "/path/to/images"
    
    # The path to the COCO labels JSON file
    labels_path = "/path/to/coco-labels.json"
    
    # Import the dataset
    dataset = fo.Dataset.from_dir(
        dataset_type=fo.types.COCODetectionDataset,
        data_path=data_path,
        labels_path=labels_path,
    )
    
    69 chỉ định đường dẫn tương đối tới hình ảnh trong thư mục con lồng nhau của
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    93

  • Một đường dẫn tuyệt đối đến một hình ảnh, có thể có hoặc không có trong thư mục

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    93

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu phát hiện COCO được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)
0

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)
1

Để xem tập dữ liệu phát hiện COCO được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)
2

Ghi chú

Theo mặc định, tất cả các loại nhãn được hỗ trợ đều được tải (phát hiện, phân đoạn và điểm chính). Tuy nhiên, bạn có thể chọn (các) loại cụ thể để tải bằng cách chuyển đối số

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
74 tùy chọn cho các phương thức như

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)
3

Xem tài liệu đầy đủ về các tùy chọn nhập COCO có sẵn

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)
5

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)
6

Ghi chú

Nếu khóa

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
67 của nhãn chứa đường dẫn tuyệt đối đến phương tiện nguồn, thì bạn có thể bỏ qua tham số
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 từ ví dụ trên

Nếu bạn có tập dữ liệu hiện có và dự đoán mô hình tương ứng được lưu trữ ở định dạng COCO, thì bạn có thể sử dụng để thêm nhãn vào tập dữ liệu một cách thuận tiện. Ví dụ bên dưới minh họa quá trình xuất khứ hồi rồi nhập lại cả dữ liệu hình ảnh và nhãn và chỉ nhãn ở định dạng COCO

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)
7

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)
8

Ghi chú

Xem mô tả đầy đủ về các cú pháp có sẵn để tải các dự đoán có định dạng COCO vào tập dữ liệu hiện có

Bộ dữ liệu phát hiện VOC

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng liên quan của chúng được lưu ở định dạng VOC

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)
9

trong đó các tệp XML nhãn có định dạng sau

# A name for the dataset
NAME=my-dataset

# The directory containing the dataset to import
DATASET_DIR=/path/to/dataset

# The type of the dataset being imported
# Any subclass of `fiftyone.types.Dataset` is supported
TYPE=fiftyone.types.COCODetectionDataset  # for example

# Import the dataset
fiftyone datasets create --name $NAME --dataset-dir $DATASET_DIR --type $TYPE
0

trong đó trường

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
85 và/hoặc
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
86 của chú thích có thể được điền để chỉ định hình ảnh nguồn tương ứng

Hình ảnh không được gắn nhãn không có tệp tương ứng trong

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87

Các tệp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93 và
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87 có thể chứa các thư mục con lồng nhau của các hình ảnh và mặt nạ được sắp xếp song song

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu phát hiện VOC được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

# A name for the dataset
NAME=my-dataset

# The directory containing the dataset to import
DATASET_DIR=/path/to/dataset

# The type of the dataset being imported
# Any subclass of `fiftyone.types.Dataset` is supported
TYPE=fiftyone.types.COCODetectionDataset  # for example

# Import the dataset
fiftyone datasets create --name $NAME --dataset-dir $DATASET_DIR --type $TYPE
2

# A name for the dataset
NAME=my-dataset

# The directory containing the dataset to import
DATASET_DIR=/path/to/dataset

# The type of the dataset being imported
# Any subclass of `fiftyone.types.Dataset` is supported
TYPE=fiftyone.types.COCODetectionDataset  # for example

# Import the dataset
fiftyone datasets create --name $NAME --dataset-dir $DATASET_DIR --type $TYPE
3

Để xem tập dữ liệu phát hiện VOC được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

# A name for the dataset
NAME=my-dataset

# The directory containing the dataset to import
DATASET_DIR=/path/to/dataset

# The type of the dataset being imported
# Any subclass of `fiftyone.types.Dataset` is supported
TYPE=fiftyone.types.COCODetectionDataset  # for example

# Import the dataset
fiftyone datasets create --name $NAME --dataset-dir $DATASET_DIR --type $TYPE
4

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

# A name for the dataset
NAME=my-dataset

# The directory containing the dataset to import
DATASET_DIR=/path/to/dataset

# The type of the dataset being imported
# Any subclass of `fiftyone.types.Dataset` is supported
TYPE=fiftyone.types.COCODetectionDataset  # for example

# Import the dataset
fiftyone datasets create --name $NAME --dataset-dir $DATASET_DIR --type $TYPE
6

# A name for the dataset
NAME=my-dataset

# The directory containing the dataset to import
DATASET_DIR=/path/to/dataset

# The type of the dataset being imported
# Any subclass of `fiftyone.types.Dataset` is supported
TYPE=fiftyone.types.COCODetectionDataset  # for example

# Import the dataset
fiftyone datasets create --name $NAME --dataset-dir $DATASET_DIR --type $TYPE
7

Ghi chú

Nếu trường

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
86 của nhãn của bạn được điền bằng các đường dẫn tuyệt đối tới phương tiện nguồn, thì bạn có thể bỏ qua tham số
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 từ ví dụ trên

KITTIDetectionBộ dữ liệu

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng liên quan của chúng được lưu ở định dạng KITTI

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

# A name for the dataset
NAME=my-dataset

# The directory containing the dataset to import
DATASET_DIR=/path/to/dataset

# The type of the dataset being imported
# Any subclass of `fiftyone.types.Dataset` is supported
TYPE=fiftyone.types.COCODetectionDataset  # for example

# Import the dataset
fiftyone datasets create --name $NAME --dataset-dir $DATASET_DIR --type $TYPE
8

trong đó các tệp TXT nhãn là các tệp được phân tách bằng dấu cách trong đó mỗi hàng tương ứng với một đối tượng và cột 15 (và điểm thứ 16 tùy chọn) có các ý nghĩa sau

# cột

Tên

Sự miêu tả

Vỡ nợ

1

loại

Nhãn đối tượng

1

cắt ngắn

Một số float trong

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
98, trong đó 0 không bị cắt bớt và 1 bị cắt cụt hoàn toàn. Ở đây, cắt bớt đề cập đến đối tượng để lại ranh giới hình ảnh

0

1

bị tắc

Một int trong

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
99 biểu thị trạng thái tắc, trong đó. - 0 = hiển thị đầy đủ- 1 = bị che một phần- 2 = bị che phần lớn- 3 = không xác định

0

1

chữ cái

Góc quan sát của đối tượng, trong

1
2
3
4
5
6
7
8
00

0

4

bbox

Hộp giới hạn 2D của đối tượng trong ảnh tính bằng pixel, ở định dạng

1
2
3
4
5
6
7
8
01

1

kích thước

Kích thước đối tượng 3D, tính bằng mét, ở định dạng

1
2
3
4
5
6
7
8
02

0

1

vị trí

Vị trí đối tượng 3D

1
2
3
4
5
6
7
8
03 trong tọa độ camera (tính bằng mét)

0

1

xoay_y

Xoay quanh trục y trong tọa độ máy ảnh, trong

1
2
3
4
5
6
7
8
00

0

1

điểm

1
2
3
4
5
6
7
8
05 Độ tin cậy thả nổi để phát hiện

Khi đọc bộ dữ liệu thuộc loại này, tất cả các cột sau bốn cột

1
2
3
4
5
6
7
8
06 là tùy chọn

Hình ảnh không được gắn nhãn không có tệp tương ứng trong

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87

Các tệp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93 và
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87 có thể chứa các thư mục con lồng nhau của các hình ảnh và mặt nạ được sắp xếp song song

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu phát hiện KITTI được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

# The directory containing the source images
DATA_PATH=/path/to/images

# The path to the COCO labels JSON file
LABELS_PATH=/path/to/coco-labels.json

# Import the dataset
fiftyone datasets create --name my-dataset \
    --type fiftyone.types.COCODetectionDataset \
    --kwargs \
        data_path=$DATA_PATH \
        labels_path=$LABELS_PATH
0

# The directory containing the source images
DATA_PATH=/path/to/images

# The path to the COCO labels JSON file
LABELS_PATH=/path/to/coco-labels.json

# Import the dataset
fiftyone datasets create --name my-dataset \
    --type fiftyone.types.COCODetectionDataset \
    --kwargs \
        data_path=$DATA_PATH \
        labels_path=$LABELS_PATH
1

Để xem tập dữ liệu phát hiện KITTI được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

# The directory containing the source images
DATA_PATH=/path/to/images

# The path to the COCO labels JSON file
LABELS_PATH=/path/to/coco-labels.json

# Import the dataset
fiftyone datasets create --name my-dataset \
    --type fiftyone.types.COCODetectionDataset \
    --kwargs \
        data_path=$DATA_PATH \
        labels_path=$LABELS_PATH
2

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

# The directory containing the source images
DATA_PATH=/path/to/images

# The path to the COCO labels JSON file
LABELS_PATH=/path/to/coco-labels.json

# Import the dataset
fiftyone datasets create --name my-dataset \
    --type fiftyone.types.COCODetectionDataset \
    --kwargs \
        data_path=$DATA_PATH \
        labels_path=$LABELS_PATH
4

# The directory containing the source images
DATA_PATH=/path/to/images

# The path to the COCO labels JSON file
LABELS_PATH=/path/to/coco-labels.json

# Import the dataset
fiftyone datasets create --name my-dataset \
    --type fiftyone.types.COCODetectionDataset \
    --kwargs \
        data_path=$DATA_PATH \
        labels_path=$LABELS_PATH
5

Bộ dữ liệu YOLOv4

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng liên quan của chúng được lưu ở định dạng YOLOv4

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

# The directory containing the source images
DATA_PATH=/path/to/images

# The path to the COCO labels JSON file
LABELS_PATH=/path/to/coco-labels.json

# Import the dataset
fiftyone datasets create --name my-dataset \
    --type fiftyone.types.COCODetectionDataset \
    --kwargs \
        data_path=$DATA_PATH \
        labels_path=$LABELS_PATH
6

trong đó

1
2
3
4
5
6
7
8
16 chứa nhãn lớp đối tượng

# The directory containing the source images
DATA_PATH=/path/to/images

# The path to the COCO labels JSON file
LABELS_PATH=/path/to/coco-labels.json

# Import the dataset
fiftyone datasets create --name my-dataset \
    --type fiftyone.types.COCODetectionDataset \
    --kwargs \
        data_path=$DATA_PATH \
        labels_path=$LABELS_PATH
7

1
2
3
4
5
6
7
8
17 chứa danh sách các hình ảnh trong
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93

# The directory containing the source images
DATA_PATH=/path/to/images

# The path to the COCO labels JSON file
LABELS_PATH=/path/to/coco-labels.json

# Import the dataset
fiftyone datasets create --name my-dataset \
    --type fiftyone.types.COCODetectionDataset \
    --kwargs \
        data_path=$DATA_PATH \
        labels_path=$LABELS_PATH
8

Đường dẫn hình ảnh trong

1
2
3
4
5
6
7
8
17 có thể được chỉ định là đường dẫn tương đối (đến vị trí của tệp) hoặc là đường dẫn tuyệt đối. Ngoài ra, tệp này có thể được bỏ qua, trong trường hợp đó, thư mục
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93 được liệt kê để xác định các hình ảnh có sẵn

Các tệp TXT trong

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93 là các tệp được phân tách bằng dấu cách trong đó mỗi hàng tương ứng với một đối tượng trong hình ảnh cùng tên, ở một trong các định dạng sau

# The directory containing the source images
DATA_PATH=/path/to/images

# The path to the COCO labels JSON file
LABELS_PATH=/path/to/coco-labels.json

# Import the dataset
fiftyone datasets create --name my-dataset \
    --type fiftyone.types.COCODetectionDataset \
    --kwargs \
        data_path=$DATA_PATH \
        labels_path=$LABELS_PATH
9

trong đó

1
2
3
4
5
6
7
8
22 là chỉ số nguyên dựa trên số 0 của nhãn lớp đối tượng từ
1
2
3
4
5
6
7
8
16, tọa độ hộp giới hạn được biểu thị dưới dạng tọa độ tương đối trong
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
23 và
1
2
3
4
5
6
7
8
25 là độ tin cậy phát hiện tùy chọn trong
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
98

Hình ảnh không được gắn nhãn không có tệp TXT tương ứng trong

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93

Thư mục

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93 có thể chứa các thư mục con lồng nhau

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu YOLOv4 được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
01

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
02

Để xem tập dữ liệu YOLOv4 được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
03

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
04

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
05

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
06

Nếu bạn có tập dữ liệu hiện có và dự đoán mô hình tương ứng được lưu trữ ở định dạng YOLO, thì bạn có thể sử dụng để thêm nhãn vào tập dữ liệu một cách thuận tiện

Ví dụ bên dưới minh họa quá trình xuất khứ hồi rồi nhập lại cả dữ liệu hình ảnh và nhãn và chỉ nhãn ở định dạng YOLO

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)
7

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
08

Ghi chú

Xem mô tả đầy đủ về các cú pháp có sẵn để tải các dự đoán có định dạng YOLO vào tập dữ liệu hiện có

YOLOv5Bộ dữ liệu

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng liên quan của chúng được lưu ở định dạng YOLOv5

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
09

trong đó

1
2
3
4
5
6
7
8
37 chứa thông tin sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
10

Xem trang này để biết mô tả đầy đủ về định dạng có thể có của

1
2
3
4
5
6
7
8
37. Cụ thể, tập dữ liệu có thể chứa một hoặc nhiều phần tách với tên tùy ý, vì phần tách cụ thể được nhập hoặc xuất được chỉ định bởi đối số
1
2
3
4
5
6
7
8
39 để. Ngoài ra,
1
2
3
4
5
6
7
8
37 có thể được đặt bên ngoài
1
2
3
4
5
6
7
8
42 miễn là cung cấp tùy chọn
1
2
3
4
5
6
7
8
43

Ghi chú

Bất kỳ đường dẫn tương đối nào trong tệp

1
2
3
4
5
6
7
8
37 hoặc mỗi tệp TXT được phân tách đều được diễn giải tương ứng với thư mục chứa các tệp này, không phải thư mục làm việc hiện tại của bạn

Các tệp TXT trong

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87 là các tệp được phân tách bằng dấu cách trong đó mỗi hàng tương ứng với một đối tượng trong hình ảnh cùng tên, ở một trong các định dạng sau

# The directory containing the source images
DATA_PATH=/path/to/images

# The path to the COCO labels JSON file
LABELS_PATH=/path/to/coco-labels.json

# Import the dataset
fiftyone datasets create --name my-dataset \
    --type fiftyone.types.COCODetectionDataset \
    --kwargs \
        data_path=$DATA_PATH \
        labels_path=$LABELS_PATH
9

trong đó

1
2
3
4
5
6
7
8
22 là chỉ số nguyên dựa trên số 0 của nhãn lớp đối tượng từ
1
2
3
4
5
6
7
8
47, tọa độ hộp giới hạn được biểu thị dưới dạng tọa độ tương đối trong
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
23 và
1
2
3
4
5
6
7
8
25 là độ tin cậy phát hiện tùy chọn trong
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
98

Hình ảnh không được gắn nhãn không có tệp TXT tương ứng trong

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87. Đường dẫn tệp nhãn cho mỗi hình ảnh có được bằng cách thay thế
1
2
3
4
5
6
7
8
52 bằng
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87 trong đường dẫn hình ảnh tương ứng

Các thư mục hình ảnh và nhãn cho một phần tách nhất định có thể chứa các thư mục con lồng nhau của các hình ảnh và nhãn được sắp xếp song song

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu YOLOv5 được lưu trữ ở định dạng trên như sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
12

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
13

Nếu bạn có tập dữ liệu hiện có và dự đoán mô hình tương ứng được lưu trữ ở định dạng YOLO, thì bạn có thể sử dụng để thêm nhãn vào tập dữ liệu một cách thuận tiện

Ví dụ bên dưới minh họa quá trình xuất khứ hồi rồi nhập lại cả dữ liệu hình ảnh và nhãn và chỉ nhãn ở định dạng YOLO

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
14

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
15

Ghi chú

Xem mô tả đầy đủ về các cú pháp có sẵn để tải các dự đoán có định dạng YOLO vào tập dữ liệu hiện có

TFObjectDetectionDataset

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các hình ảnh và phát hiện đối tượng được liên kết của chúng được lưu trữ dưới dạng TFRecords ở định dạng API phát hiện đối tượng TF

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

1
2
3
4
5
6
7
8
3

trong đó các tính năng của TFRecords (có thể bị phân mảnh) được lưu trữ ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
17

TFRecords cho các mẫu không được gắn nhãn không chứa các tính năng

1
2
3
4
5
6
7
8
59

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu phát hiện đối tượng được lưu trữ dưới dạng thư mục TFRecords ở định dạng trên như sau

con trăn

CLI

1
2
3
4
5
6
7
8
5

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
19

Khi lệnh trên được thực thi, hình ảnh trong TFRecords sẽ được ghi vào

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
16 được cung cấp, điều này là bắt buộc vì bộ dữ liệu FiftyOne phải cung cấp hình ảnh của chúng dưới dạng các tệp riêng lẻ trên đĩa

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
20

Khi lệnh trên được thực thi, hình ảnh trong TFRecords sẽ được ghi vào

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
17 được cung cấp, điều này là bắt buộc vì bộ dữ liệu FiftyOne phải cung cấp hình ảnh của chúng dưới dạng tệp riêng lẻ trên đĩa

Để xem tập dữ liệu phát hiện đối tượng được lưu trữ dưới dạng thư mục TFRecords trong Ứng dụng FiftyOne mà không tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
21

Ghi chú

Bạn có thể cung cấp đối số

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
18 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54 trong các ví dụ trên để chỉ định trực tiếp đường dẫn đến (các) TFRecord cần tải. Xem để biết chi tiết

ImageSegmentationDirectory

Loại đại diện cho một tập dữ liệu được gắn nhãn bao gồm các hình ảnh và các phân đoạn ngữ nghĩa liên quan của chúng được lưu trữ dưới dạng hình ảnh trên đĩa

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
22

trong đó

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87 chứa các phân đoạn ngữ nghĩa được lưu trữ dưới dạng hình ảnh

Hình ảnh không được gắn nhãn không có tệp tương ứng trong

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87

Các tệp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93 và
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87 có thể chứa các thư mục con lồng nhau của các hình ảnh và mặt nạ được sắp xếp song song

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu phân đoạn hình ảnh được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
24

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
25

Để xem tập dữ liệu phân đoạn hình ảnh được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne cố định, bạn có thể thực thi

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
26

Bạn cũng có thể chỉ định độc lập vị trí của các mặt nạ và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
28

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
29

CVATImageBộ dữ liệu

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm hình ảnh và các thẻ được liên kết của chúng và phát hiện đối tượng được lưu trữ ở định dạng hình ảnh CVAT

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
30

trong đó

1
2
3
4
5
6
7
8
78 là một tệp XML ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
31

Hình ảnh không được gắn nhãn không có thẻ

1
2
3
4
5
6
7
8
79 tương ứng trong
1
2
3
4
5
6
7
8
78

Trường

1
2
3
4
5
6
7
8
81 của thẻ
1
2
3
4
5
6
7
8
82 trong tệp nhãn mã hóa vị trí của hình ảnh tương ứng, có thể là bất kỳ hình ảnh nào sau đây

  • Tên tệp của một hình ảnh trong thư mục

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    93

  • Đường dẫn tương đối như

    # The directory containing the source images
    data_path = "/path/to/images"
    
    # The path to the COCO labels JSON file
    labels_path = "/path/to/coco-labels.json"
    
    # Import the dataset
    dataset = fo.Dataset.from_dir(
        dataset_type=fo.types.COCODetectionDataset,
        data_path=data_path,
        labels_path=labels_path,
    )
    
    69 chỉ định đường dẫn tương đối tới hình ảnh trong thư mục con lồng nhau của
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    93

  • Một đường dẫn tuyệt đối đến một hình ảnh, có thể có hoặc không có trong thư mục

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    93

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu hình ảnh CVAT được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
33

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
34

Để xem tập dữ liệu hình ảnh CVAT được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
35

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
37

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
38

Ghi chú

Nếu khóa

1
2
3
4
5
6
7
8
81 của nhãn chứa đường dẫn tuyệt đối đến phương tiện nguồn, thì bạn có thể bỏ qua tham số
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 từ ví dụ trên

CVATVideoBộ dữ liệu

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các video và phát hiện đối tượng được liên kết của chúng được lưu trữ ở định dạng video CVAT

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

# Import a random subset of 10 samples from the dataset
dataset = fo.Dataset.from_dir(
    ...,
    max_samples=10,
    shuffle=True,
    seed=51,
)
9

nơi các tệp XML nhãn được lưu trữ ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
40

Video chưa gắn nhãn không có tệp tương ứng trong

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87

Các tệp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93 và
# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
87 có thể chứa các thư mục con lồng nhau của các hình ảnh và nhãn được sắp xếp song song

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu video CVAT được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
42

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
43

Để xem tập dữ liệu video CVAT được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
44

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
46

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
47

OpenLABELImageDataset

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các hình ảnh và các dự đoán đa tác vụ liên quan của chúng được lưu trữ = ở định dạng OpenLABEL

OpenLABEL là một định dạng linh hoạt cho phép nhãn được lưu trữ theo nhiều cách khác nhau đối với các tệp phương tiện tương ứng. Phần sau đây liệt kê các cấu trúc có thể có trong đó dữ liệu phương tiện và tệp nhãn được định dạng OpenLABEL có thể được lưu trữ theo cách mà FiftyOne hiểu được

  1. Một tệp nhãn cho mỗi hình ảnh. Mỗi nhãn chỉ chứa siêu dữ liệu và nhãn được liên kết với hình ảnh cùng tên. Trong trường hợp này, đối số

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    57 sẽ là một thư mục, nếu được cung cấp

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
48

  1. Một tệp nhãn cho tất cả các hình ảnh. Tệp nhãn chứa tất cả siêu dữ liệu và nhãn được liên kết với mọi hình ảnh. Trong trường hợp này, cần có thông tin bổ sung được cung cấp trong tệp nhãn để khớp nhãn với hình ảnh. Cụ thể, đường dẫn tệp hình ảnh tương ứng với nhãn phải được lưu trữ dưới dạng luồng

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
2

  1. Nhiều tệp nhãn, mỗi tệp tương ứng với một hoặc nhiều hình ảnh. Trường hợp này tương tự như khi có một tệp nhãn duy nhất, ngoại trừ thông tin nhãn có thể trải rộng trên nhiều tệp. Vì không thể sử dụng tên tệp để khớp nhãn với hình ảnh, nên đường dẫn tệp hình ảnh phải được lưu trữ lại dưới dạng luồng trong tệp nhãn

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
50

Đối với cấu trúc thực tế của chính các tệp nhãn, các nhãn được lưu trữ trong một hoặc nhiều tệp JSON và có thể theo nhiều định dạng khác nhau. Nói chung theo định dạng này

Ghi chú

Tất cả thông tin đối tượng được lưu trữ trong khóa

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
05 được áp dụng cho hình ảnh tương ứng

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
51

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Nếu việc tải liên quan đến một số đã cho, thì bạn có thể cung cấp đối số

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
10 và
# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
11 để cho phép bạn khớp các điểm trong tệp chú thích của mình với các nhãn trong và tải các điểm cũng như thuộc tính của chúng theo đúng thứ tự

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu hình ảnh OpenLABEL được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
53

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
54

Để xem tập dữ liệu hình ảnh OpenLABEL được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không tạo tập dữ liệu FiftyOne cố định, bạn có thể thực thi

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
55

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
04

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
57

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
58

Ghi chú

OpenLABEL là một định dạng linh hoạt cho phép nhiều quyết định cụ thể của người dùng về cách thể hiện nhãn và siêu dữ liệu. Nếu bạn có dữ liệu tuân thủ OpenLABEL ở định dạng mà các nhà nhập khẩu hiện tại không hiểu, vui lòng đưa ra vấn đề hoặc đóng góp yêu cầu kéo

OpenLABELVideoBộ dữ liệu

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các video và các dự đoán đa nhiệm liên quan của chúng được lưu trữ ở định dạng OpenLABEL

OpenLABEL là một định dạng linh hoạt cho phép nhãn được lưu trữ theo nhiều cách khác nhau đối với các tệp phương tiện tương ứng. Phần sau đây liệt kê các cấu trúc có thể có trong đó dữ liệu phương tiện và tệp nhãn được định dạng OpenLABEL có thể được lưu trữ theo cách mà FiftyOne hiểu được

  1. Một tệp nhãn cho mỗi video. Mỗi nhãn chỉ chứa siêu dữ liệu và nhãn được liên kết với video cùng tên. Trong trường hợp này, đối số

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    57 sẽ là một thư mục, nếu được cung cấp

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
48

  1. Một tệp nhãn cho tất cả các video. Tệp nhãn chứa tất cả siêu dữ liệu và nhãn được liên kết với mọi video. Trong trường hợp này, cần có thông tin bổ sung được cung cấp trong tệp nhãn để khớp nhãn với video. Cụ thể, đường dẫn tệp video tương ứng với nhãn phải được lưu trữ dưới dạng luồng

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
2

  1. Nhiều tệp nhãn, mỗi tệp tương ứng với một hoặc nhiều video. Trường hợp này tương tự như khi có một tệp nhãn duy nhất, ngoại trừ thông tin nhãn có thể trải rộng trên nhiều tệp. Vì không thể sử dụng tên tệp để khớp nhãn với video nên đường dẫn tệp video phải được lưu trữ lại dưới dạng luồng trong tệp nhãn

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
61

Đối với cấu trúc thực tế của chính các tệp nhãn, các nhãn được lưu trữ trong một hoặc nhiều tệp JSON và có thể theo nhiều định dạng khác nhau. Nói chung theo định dạng này

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
62

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Nếu việc tải liên quan đến một số đã cho, thì bạn có thể cung cấp đối số

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
10 và
# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
11 để cho phép bạn khớp các điểm trong tệp chú thích của mình với các nhãn trong và tải các điểm cũng như thuộc tính của chúng theo đúng thứ tự

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu video OpenLABEL được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
64

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
65

Để xem tập dữ liệu video OpenLABEL được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne cố định, bạn có thể thực thi

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
66

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
04

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
68

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
69

Ghi chú

OpenLABEL là một định dạng linh hoạt cho phép nhiều quyết định cụ thể của người dùng về cách thể hiện nhãn và siêu dữ liệu. Nếu bạn có dữ liệu tuân thủ OpenLABEL ở định dạng mà các nhà nhập khẩu hiện tại không hiểu, vui lòng đưa ra vấn đề hoặc đóng góp yêu cầu kéo

FiftyOneImageLabelsBộ dữ liệu

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các hình ảnh và các dự đoán đa nhiệm liên quan của chúng được lưu trữ ở định dạng ETA ImageLabels

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
70

trong đó

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
31 là một tệp JSON ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
71

và nơi mỗi tệp JSON của nhãn được lưu trữ ở định dạng ETA ImageLabels

Đối với những hình ảnh không được gắn nhãn, một tệp

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
32 trống được lưu trữ

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu nhãn hình ảnh được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
73

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
74

Để xem tập dữ liệu nhãn hình ảnh được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không tạo tập dữ liệu FiftyOne cố định, bạn có thể thực thi

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
75

FiftyOneVideoLabelsBộ dữ liệu

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các video và nhãn được liên kết của chúng được lưu trữ ở định dạng ETA VideoLabels

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
70

trong đó

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
31 là một tệp JSON ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
77

và nơi mỗi tệp JSON của nhãn được lưu trữ ở định dạng ETA VideoLabels

Đối với các video chưa được gắn nhãn, một tệp

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
37 trống được ghi

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu nhãn video được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
79

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
80

Để xem tập dữ liệu nhãn video được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
81

BDDBộ dữ liệu

Loại đại diện cho tập dữ liệu được gắn nhãn bao gồm các hình ảnh và các dự đoán đa nhiệm liên quan của chúng được lưu ở định dạng Berkeley DeepDrive (BDD)

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

1
2
3
4
5
6
7
7

trong đó

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
84 là một tệp JSON ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
83

Hình ảnh không được gắn nhãn không có mục tương ứng trong

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
84

Thuộc tính

1
2
3
4
5
6
7
8
81 của tệp nhãn mã hóa vị trí của các hình ảnh tương ứng, có thể là bất kỳ thuộc tính nào sau đây

  • Tên tệp của một hình ảnh trong thư mục

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    93

  • Đường dẫn tương đối như

    # The directory containing the source images
    data_path = "/path/to/images"
    
    # The path to the COCO labels JSON file
    labels_path = "/path/to/coco-labels.json"
    
    # Import the dataset
    dataset = fo.Dataset.from_dir(
        dataset_type=fo.types.COCODetectionDataset,
        data_path=data_path,
        labels_path=labels_path,
    )
    
    69 chỉ định đường dẫn tương đối tới hình ảnh trong thư mục con lồng nhau của
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    93

  • Một đường dẫn tuyệt đối đến một hình ảnh, có thể có hoặc không có trong thư mục

     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    93

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu BDD được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
85

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
86

Để xem tập dữ liệu BDD được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
87

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
89

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
90

Ghi chú

Nếu khóa

1
2
3
4
5
6
7
8
81 của nhãn chứa đường dẫn tuyệt đối đến phương tiện nguồn, thì bạn có thể bỏ qua tham số
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 từ ví dụ trên

Bộ dữ liệu DICOM

Loại đại diện cho một tập dữ liệu bao gồm các hình ảnh và các thuộc tính liên quan của chúng được lưu trữ ở định dạng DICOM

Ghi chú

Bạn phải cài đặt pydicom để tải bộ dữ liệu DICOM

Định dạng tiêu chuẩn cho các bộ dữ liệu thuộc loại này là như sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
91

trong đó mỗi tệp

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
56 là một tệp DICOM có thể được đọc qua

Ngoài ra, thay vì cung cấp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54, bạn có thể cung cấp đối số
# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
59, đối số này có thể chỉ định trực tiếp mẫu hình cầu của các tệp DICOM hoặc đường dẫn đến tệp DICOMDIR

Theo mặc định, tất cả các thuộc tính trong tệp DICOM có thể phát hiện được thông qua các loại được hỗ trợ đều được tải vào các trường cấp độ mẫu, nhưng bạn chỉ có thể chọn các thuộc tính cụ thể bằng cách chuyển đối số tùy chọn

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
61

Ghi chú

Khi nhập bộ dữ liệu DICOM, dữ liệu pixel được chuyển đổi thành hình ảnh 8 bit, sử dụng thuộc tính

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
62 và
# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
63 (nếu có), để thông báo quá trình chuyển đổi

Các hình ảnh được ghi vào một thư mục sao lưu mà bạn có thể định cấu hình bằng cách chuyển đối số

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
16. Theo mặc định, hình ảnh được ghi vào
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

Hiện tại, chỉ hỗ trợ hình ảnh khung đơn, nhưng đóng góp của cộng đồng để hỗ trợ các loại hình ảnh 3D hoặc 4D (e. g. , CT scan) được hoan nghênh

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu DICOM được lưu trữ ở định dạng chuẩn như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
93

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
94

Bạn có thể tạo tập dữ liệu FiftyOne từ mẫu toàn cầu của tệp DICOM hoặc đường dẫn đến tệp DICOMDIR như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
95

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
96

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
97

Bộ dữ liệu GeoJSON

Loại đại diện cho tập dữ liệu bao gồm hình ảnh hoặc video và dữ liệu vị trí địa lý được liên kết của chúng và các thuộc tính tùy chọn được lưu trữ ở định dạng GeoJSON

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
98

trong đó

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
84 là một tệp GeoJSON chứa một
# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
70 ở định dạng sau

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
99

trong đó trường

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
71 có thể chứa bất kỳ đối tượng hình học GeoJSON hợp lệ nào và thuộc tính
# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
72 mã hóa tên của phương tiện tương ứng trong thư mục
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93. Thuộc tính
# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
72 cũng có thể là một đường dẫn tuyệt đối, có thể có hoặc không có trong thư mục
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
93

Các mẫu không có dữ liệu vị trí sẽ có trường

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
71 rỗng

Trường

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
77 của mỗi tính năng có thể chứa các nhãn bổ sung có thể được nhập

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu GeoJSON được lưu trữ ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
01

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
02

Để xem tập dữ liệu GeoJSON được lưu trữ ở định dạng trên trong Ứng dụng FiftyOne mà không tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
03

Bạn cũng có thể chỉ định độc lập vị trí của các nhãn và thư mục gốc chứa các tệp phương tiện tương ứng bằng cách cung cấp các tham số

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
57 và
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 thay vì
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
05

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
06

Ghi chú

Nếu khóa

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
72 của nhãn chứa đường dẫn tuyệt đối đến phương tiện nguồn thì bạn có thể bỏ qua tham số
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
56 từ ví dụ trên

Bộ dữ liệu GeoTIFF

Loại đại diện cho tập dữ liệu bao gồm hình ảnh và dữ liệu vị trí địa lý được liên kết của chúng được lưu trữ ở định dạng GeoTIFF

Ghi chú

Bạn phải cài đặt rasterio để tải bộ dữ liệu GeoTIFF

Định dạng tiêu chuẩn cho các bộ dữ liệu thuộc loại này là như sau

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
07

trong đó mỗi tệp

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
86 là một hình ảnh GeoTIFF có thể được đọc qua

Ngoài ra, thay vì cung cấp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
54, bạn có thể cung cấp đối số
# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
89, đối số này có thể chỉ định trực tiếp một danh sách hoặc mẫu toàn cầu của hình ảnh GeoTIFF để tải

Tập dữ liệu sẽ chứa một trường có thuộc tính chứa tọa độ

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
92 của mỗi tâm hình ảnh và thuộc tính chứa tọa độ
# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
92 của các góc của hình ảnh (theo chiều kim đồng hồ, bắt đầu từ góc trên cùng bên trái)

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ tập dữ liệu GeoTIFF được lưu trữ ở định dạng chuẩn như sau

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
08

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
09

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
10

Bạn có thể tạo tập dữ liệu FiftyOne từ danh sách hoặc mẫu toàn cầu của hình ảnh GeoTIFF như sau

con trăn

CLI

1
2
3
4
5
6
7
8
5

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
12

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13

Bộ dữ liệu FiftyOne

Cung cấp một đại diện đĩa của toàn bộ ở định dạng JSON được tuần tự hóa cùng với phương tiện nguồn của nó

Các bộ dữ liệu thuộc loại này được đọc ở định dạng sau

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
14

trong đó

# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
99 là tệp JSON chứa siêu dữ liệu được liên kết với tập dữ liệu,
1
2
3
4
5
6
7
00 là tệp JSON chứa bản trình bày được đánh số tự nhiên của các mẫu trong tập dữ liệu,
1
2
3
4
5
6
7
01 chứa bất kỳ số nào được đánh số tự động ,
1
2
3
4
5
6
7
03 chứa bất kỳ số được đánh số tự động nào và

Bộ dữ liệu video có tệp

1
2
3
4
5
6
7
07 bổ sung chứa biểu diễn tuần tự của các nhãn khung cho mỗi video trong bộ dữ liệu

Ghi chú

Xem các tham số có thể được chuyển đến các phương thức như tùy chỉnh việc nhập bộ dữ liệu thuộc loại này

Bạn có thể tạo tập dữ liệu FiftyOne từ một thư mục ở định dạng trên như sau

con trăn

CLI

import fiftyone as fo

# The directory containing the dataset to import
dataset_dir = "/path/to/dataset"

# The type of the dataset being imported
dataset_type = fo.types.COCODetectionDataset  # for example

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_dir=dataset_dir,
    dataset_type=dataset_type,
)
3

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
16

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
17

Để xem tập dữ liệu được lưu trữ trên đĩa trong Ứng dụng FiftyOne mà không cần tạo tập dữ liệu FiftyOne liên tục, bạn có thể thực thi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
18

Nếu bạn đã thực hiện việc sử dụng tham số

1
2
3
4
5
6
7
10 để loại bỏ tiền tố chung khỏi đường dẫn tệp phương tiện trong tập dữ liệu, thì chỉ cần thêm thông số
1
2
3
4
5
6
7
10 khi nhập lại vào FiftyOne để thêm tiền tố thích hợp vào trước mỗi đường dẫn phương tiện

con trăn

CLI

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
20

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
21

Ghi chú

Xuất bằng cách sử dụng tham số

1
2
3
4
5
6
7
12 và
1
2
3
4
5
6
7
10 là một cách thuận tiện để truyền tập dữ liệu giữa các môi trường làm việc, vì điều này cho phép bạn lưu trữ tệp phương tiện ở bất cứ đâu bạn muốn trong mỗi môi trường và sau đó chỉ cần cung cấp giá trị
1
2
3
4
5
6
7
10 thích hợp như minh họa ở trên khi nhập tập dữ liệu vào

Định dạng tùy chỉnh

Nếu dữ liệu của bạn không tuân theo một trong các định dạng trước đó thì cách tiếp cận đơn giản và linh hoạt nhất để tải dữ liệu của bạn vào FiftyOne là thêm dữ liệu đó vào một

Ngoài ra, lớp này cung cấp một phương thức xuất xưởng có thể được sử dụng để nhập tập dữ liệu bằng bất kỳ phiên bản nào

Điều này có nghĩa là bạn có thể xác định lớp của riêng mình và sau đó nhập tập dữ liệu từ đĩa ở định dạng tùy chỉnh bằng cách sử dụng công thức sau

1
2
3
4
5
6
7

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
23

Bạn cũng có thể xác định loại tùy chỉnh, cho phép bạn nhập bộ dữ liệu ở định dạng tùy chỉnh của mình bằng phương thức xuất xưởng

1
2
3
4
5
6
7

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
25

Viết một DatasetImporter tùy chỉnh

là một giao diện trừu tượng;

Bộ dữ liệu hình ảnh chưa được gắn nhãn

Bộ dữ liệu hình ảnh được dán nhãn

Bộ dữ liệu video chưa được gắn nhãn

Bộ dữ liệu video được gắn nhãn

tập dữ liệu được nhóm

Để xác định trình nhập tùy chỉnh cho bộ dữ liệu hình ảnh chưa được gắn nhãn, hãy triển khai giao diện

Mã giả bên dưới cung cấp một mẫu cho tùy chỉnh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
26

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
27

Khi được gọi với tùy chỉnh, quá trình nhập được thực hiện hiệu quả thông qua mã giả bên dưới

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
28

Lưu ý rằng trình nhập được gọi thông qua giao diện trình quản lý ngữ cảnh của nó, giao diện này sẽ tự động gọi các phương thức và của trình nhập để xử lý thiết lập/hoàn thành quá trình nhập

Các hình ảnh trong tập dữ liệu được tải lặp lại bằng cách gọi phương thức của trình nhập

Thuộc tính của trình nhập cho phép nó khai báo liệu có nên gọi phương thức của nó hay không sau khi tất cả các mẫu đã được nhập để truy xuất thông tin cấp tập dữ liệu để lưu trữ trên tập dữ liệu FiftyOne. Xem để biết thêm thông tin

Thuộc tính của trình nhập cho phép nó khai báo xem nó có trả về các phiên bản cho mỗi hình ảnh mà nó tải khi được gọi hay không

Để xác định trình nhập tùy chỉnh cho bộ dữ liệu hình ảnh được gắn nhãn, hãy triển khai giao diện

Mã giả bên dưới cung cấp một mẫu cho tùy chỉnh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
29

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
30

Khi được gọi với tùy chỉnh, quá trình nhập được thực hiện hiệu quả thông qua mã giả bên dưới

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
31

Lưu ý rằng trình nhập được gọi thông qua giao diện trình quản lý ngữ cảnh của nó, giao diện này sẽ tự động gọi các phương thức và của trình nhập để xử lý thiết lập/hoàn thành quá trình nhập

Hình ảnh và các phiên bản tương ứng của chúng trong tập dữ liệu được tải lặp lại bằng cách gọi phương thức của trình nhập

Thuộc tính của trình nhập cho phép nó khai báo liệu có nên gọi phương thức của nó hay không sau khi tất cả các mẫu đã được nhập để truy xuất thông tin cấp tập dữ liệu để lưu trữ trên tập dữ liệu FiftyOne. Xem để biết thêm thông tin

Thuộc tính của nhà nhập khẩu khai báo loại (các) nhãn mà nhà nhập khẩu sẽ sản xuất

Thuộc tính của trình nhập cho phép nó khai báo xem nó có trả về các phiên bản cho mỗi hình ảnh mà nó tải khi được gọi hay không

Để xác định trình nhập tùy chỉnh cho bộ dữ liệu video chưa được gắn nhãn, hãy triển khai giao diện

Mã giả bên dưới cung cấp một mẫu cho tùy chỉnh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
26

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
33

Khi được gọi với tùy chỉnh, quá trình nhập được thực hiện hiệu quả thông qua mã giả bên dưới

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
34

Lưu ý rằng trình nhập được gọi thông qua giao diện trình quản lý ngữ cảnh của nó, giao diện này sẽ tự động gọi các phương thức và của trình nhập để xử lý thiết lập/hoàn thành quá trình nhập

Các video trong bộ dữ liệu được tải lặp lại bằng cách gọi phương thức của trình nhập

Thuộc tính của trình nhập cho phép nó khai báo liệu có nên gọi phương thức của nó hay không sau khi tất cả các mẫu đã được nhập để truy xuất thông tin cấp tập dữ liệu để lưu trữ trên tập dữ liệu FiftyOne. Xem để biết thêm thông tin

Thuộc tính của trình nhập cho phép nó khai báo xem nó có trả về các phiên bản cho mỗi video mà nó tải khi được gọi hay không

Để xác định trình nhập tùy chỉnh cho bộ dữ liệu video được gắn nhãn, hãy triển khai giao diện

Mã giả bên dưới cung cấp một mẫu cho tùy chỉnh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
35

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
36

Khi được gọi với tùy chỉnh, quá trình nhập được thực hiện hiệu quả thông qua mã giả bên dưới

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
37

Lưu ý rằng trình nhập được gọi thông qua giao diện trình quản lý ngữ cảnh của nó, giao diện này sẽ tự động gọi các phương thức và của trình nhập để xử lý thiết lập/hoàn thành quá trình nhập

Các video và nhãn tương ứng của chúng trong tập dữ liệu được tải lặp lại bằng cách gọi phương thức của trình nhập. Cụ thể, nhãn cấp độ mẫu cho video có thể được trả về trong giá trị

# The directory containing the source images
data_path = "/path/to/images"

# The path to the COCO labels JSON file
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    data_path=data_path,
    labels_path=labels_path,
)
13 (có thể chứa một giá trị hoặc từ điển ánh xạ tên trường với nhãn) và nhãn cấp độ khung có thể được trả về trong từ điển
# The path to a COCO labels JSON file containing absolute image paths
labels_path = "/path/to/coco-labels.json"

# Import the dataset
dataset = fo.Dataset.from_dir(
    dataset_type=fo.types.COCODetectionDataset,
    labels_path=labels_path,
)
05 ánh xạ khung

Thuộc tính của trình nhập cho phép nó khai báo liệu có nên gọi phương thức của nó hay không sau khi tất cả các mẫu đã được nhập để truy xuất thông tin cấp tập dữ liệu để lưu trữ trên tập dữ liệu FiftyOne. Xem để biết thêm thông tin

Thuộc tính của nhà nhập khẩu khai báo loại (các) nhãn cấp mẫu mà nhà nhập khẩu sẽ sản xuất (nếu có), và thuộc tính của nhà nhập khẩu khai báo (các) nhãn cấp khung mà nhà nhập khẩu sẽ sản xuất (nếu

Thuộc tính của trình nhập cho phép nó khai báo xem nó có trả về các phiên bản cho mỗi video mà nó tải khi được gọi hay không

Để xác định trình nhập tùy chỉnh cho bộ dữ liệu được nhóm, hãy triển khai giao diện

Mã giả bên dưới cung cấp một mẫu cho tùy chỉnh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
38

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
39

Khi được gọi với tùy chỉnh, quá trình nhập được thực hiện hiệu quả thông qua mã giả bên dưới

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
40

Lưu ý rằng trình nhập được gọi thông qua giao diện trình quản lý ngữ cảnh của nó, giao diện này sẽ tự động gọi các phương thức và của trình nhập để xử lý thiết lập/hoàn thành quá trình nhập

Các nhóm trong tập dữ liệu được tải lặp lại bằng cách gọi phương thức của trình nhập

Thuộc tính của trình nhập cho phép nó khai báo liệu có nên gọi phương thức của nó hay không sau khi tất cả các mẫu đã được nhập để truy xuất thông tin cấp tập dữ liệu để lưu trữ trên tập dữ liệu FiftyOne. Xem để biết thêm thông tin

Thuộc tính của bộ nhập cho phép nó khai báo tên trường lưu thông tin cho từng mẫu

Nhập thông tin cấp tập dữ liệu

Thuộc tính của trình nhập cho phép nó khai báo liệu phương thức của nó có nên được gọi hay không sau khi tất cả các mẫu đã được nhập để truy xuất một lệnh của thông tin cấp tập dữ liệu để lưu trữ trong thuộc tính của tập dữ liệu

Trong trường hợp đặc biệt, nếu lệnh

1
2
3
4
5
6
7
91 chứa bất kỳ khóa nào được liệt kê bên dưới, các mục này sẽ được bật và lưu trữ trong trường tập dữ liệu chuyên dụng tương ứng

  • Phím

    1
    2
    3
    4
    5
    6
    7
    93.

  • Phím

    1
    2
    3
    4
    5
    6
    7
    95.

  • Phím

    1
    2
    3
    4
    5
    6
    7
    97.

  • Phím

    1
    2
    3
    4
    5
    6
    7
    99.

  • Chìa khoá

    # Import a random subset of 10 samples from the dataset
    dataset = fo.Dataset.from_dir(
        ...,
        max_samples=10,
        shuffle=True,
        seed=51,
    )
    
    01.

  • Phím

    # Import a random subset of 10 samples from the dataset
    dataset = fo.Dataset.from_dir(
        ...,
        max_samples=10,
        shuffle=True,
        seed=51,
    )
    
    03.

  • Phím

    # Import a random subset of 10 samples from the dataset
    dataset = fo.Dataset.from_dir(
        ...,
        max_samples=10,
        shuffle=True,
        seed=51,
    )
    
    05.

Viết một loại Tập dữ liệu tùy chỉnh

FiftyOne cung cấp hệ thống loại để các định dạng tập dữ liệu có thể được tham chiếu thuận tiện theo loại của chúng khi đọc/ghi tập dữ liệu trên đĩa

Chức năng chính của các lớp con là xác định cái nên được sử dụng để đọc các phiên bản của tập dữ liệu từ đĩa và cái nên được sử dụng để ghi các phiên bản của tập dữ liệu vào đĩa

Xem để biết thêm thông tin về cách xác định các lớp tùy chỉnh

Các loại tập dữ liệu tùy chỉnh có thể được khai báo bằng cách triển khai lớp con tương ứng với loại tập dữ liệu mà bạn đang làm việc với

Bộ dữ liệu hình ảnh chưa được gắn nhãn

Bộ dữ liệu hình ảnh được dán nhãn

Bộ dữ liệu video chưa được gắn nhãn

Bộ dữ liệu video được gắn nhãn

tập dữ liệu được nhóm

Mã giả dưới đây cung cấp một mẫu cho một lớp con tùy chỉnh

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
41

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
42

Lưu ý rằng, vì loại này đại diện cho một tập dữ liệu được nhóm, nên trình nhập của nó phải là một lớp con của và trình xuất của nó phải là một lớp con của