.ipynb
Create Table from Image FolderΒΆ
Create a 3LC Table from a folder structure containing images organized by class labels for image classification tasks.

Image folder structures are a common way to organize classification datasets, following the PyTorch ImageFolder convention. This approach is ideal when you have images already sorted into subdirectories by their respective classes.
We use the tlc.Table.from_image_folder method to automatically create a table from a folder structure where each subfolder represents a class. The method reads the folder structure and creates appropriate image and label columns. It assumes a torchvision.ImageFolder-like structure:
cats-and-dogs/
βββ cats/
β βββ cat1.jpg
β βββ cat2.jpg
β βββ ...
βββ dogs/
βββ dog1.jpg
βββ dog2.jpg
βββ ...
The resulting table will have columns for images, labels, and an optional hidden weight column that wonβt be visible in the table rows.
Install dependenciesΒΆ
[ ]:
%pip install 3lc
ImportsΒΆ
Project setupΒΆ
[ ]:
DATA_PATH = "../../data"
PROJECT_NAME = "3LC Tutorials - Cats & Dogs"
DATASET_NAME = "cats-and-dogs"
TABLE_NAME = "initial-cls"
[ ]:
image_folder = (Path(DATA_PATH) / "cats-and-dogs").absolute()
assert image_folder.exists()