Edge Classification with a Token Bucket MDP
This is a python implementation of the algorithm described in the paper below for computing optimal offloading policies, as well of simulation and testing code to evaluate these policies:
We recommend installing a recent Python 3.7+ distribution of
Anaconda. The code uses
for numeric computation,
numba to enable JIT compilation and speed-up of the
multiprocessing to run tests for different parameters in
matplotlib to visualize results in jupyter notebooks.
Policy Computation and Simulation
Simulation Results and Data
You may either download and use our pre-computed results, or re-run experiments yourself.
Download pre-computed results
From the repository directory, run the following commands in your shell:
wget https://github.com/ayanc/edgeml.mdp/releases/download/v1.0/save_data.zip unzip save_data.zip
This will extract all data files into the
save/ sub-directory. You should then
be able to directly run the note-books in the visualization step.
You will need to first download an
npz file containing the outputs and
performance of the weak and strong
OFA classifiers used in our
simulations. Do this by running the following command in your shell from the
After that, run the following test scripts in sequence for the single device experiments. Note that these scripts will run in parallel spawning a pool of processes based on all available CPU cores on the machine.
./runtest_fmetric.py # Runs tests to fit entropy to metric separately for each fold. ./runtest_single.py # Runs single device simulations for various (r,b) values. ./runtest_robust.py # Runs experiments with train-test mismatch to measure robustness.
Then, to run experiments for the multi-device experiments, run the following tests in sequence. Note that since this requires doing a grid-search for every setting of (r_tot, b_tot, #camera) for the hierarchical strategy, this might take a while.
./runtest_mcpolicies.py # Generate policies for all possible r_i, b_i ./runtest_mcsim.py # Simulate each policy with each setting on training set. ./runtest_mcam.py # Generate final results.
We provide separate jupyter notebooks to visualize (either downloaded or generated) results, producing the figure included in the paper (and more).
- metricfit-viz.ipynb - Illustrating metric mapping and statistics.
- single-camera-viz.ipynb - Single camera policies and performance.
- robustness-viz.ipynb - Performance under train-test mismatch.
- multi-camera-viz.ipynb - Performance of various multi-device strategies.
This work was partially supported by the National Science Foundation under awards no. CPS-1646579 and CNS-1514254. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors, and do not necessarily reflect the views of the National Science Foundation.