-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheda.py
25 lines (21 loc) · 813 Bytes
/
eda.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
import fiftyone as fo
import fiftyone.zoo as foz
import matplotlib.pyplot as plt
import matplotlib.patches as patches
datasets = foz.load_zoo_dataset('coco-2017', splits=('train', 'validation', 'test'), classes=['person'], progress=True, max_samples=10000)
for sample in datasets:
if sample.ground_truth == None:
continue
detections = [detection for detection in sample.ground_truth.detections if detection.label == "person"]
sample.ground_truth.detections = detections
sample.save()
# Export the splits
for split in ['train', 'validation', 'test']:
split_view = datasets.match_tags(split)
split_view.export(
export_dir='./yolov5-coco-datasets',
dataset_type=fo.types.YOLOv5Dataset,
label_field='ground_truth',
split=split,
classes=['person'],
)