README-App.md
March 13, 2023 ยท View on GitHub
FedScale Example Mobile App
We provide a sample app which you can choose to
- Train/test models with TFLite or Alibaba MNN.
- Fine-tune models locally after receiving model from the cloud.
Please follow these steps to download and build the sample android app.
- Download and unzip sample dataset (TrainTest.zip) to
assets/directory. RemoveTrainTest.zipafter unzip to save space on your mobile device. After unzip, you should see 3 files and 2 directories underassets/:TrainSet: Training set directory, contains 320 images.TestSet: Testing set directory, contains 32 images.conf.json: Configuration file for mobile app.train_labels.txt: Training label file with format<filename> <label>, where<filename>is the path afterTrainSet/.test_labels.txt: Testing label file with the same format astrain_labels.txt.
- Install Android Studio and open project
fedscale/edge/tflite. Download necessary SDKs, NDKs and CMake when prompted. My version:- SDK: API 32
- Android Gradle Plugin Version: 3.5.3
- Gradle Version: 5.4.1
- Source Compatibility: Java 8
- Target Compatibility: Java 8
- Modify
conf.jsonand dataset.- You must modify
aggregator.ip&aggregator.portto your own server. - You can choose your training framework by modifying
model_conf.backendtotfliteormnn. - You may config your dataset information at
training_confandtesting_conf. - You may put your own image classification dataset under
/TrainSetand/TestSetdirectories and modifytrain_labels.txtandtest_labels.txtaccordingly. The format of labels must be <filename> <label>. - If you want to perform tasks other than image classification, you should modify framework-specific code for MNN or TFLite. If you are using TFLite, you should also write your own signatures similar to our TFLite model provider
- You must modify
- Make Project. Android Studio will compile and build the app for you. Click Run if you want to run the app on a real android device.
Note that the data paths of training data in the mobile devices and corresponding schemas are configurable when users submit jobs in the cloud to train or fine-tune a particular model (i.e., by updating - data_path in yml).
If you need any further help, feel free to contact FedScale team or the developer website email of this app.