This project is written in Python for generating dataset distributions and launching federated learning algorithms.
First, modify the root_list
variable in the load_pick.py
file to point to your own dataset paths. For example:
root_list = ["data/cifar10/",
"data/cifar100/",
"data/cinic10/"]
Then run the load_pick.py
file to generate the dataset distribution.
Use the following commands to launch the federated learning algorithm:
python main.py --config_path /path/to/config/fed_classifier_if01.json --partition_method [if_01|if_001|if_002]
python main.py --config_path /path/to/config/fed_more_contrast_if01.json --partition_method [if_01|if_001|if_002]
Where:
--config_path
specifies the configuration file path--partition_method
specifies the data partitioning methodif_01
indicates an imbalance factor of 10if_001
indicates an imbalance factor of 100if_002
indicates an imbalance factor of 50
With different partition_method
parameters, you can obtain different degrees of data imbalance distribution to test the robustness of the algorithm.
Make sure to replace the paths in the commands with your own configuration file paths.