basicsr.utils.file_client¶
- class basicsr.utils.file_client.BaseStorageBackend[source]¶
Bases:
object
Abstract class of storage backends.
All backends need to implement two apis:
get()
andget_text()
.get()
reads the file as a byte stream andget_text()
reads the file as texts.
- class basicsr.utils.file_client.FileClient(backend='disk', **kwargs)[source]¶
Bases:
object
A general file client to access files in different backend.
The client loads a file or text in a specified backend from its path and return it as a binary file. it can also register other backend accessor with a given name and backend class.
- backend¶
The storage backend type. Options are “disk”, “memcached” and “lmdb”.
- Type:
str
- client¶
The backend object.
- Type:
- class basicsr.utils.file_client.HardDiskBackend[source]¶
Bases:
BaseStorageBackend
Raw hard disks storage backend.
- class basicsr.utils.file_client.LmdbBackend(db_paths, client_keys='default', readonly=True, lock=False, readahead=False, **kwargs)[source]¶
Bases:
BaseStorageBackend
Lmdb storage backend.
- Parameters:
db_paths (str | list[str]) – Lmdb database paths.
client_keys (str | list[str]) – Lmdb client keys. Default: ‘default’.
readonly (bool, optional) – Lmdb environment parameter. If True, disallow any write operations. Default: True.
lock (bool, optional) – Lmdb environment parameter. If False, when concurrent access occurs, do not lock the database. Default: False.
readahead (bool, optional) – Lmdb environment parameter. If False, disable the OS filesystem readahead mechanism, which may improve random read performance when a database is larger than RAM. Default: False.
- db_paths¶
Lmdb database path.
- Type:
list
- _client¶
A list of several lmdb envs.
- Type:
list
- class basicsr.utils.file_client.MemcachedBackend(server_list_cfg, client_cfg, sys_path=None)[source]¶
Bases:
BaseStorageBackend
Memcached storage backend.
- server_list_cfg¶
Config file for memcached server list.
- Type:
str
- client_cfg¶
Config file for memcached client.
- Type:
str
- sys_path¶
Additional path to be appended to sys.path. Default: None.
- Type:
str | None