import_pickles(pattern, max_pickles=None, shuffle=False, as_generator=False, verbose=False, **kwargs)¶
Multiple pickle importer.
Menpo unambiguously uses
.pklas it’s choice of extension for Pickle files. Menpo also supports automatic importing and exporting of gzip compressed pickle files - just choose a
pkl.gzand gzip compression will automatically be applied. Compression can massively reduce the filesize of a pickle file at the cost of longer import and export times.
Note that this is a function returns a
LazyList. Therefore, the function will return immediately and indexing into the returned list will load a pickle at run time. If all pickles should be loaded, then simply wrap the returned
LazyListin a Python list.
- pattern (str) – A glob path pattern to search for pickles. Every pickle found to match
the glob will be imported one by one. See
pickle_pathsfor more details of what pickles will be found.
- max_pickles (positive int, optional) – If not
None, only import the first
max_picklesfound. Else, import all.
- shuffle (bool, optional) – If
True, the order of the returned pickles will be randomised. If
False, the order of the returned pickles will be alphanumerically ordered.
- as_generator (bool, optional) – If
True, the function returns a generator and assets will be yielded one after another when the generator is iterated over.
- verbose (bool, optional) – If
Trueprogress of the importing will be dynamically reported with a progress bar.
ValueError– If no pickles are found at the provided glob.
- pattern (str) – A glob path pattern to search for pickles. Every pickle found to match the glob will be imported one by one. See