-
Notifications
You must be signed in to change notification settings - Fork 0
/
generate_external_data.py
32 lines (26 loc) · 1.1 KB
/
generate_external_data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import fiftyone as fo
from fiftyone import ViewField as F
name="my-dataset"
dataset_type = fo.types.COCODetectionDataset
dataset = fo.Dataset.from_dir(
dataset_dir="/home/lcy/Projects/BoxDetector/assets/colorful-dataset/val/",
dataset_type=dataset_type,
data_path="/home/lcy/Projects/BoxDetector/assets/colorful-dataset/val/",
labels_path="/home/lcy/Projects/BoxDetector/assets/colorful-dataset/val/colorful_val.json",
name=name,
)
session = fo.launch_app(dataset)
session.wait()
# view = (
# dataset
# .map_labels("detections", {"0":"box", "Box":"box", "good-parcel":"box", "Parcel":"box", "Box-broken":"box", "Boxes":"box",})
# .filter_labels("detections", F("label") == "box")
# )
# colorful_dataset_train = view.clone()
# colorful_dataset_train.export(
# dataset_dir="/home/lcy/Projects/BoxDetector/assets/colorful-dataset/r_train/",
# dataset_type=dataset_type,
# data_path="/home/lcy/Projects/BoxDetector/assets/colorful-dataset/r_train/",
# labels_path="/home/lcy/Projects/BoxDetector/assets/colorful-dataset/r_train/colorful_train.json",
# export_media="move",
# )