Skip to content

Code of algorithms and simulations in article "VREM-FL: Mobility-Aware Computation-Scheduling Co-Design for Vehicular Federated Learning," IEEE TVT 2024.

Notifications You must be signed in to change notification settings

lucaballotta/vrem-fl

Repository files navigation

VREM-FL

The code in this repository implements algorithms and simulations of the article "VREM-FL: Mobility-Aware Computation-Scheduling Co-Design for Vehicular Federated Learning" published in the IEEE Transactions on Vehicular Technology. Please jump to the bottom for full citation and all references.

Learning experiments

Two federated learning tasks are implemented.

  1. The first task trains a linear regression model with least squares (LS) cost function. The code for this experiment is included in the folder Least_Squares_FL_code. We generate syntehtic dataset for this experiment, however including custom simulated or real-world data is straightforward. To change the dataset, it is sufficient to adjust line 20 in the file main_FL_LS.py. In our implementation, the heterogenity of the synthetic data can be tuned through the input argument noniid and the parameter grad in utils.getSyntheticDataset(), whereby smaller grad means more non-iid data.

  2. The second task trains a deep neural network model for semantic segmentation of images. The code for this experiment is included in the folder fl_simulator_nn. We use the real-world dataset ApolloScape in the training experiment, which is freely available online, see [ApolloScape]. ApolloScape gathers frames from video streams acquired by moving cameras and is suited to simulating vehicular training tasks. To change dataset, it is sufficient to adjust lines 233-240 in the file run_experiment.py. To change the learned model, local training algorithm, or global aggregation algorithm, it is sufficient to change the relevant methods and parameters in get_learner() and get_client() in init_clients() (for local training and models) and get_learner(), get_local_steps_optimizer(), get_local_steps_manager(), and get_aggregator() in build_experiment() (for global training), all in run_experiment.py.

PWC

Client mobility and bitrate

In all experiments clients are mobile, which affects the channel quality and upload bitrate. The bitrate values for each client and time slot represented in the simulations are uploaded as dictionaries from data files through the method import_vehicles_data() at lines 8 and 201 of the files Least_Squares_FL_code/main_FL_LS.py and fl_simulator_nn/run_experiment.py, respectively. The data files with bitrate values used in our experiments are freely available at [MobilityData]. These are built by generating and estimating realistic Radio Environmental Maps (REMs) of the simulation environments (the cities of Padova, Italy and Rome, Italy), and by subsequently juxtadposing vehicular trajectories either realistically generated by the simulator of urban mobility [SUMO] run on map provided by [OpenStreetMap] (for simulations in Padova) or taken from the real-wolrd dataset roma/taxi [RomaTaxi] (for simulation in Rome). The ground-truth REMs are generated through the MATLAB toolbox [5GToolbox] and they are estimated with the semi-parametric method proposed in [DalFabbro22].

Schedulig algorithms

Besides the proposed allocation algorithm VREM-FL, the client scheduling algorithms implemented in the code are:

  • random scheduling;
  • round robin;
  • a fairness-based method adapted from [Ozfatura21];
  • a method based on the uplink channel gain at the beginning of the learning rounds adapted from [Chen24]. The client scheduling strategy can be chosen through the scheduling keyword at line 34 of Least_Squares_FL_code/main_FL_LS.py and at line 213 of fl_simulator_nn/run_experiment.py, respectively.

The transmission of local models to the aggregator can be chosen between optimal (VREM-FL), min_tx, and min_latency. This can be set through the tx parameter at line 36 of Least_Squares_FL_code/main_FL_LS.py or through the tx_strategy keyword input parameter of get_local_steps_optimizer() at line 157 of fl_simulator_nn/run_experiment.py, respectively.

The number of local steps in the training of local models can be chosen between optimal (VREM-FL), min, and max. This can be set through the comp parameter at line 35 of Least_Squares_FL_code/main_FL_LS.py or through the strategy keyword input parameter of get_local_steps_manager() at line 164 of fl_simulator_nn/run_experiment.py, respectively.

Detailed information about the scheduling algorithms is available in the documentation of the scripts in Least_Squares_FL_code/Scheduling_algos or fl_simulator_nn/utils/scheduler_utils.py, and in our paper [VREMFL].

How to run

After downloading or creating the datasets with client bitrate values, all experiments are readily executable by running the scripts Least_Squares_FL_code/main_FL_LS.py and fl_simulator_nn/run_experiment.py, respectively. The latter requires to supply mandatory command line arguments experiment with the dataset description and tx_strategy. All command line arguments are visible in the example bash script fl_simulator_nn/experiment/run_fedavg.sh. For this experiment, it is also necessary to download the dataset [ApolloScape].

Vehicular mobility datasets with bitrate values used in the experiments are openly available at https://researchdata.cab.unipd.it/1430/.

Citation

  1. Journal paper:
@ARTICLE{10715716,
  author={Ballotta, Luca and Fabbro, Nicol{\`o} Dal and Perin, Giovanni and Schenato, Luca and Rossi, Michele and Piro, Giuseppe},
  journal={IEEE Transactions on Vehicular Technology}, 
  title={{VREM-FL}: mobility-aware computation-scheduling co-design for vehicular federated learning}, 
  year={2024},
  volume={},
  number={},
  pages={1-16},
  doi={10.1109/TVT.2024.3479780}
}

The paper is freely available (open access).

Supplementary material is available in the technical report on ArXiv at https://arxiv.org/abs/2311.18741.

  1. Vehicular mobility datasets:
@dataset{researchdata1430,
  author = {Giovanni Perin and Luca Ballotta and Nicol{\`o} Dal Fabbro},
  year = {2024},
  month = {November},
  title = {{VREM-FL} datasets: a collection of datasets for vehicular federated learning},
  publisher = {Research Data Unipd},
  doi = {10.25430/researchdata.cab.unipd.it.00001430},
  url = {https://researchdata.cab.unipd.it/1430/}
}

If you use the dataset(s) for your research, please cite both the datasets and the paper.

References

[5GToolbox] Mathworks. (2023) 5G Toolbox. Accessed on: Nov. 15, 2023. [Online]. Available: https://www.mathworks.com/help/5g/index.html?s_tid=CRUX_lftnav.

[ApolloScape] X. Huang, X. Cheng, Q. Geng, B. Cao, D. Zhou, P. Wang, Y. Lin, and R. Yang, "The apolloscape dataset for autonomous driving," in Proc. IEEE CVPR Workshops, 2018, pp. 954-960.

[Chen24] C. Chen, B. Jiang, S. Liu, C. Li, C. Wu, and R. Yin, "Efficient federated learning in resource-constrained edge intelligence networks using model compression," IEEE Trans. Veh. Technol., vol. 73, no. 2, pp. 2643-2655, 2024.

[DalFabbro22] N. Dal Fabbro, M. Rossi, G. Pillonetto, L. Schenato, and G. Piro, "Model-free radio map estimation in massive MIMO systems via semi-parametric Gaussian regression," IEEE Wireless Commun. Lett., vol. 11, no. 3, pp. 473-477, 2022.

[OpenStreetMap] OSM. (2023) OpenStreetMap. Accessed on: Nov. 15, 2023. [Online]. Available: https://www.openstreetmap.org/#map=6/42.088/12.564.

[Ozfatura21] M. E. Ozfatura, J. Zhao, and D. Gündüz, "Fast federated edge learning with overlapped communication and computation and channel-aware fair client scheduling," in Proc. IEEE SPAWC, 2021, pp. 311-315.

[RomaTaxi] L. Bracciale, M. Bonola, P. Loreti, G. Bianchi, R. Amici, and A. Rabuffi, "Crawdad roma/taxi," 2022, accessed on: Mar. 6, 2024. [Online]. Available: https://dx.doi.org/10.15783/C7QC7M.

[SUMO] Eclipse. (2023) Simulator of Urban MObility. Accessed on: Nov. 15, 2023. [Online]. Available: https://eclipse.dev/sumo/.

About

Code of algorithms and simulations in article "VREM-FL: Mobility-Aware Computation-Scheduling Co-Design for Vehicular Federated Learning," IEEE TVT 2024.

Topics

Resources

Stars

Watchers

Forks