![]() |
Converts a Federated EMNIST dataset into an Infinite Federated EMNIST set.
tff.simulation.datasets.emnist.get_infinite(
emnist_client_data,
num_pseudo_clients
)
Infinite Federated EMNIST expands each writer from the EMNIST dataset into some number of pseudo-clients each of whose characters are the same but apply a fixed random affine transformation to the original user's characters. The distribution over affine transformation is approximately equivalent to the one described at https://www.cs.toronto.edu/~tijmen/affNIST/. It applies the following transformations in this order:
- A random rotation chosen uniformly between -20 and 20 degrees.
- A random shearing adding between -0.2 to 0.2 of the x coordinate to the y coordinate (after centering).
- A random scaling between 0.8 and 1.25 (sampled log uniformly).
- A random translation between -5 and 5 pixels in both the x and y axes.
Args:
emnist_client_data
: Thetff.simulation.ClientData
to convert.num_pseudo_clients
: How many pseudo-clients to generate for each real client. Each pseudo-client is formed by applying a given random affine transformation to the characters written by a given real user. The first pseudo-client for a given user applies the identity transformation, so the original users are always included.
Returns:
An expanded tff.simulation.ClientData
.