Federated Computer Vision Module References¶
federatedscope.cv.dataset¶
- class federatedscope.cv.dataset.leaf.LEAF(root, name, transform, target_transform)[source]¶
Base class for LEAF dataset from “LEAF: A Benchmark for Federated Settings”
- Parameters
root (str) – root path.
name (str) – name of dataset, in LEAF_NAMES.
transform – transform for x.
target_transform – transform for y.
- class federatedscope.cv.dataset.leaf.LocalDataset(Xs, targets, pre_process=None, transform=None, target_transform=None)[source]¶
Convert data list to torch Dataset to save memory usage.
- class federatedscope.cv.dataset.leaf_cv.LEAF_CV(root, name, s_frac=0.3, tr_frac=0.8, val_frac=0.0, train_tasks_frac=1.0, seed=123, transform=None, target_transform=None)[source]¶
LEAF CV dataset from “LEAF: A Benchmark for Federated Settings”
leaf.cmu.edu
- Parameters
root (str) – root path.
name (str) – name of dataset, ‘femnist’ or ‘celeba’.
s_frac (float) – fraction of the dataset to be used; default=0.3.
tr_frac (float) – train set proportion for each task; default=0.8.
val_frac (float) – valid set proportion for each task; default=0.0.
train_tasks_frac (float) – fraction of test tasks; default=1.0.
transform – transform for x.
target_transform – transform for y.
federatedscope.cv.dataloader¶
- federatedscope.cv.dataloader.load_cv_dataset(config=None)[source]¶
Return the dataset of
femnist
orceleba
.- Parameters
config – configurations for FL, see
federatedscope.core.configs
- Returns
FL dataset dict, with
client_id
as key.
Note
load_cv_dataset()
will return a dict as shown below:` {'client_id': {'train': dataset, 'test': dataset, 'val': dataset}} `
federatedscope.cv.model¶
- class federatedscope.cv.model.ConvNet2(in_channels, h=32, w=32, hidden=2048, class_num=10, use_bn=True, dropout=0.0)[source]¶
- forward(x)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class federatedscope.cv.model.ConvNet5(in_channels, h=32, w=32, hidden=2048, class_num=10, dropout=0.0)[source]¶
- forward(x)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class federatedscope.cv.model.VGG11(in_channels, h=32, w=32, hidden=128, class_num=10, dropout=0.0)[source]¶
- forward(x)[source]¶
Defines the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Module
instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.