-
Notifications
You must be signed in to change notification settings - Fork 589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] UnicodeDecodeError when running add_yolo_labels() #1497
Comments
Your TXT files can't be decoded. I would double check what is in them. They should only contain numbers, per the format |
Thank you @benjaminpkane.
However I'd like to add this dataset (predictions) to another one (ground truth). I get this error when trying using add_yolo_labels() . Any other way I can do that using the code above? |
Interesting. We will try to reproduce. |
Thank you @benjaminpkane If there is another solution to display the images while loading predictions:
then adding the ground truth but with ALL the images of ground_truth (not only the ones with predicitons):
Then it could solve the problem I have. (both filepath contain all the images in the dataset) |
Using merge might be alternative solution for you. import fiftyone as fo
pred = fo.Dataset.from_dir(...)
gt = fo.Dataset.from_dir(...)
both = fo.Dataset("both")
both.merge(pred)
both.merge(gt) |
@valentindbdg There may be an issue with the images in Out of curiosity, what extension do the images have in your dataset? |
@valentindbdg I see the problem. In this syntax: fouy.add_yolo_labels(
sample_collection=dataset,
label_field="predictions",
labels_path="/content/yolodataset/data",
) the There are a variety of ways to resolve this.
import os
import eta.core.utils.as etau
import fiftyone.utils.yolo as fouy
labels_path = "/content/yolodataset/data"
labels_dict = {
os.path.splitext(os.path.basename(p))[0] + ".jpg": p # assumes your images are JPG
for p in etau.list_files(labels_path, abs_paths=True, recursive=True)
if p.endswith(".txt")
}
fouy.add_yolo_labels(
sample_collection=dataset,
label_field="predictions",
labels_path=labels_dict,
)
and then load everything like this: import fiftyone as fo
import fiftyone.utils.yolo as fouy
dataset = fo.Dataset.from_dir(
data_path= "/path/to/images",
labels_path="/path/to/ground_truth",
dataset_type=fo.types.YOLOv4Dataset,
label_field="ground_truth",
)
fouy.add_yolo_labels(dataset, "predictions", "/path/to/predictions")
|
Thank you @benjaminpkane and @brimoor ! I also have confidence stored for my predictions, how can I input them to my dataset in Fiftyone so I can visualize them too? Should I open a new issue for this? Note: I previously had them stored in a .csv file next to each prediction before conversion to yolo format:
|
Support for loading confidence from YOLO TXT files was just added in #1465. It hasn't been released yet but you could use it via a source install. However, since your data isn't natively stored in YOLO format but instead a CSV format you devised, I would instead recommend one of these approaches:
|
Thank you @brimoor Then added a confidence column in the TXT files following this format: it worked well. |
System information
Commands to reproduce
Describe the problem
I am having this problem when trying to add yolo detections. Any known solution?
The text was updated successfully, but these errors were encountered: