I am new to Fifty one and would like to import a simple directory (containing .jpg files) into Fiftyone (I am using Windows and Python 3.10.10 in a Conda env). I followed the documentation instructions (https://docs.voxel51.com/user_guide/dataset_creation/index.html), however my dataset seems empty when opened in the app.
Here is my Python script :
import fiftyone as fo
DATASET_PATH = "\sandbox\images"
def load_dataset(path=DATASET_PATH, dataset_type=fo.types.ImageDirectory):
dataset = fo.Dataset.from_dir(path, dataset_type)
print(dataset)
return dataset
def main():
dataset = load_dataset()
session = fo.launch_app(dataset, desktop=True)
session.wait()
if __name__ == "__main__":
main()
Here is the result of my import :
(fiftyone) C:\Windows>C:/Users/benoit.boidin/AppData/Local/anaconda3/envs/fiftyone/python.exe /sandbox/load_dataset.py
100% |████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 0/0 [397.6us elapsed, ? remaining, ? samples/s]
Name: 2024.04.10.13.13.22
Media type: None
Num samples: 0
Persistent: False
Tags: []
Sample fields:
id: fiftyone.core.fields.ObjectIdField
filepath: fiftyone.core.fields.StringField
tags: fiftyone.core.fields.ListField(fiftyone.core.fields.StringField)
metadata: fiftyone.core.fields.EmbeddedDocumentField(fiftyone.core.metadata.Metadata)
Desktop App launched.
I tried several formats, using the webapp and desktop app, with large or small datasets. I expected the images to be displayed but everything work as if there was no files in my directory.
You want to use from_images_dir()
here, not from_dir()
. Here's the distinction:
from_images_dir()
assumes that the directory contains a bunch of image filesfrom_dir()
assumes there is a FiftyOne.Dataset
that has been exported to that directory.