Skip to content
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] Import of FiftyoneDataset with rel_dir not working as expected #3257

Open
1 of 3 tasks
wayofsamu opened this issue Jul 6, 2023 · 1 comment
Open
1 of 3 tasks
Labels
bug Bug fixes

Comments

@wayofsamu
Copy link
Contributor

wayofsamu commented Jul 6, 2023

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Ubuntu 22.04
  • Python version (python --version): 3.10.8
  • FiftyOne version (fiftyone --version): 0.21.0
  • FiftyOne installed from (pip or source): pip

Describe the problem

If the rel_dir argument is used for exporting a fo.types.FiftyOneDataset as mentioned here the rel_dir is removed from all media field paths (Segmentation, Heatmap etc.). Source

When importing such a dataset, the rel_dir is not used to fix the paths for these media fields. I do not see an easy fix, as there is no information which media fields exists in a sample. Source

Quick and dirty fix:

for key, value in sd.items():
    if isinstance(value, dict):
        if value.get("_cls") is not None:
            for subkey, _ in value.items():
                if "path" in subkey:
                    sd[key][subkey] = os.path.join(rel_dir, sd[key][subkey]).replace("\\", "/")

What areas of FiftyOne does this bug affect?

  • App: FiftyOne application issue
  • Core: Core Python library issue
  • Server: FiftyOne server issue
@wayofsamu wayofsamu added the bug Bug fixes label Jul 6, 2023
@wayofsamu wayofsamu changed the title [BUG] FiftyoneDataset path of media fields are not merged [BUG] Import of FiftyoneDataset with rel_dir not working as expected Jul 6, 2023
@wayofsamu
Copy link
Contributor Author

I also experience some problems when exporting on Windows and importing on Linux. I had to replace the \\ with /.

denkrau pushed a commit to denkrau/fiftyone that referenced this issue Oct 19, 2023
When importing a dataset all path separators of keys `filepath` and
`mask_path` get replaced with the ones used by the OS.

Resolves: voxel51#3257
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug fixes
Projects
None yet
Development

No branches or pull requests

1 participant