tlc.core.objects.tables.from_python_object.table_from_torch_dataset
#
A table populated from a Torch dataset.
Module Contents#
Classes#
Class |
Description |
---|---|
A table populated from a Torch dataset. |
API#
- class tlc.core.objects.tables.from_python_object.table_from_torch_dataset.TableFromTorchDataset(url: tlc.core.url.Url | None = None, created: str | None = None, description: str | None = None, row_cache_url: tlc.core.url.Url | None = None, row_cache_populated: bool | None = None, override_table_rows_schema: tlc.core.schema.Schema | None = None, init_parameters: Any | None = None, input_dataset: torch.utils.data.Dataset | None = None, all_arrays_are_fixed_size: bool = False, input_tables: list[tlc.core.url.Url] | None = None)#
Bases:
tlc.core.objects.tables.in_memory_rows_table._InMemoryRowsTable
A table populated from a Torch dataset.
When creating a
TableFromTorchDataset
, the row schema specified by theoverride_table_rows_schema
parameter (if provided) must match the structure of the samples in the providedinput_dataset
. This row schema is used to convert the samples in theinput_dataset
to rows in the table, and to make sure that samples returned by the table’s__getitem__
method match the structure of the samples in the originalinput_dataset
.If the
input_dataset
is atorchvision.datasets.DatasetFolder
, theTableFromTorchDataset
will use thetorchvision.datasets.folder.default_loader
to load the images. This loader will be replaced with a 3LC loader that does not copy the images, but instead returns a PIL image with a filename attribute that contains the absolute path to the image. This allows the front-end to access the images in the table without copying them.If the
input_dataset
is atorchvision.datasets.VisionDataset
, theTableFromTorchDataset
will also remove any transforms from theinput_dataset
before serializing it to the table, but will recreate the transforms on theVisionDataset
after serialization. Any transforms defined on theinput_dataset
are added to the list ofmap_functions
of theTable
, and will be reflected in the samples returned by theTable
’s__getitem__
method, but not serialized to theTable
’s json file.Create a Table from a Torch dataset.
- Parameters:
url – The URL of the table.
created – The date and time the table was created.
description – A description of the table.
dataset_name – The name of the dataset.
project_name – The name of the project.
row_cache_url – The URL of the row cache.
row_cache_populated – Whether the row cache has been populated.
override_table_rows_schema – The schema of the table rows.
init_parameters – The parameters used to initialize the table.
input_dataset – The Torch dataset to use to populate the table.