Closed Mahmood-Hussain closed 1 year ago
Hi @Mahmood-Hussain 👋
This kind of filtering is easy to achieve after you've already loaded the data using dataset views:
For example, if you wanted to only export labels for which inferred == 0
in COCO format:
import fiftyone as fo
from fiftyone import ViewField as F
dataset = fo.Dataset.from_dir(
dataset_dir="/path/to/voc/data",
dataset_type=fo.types.VOCDetectionDataset,
label_field="ground_truth",
)
# See what dataset contains
print(dataset)
print(dataset.count_values("ground_truth.detections.label"))
print(dataset.count_values("ground_truth.detections.inferred"))
view = dataset.filter_labels("ground_truth", F("inferred") == 0)
# See what view contains
print(view)
print(view.count_values("ground_truth.detections.label"))
print(view.count_values("ground_truth.detections.inferred"))
view.export(
export_dir="/path/for/coco",
dataset_type=fo.types.COCODetectionDataset,
label_field="ground_truth",
)
Proposal Summary
I am trying to export a dataset from PASCAL VOC format to COCODetection or YOLOv5Detection. In XML files of VOC labels I have some annotations marked as tricky is there a way to skip those annotations (bounding boxes) while exporting to other formats?
Motivation
What is the use case for this feature? It can allow us to skip difficult marked bounding boxes useful for easy evaluation
Why is this use case valuable to support for FiftyOne users in general? This will save time from writing a new script
Why is this use case valuable to support for your project(s) or organization? To save time
Why is it currently difficult to achieve this use case? I am not sure whether there is already support for this or not. It is not difficult writing a script for XML files and removing difficult labels manually could be done but hectic
What areas of FiftyOne does this feature affect?
fiftyone
Python libraryDetails
Use this section to include any additional information about the feature. If you have a proposal for how to implement this feature, please include it here. here is an example of XML file
Willingness to contribute
The FiftyOne Community welcomes contributions! Would you or another member of your organization be willing to contribute an implementation of this feature?