You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I run
split_view.export(
export_dir=export_dir,
dataset_type=fo.types.YOLOv5Dataset,
label_field=label_field,
split=split,
classes=classes,
)
it exports only all images that have annotation, but there are some images with no annotation don't export! I need my model to train on it to learn them as a background, without this the model gives me many false positive on those empty images.
System information
OS Platform and Distribution (Linux Ubuntu 22.04):
Python version (3.10.12):
FiftyOne version (1.2.0):
FiftyOne installed from (pip):
Willingness to contribute
The FiftyOne Community encourages bug fix contributions. Would you or another
member of your organization be willing to contribute a fix for this bug to the
FiftyOne codebase?
[x ] Yes. I can contribute a fix for this bug independently
Yes. I would be willing to contribute a fix for this bug with guidance
from the FiftyOne community
No. I cannot contribute a bug fix at this time
The text was updated successfully, but these errors were encountered:
brimoor
changed the title
[BUG] fo.export only images with annotations
[?] How to export empty YOLOv5 labels files for images with no annotations
Jan 16, 2025
Suppose you are exporting a field called ground_truth in YOLOv5 format. Then:
If ground_truth is None, then no labels TXT file is generated
If ground_truth is an empty detections object fo.Detections(), then an empty labels TXT file is generated
Sounds like you want option 2 in your case.
Here's an example:
importfiftyoneasfoimportfiftyone.zooasfozimportfiftyone.utils.randomasfourdataset=foz.load_zoo_dataset("quickstart")
classes=dataset.distinct("ground_truth.detections.label")
# Create splitsdataset.untag_samples(dataset.distinct("tags"))
four.random_split(dataset, {"train": 0.7, "test": 0.3})
## Simulate a case where 50% of images have no annotations## If `ground_truth` is `None`, no labels files are generated# dataset.take(100).clear_sample_field("ground_truth")# If `ground_truth` contains empty detections `fo.Detections()`, then empty# labels files are generateddataset.take(100).set_field("ground_truth", fo.Detections()).save()
# Export in YOLOv5 formatforsplitin ("train", "test"):
split_view=dataset.match_tags(split)
split_view.export(
export_dir="/tmp/yolov5",
dataset_type=fo.types.YOLOv5Dataset,
label_field="ground_truth",
split=split,
classes=classes,
)
find /tmp/yolov5/images/train -type f | wc -l
find /tmp/yolov5/labels/train -type f | wc -l
find /tmp/yolov5/images/test -type f | wc -l
find /tmp/yolov5/labels/test -type f | wc -l
Describe the problem
when I run
split_view.export(
export_dir=export_dir,
dataset_type=fo.types.YOLOv5Dataset,
label_field=label_field,
split=split,
classes=classes,
)
it exports only all images that have annotation, but there are some images with no annotation don't export! I need my model to train on it to learn them as a background, without this the model gives me many false positive on those empty images.
System information
3.10.12
):1.2.0
):Willingness to contribute
The FiftyOne Community encourages bug fix contributions. Would you or another
member of your organization be willing to contribute a fix for this bug to the
FiftyOne codebase?
from the FiftyOne community
The text was updated successfully, but these errors were encountered: