
Knitronics Add-on Badge for Open Sauce 2026
This year I decided to create my own add-on badge for Open Sauce, which resulted in this fun LED flasher badge based on a simple 555 timer circuit.
![PlantVillage Disease Classification [AKIDA HARDWARE]](https://deveco.nyc3.digitaloceanspaces.com/cover/7df19877-cb4c-4d1a-897c-cd70dff2f797.png)
![PlantVillage Disease Classification [AKIDA HARDWARE]](https://deveco.nyc3.digitaloceanspaces.com/cover/695f0755-bd94-4bb4-b364-9640e4a91653.png)
Run Time: ~10 minutes (evaluation and sparsity); hardware benchmarking adds a few minutes once a device is detected Level: Beginner–Intermediate
Akida 1.0 — Evaluation and activation sparsity run in software simulation; the Hardware Benchmark section requires a physical AKD1500 device
This project walks through evaluating a PlantVillage AkidaNet model on Akida and, if a hardware device is available, benchmarking its latency and power on a physical AKD1500 — where this model runs in under 46 ms at under 10 mJ per inference. It's the hardware companion to the PlantVillage Disease Classification software project. If you haven't seen that yet, it walks through training, quantizing, and converting the model this project benchmarks.
| Float acc. | QAT acc. | Akida acc. | Sparsity | Params |
|---|---|---|---|---|
| 99.61% | 99.43% | 99.43% | 54.58% | 1,156,054 |
AKD1500 hardware benchmark
| Mapping | NPs | Passes | Cycles | Latency (ms) | Total Power (mW) | Total Energy (mJ/inf) | Dyn. Power (mW) | Dyn. Energy (mJ/inf) |
|---|---|---|---|---|---|---|---|---|
| Minimal | 34 | 2 | 36,418,493 | 91.046 | 154.7 | 14.839 | 41.2 | 3.948 |
| AllNPs | 59 | 2 | 18,314,559 | 45.786 | 196.2 | 9.389 | 81.2 | 3.887 |
🛒 Don't have an AKD1500 yet? Evaluation and Activation Sparsity below run in software — no hardware required. Reproducing the benchmark table above needs a physical board, available in the BrainChip Shop — Akida™ Edge AI Hardware & Cloud Access.
A pretrained Akida model is included in the repository, at pretrained_models/akidanet_plant_village_qat.fbz. As with all model files in the repo, that is handled via git-lfs. If you completed the software project and prefer to benchmark the model you built there, just point the commands below at models/akidanet_plant_village_qat.fbz instead.
The model is a standard AkidaNet (from akida_models) with width multiplier alpha = 0.5 and input resolution 224 × 224 RGB. The 38-class classification head replaces the ImageNet top layers, and input scaling is built into the model; the pipeline delivers raw uint8 pixel values with no additional normalisation.
The PlantVillage dataset is loaded via TensorFlow Datasets (plant_village). On the first run, TFDS will automatically download and prepare the dataset (~800 MB) to the data path. By default ./data/plant_village, or the path you provide with --data / -d. Subsequent runs read from the local cache.
The dataset is split 80/10/10 (train/val/test). Images are resized from variable original sizes to 224×224 RGB and delivered as uint8 pixel values (0–255).
To pre-download the dataset without running training:
python -c "import tensorflow_datasets as tfds; tfds.load('plant_village', data_dir='./data/plant_village')"Original dataset licensed under CC0 1.0 (public domain):
J, ARUN PANDIAN; GOPAL, GEETHARAMANI (2019), "Data for: Identification of Plant Leaf Diseases Using a 9-layer Deep Convolutional Neural Network", Mendeley Data, V1, doi: 10.17632/tywbtsjrjv.1
💡 We recommend using your preference of docker or a virtual environment such as
venvorconda. For example, to create and activate an appropriate virtual environment with conda:conda create -n brainchip_devhub_env python=3.12 -y conda activate brainchip_devhub_env
⚠️ Already completed the software project? Reuse that same clone and skip ahead to the Walkthrough below.
Otherwise, this example lives in the public brainchip_devhub repository. With your container or virtual environment active, all requirements along with utilities local to the repository are installed by running the following at the top level of the repository:
git clone https://github.com/Brainchip-Inc/brainchip_devhub.git
cd brainchip_devhub
pip install -v -e .Pretrained model weights (.h5, .fbz) are stored directly in the repository, tracked with Git LFS rather than regular git. With git-lfs available (on a Linux machine, one option is sudo apt install git-lfs), pull the actual model files:
git lfs install # one-time setup per machine
git lfs pull # fetch the real model files for this cloneThen move into the example directory — every command below runs from here:
cd akida1/model_zoo/plant_village📓 Prefer to run this as a notebook?
plant_village_notebook_benchmark.ipynb, in the directory you just entered, walks through evaluation of model accuracy on Akida and, if a hardware device is available, covers benchmarking of model latency and power. Unlike the script below, the notebook checks for hardware cell by cell and simply skips ahead if none is found — a better choice if you're not yet sure whether your device is detected.
| File | Role |
|---|---|
| plant_village_eval.py | Evaluates a model on the held-out test set — Keras .h5 or Akida .fbz |
| plant_village_benchmark.py | Runs the full hardware benchmark suite: simple, full-model, and per-layer timing, plus power (with an AKD1500 connected) |
We first run evaluation through the Akida model, to check that accuracy is comparable to that obtained from the quantized tf_keras model. If an Akida 1 hardware device is connected, it will be used for inference; if not, the code will fall back to using the software backend: this delivers a bit-accurate simulation of the results that will be obtained when running the model on hardware. This step works either way, so it's a good check to run before going any further:
python plant_village_eval.py -l pretrained_models/akidanet_plant_village_qat.fbzExpected result: ~99.43% — matching the quantized Keras model, as expected.
Akida hardware skips computation for zero-valued activations, so activation sparsity directly reduces both energy consumption and inference latency. Below we measure per-layer sparsity on a 100-sample calibration batch drawn from the training set. This step also runs without hardware
from akida import Model
from akida_models.sparsity import compute_sparsity
from brainchip_utils.plot_utils import pretty_print_sparsity
from plant_village_data import get_samples
INPUT_SHAPE = (224, 224, 3)
NUM_SAMPLES = 100
akida_model = Model('pretrained_models/akidanet_plant_village_qat.fbz')
samples = get_samples('./data/plant_village', input_shape=INPUT_SHAPE, num_samples=NUM_SAMPLES)
sparsity_dict = compute_sparsity(akida_model, samples=samples)
pretty_print_sparsity(sparsity_dict)Per-layer sparsity ranges from ~32% at the first conv to well over 70% deeper in the network, with a mean of 54.58%.
Everything below requires a physical AKD1500 device to be connected. Akida is an event-driven architecture: computations scale with the number of non-zero activations, not with tensor size, so benchmark results are input-dependent — the same real sample images used above are the correct input to use here too, rather than synthetic data.
plant_village_benchmark.py runs the full suite in one command; a simple timing loop, the full-model benchmark across both mapping modes, and the per-layer breakdown. It also saves two plots to the working directory:
python plant_village_benchmark.py -l pretrained_models/akidanet_plant_village_qat.fbzA few minutes, most of it spent on the per-layer benchmark (100 samples, timed layer by layer). Here's what each part of that run produces, in the order it runs.
The simplest way to time an Akida model is to call forward in a loop and read back two clocks after each inference:
The two numbers should agree closely; a large divergence would indicate a transfer or driver bottleneck.
This sweeps both MapMode.Minimal (fewest NPs, lowest power) and MapMode.AllNps (all NPs, maximum parallelism), coordinating optional INA219 power measurement alongside the timing. Power figures only populate if a power meter is wired up to the board; without one, expect the latency and cycle counts but no power columns.
The plot below shows one column per map mode: a power trace (if a power meter was connected) and the hardware mapping layout.
In Minimal mapping the model is scheduled onto the fewest NPs required, keeping instantaneous power draw low. Switching to AllNps spreads the model across more NPs — power draw is higher, but the job finishes in less than half the time, so total energy per inference actually drops, from 14.8 mJ to 9.4 mJ. AllNps mapping isn't a trade-off here; it's faster and more efficient at the same time.
Full-model timing tells you the total cost but not where it's spent. This reconstructs latency layer by layer, running cumulative sub-models and differencing the results. Because Akida processes events, a layer's cost is proportional to its input sparsity: a layer receiving 90% sparse inputs has far fewer events to process than one receiving 10% sparse inputs. The per-layer timing and the sparsity values measured above are naturally correlated, and low-sparsity layers are typically the latency bottlenecks.
The plot stacks three panels: per-layer latency, input sparsity per layer, and the hardware mapping.
The inverse relationship between sparsity and latency is the direct signature of the event-driven compute model: dense activations generate more events, and more events mean more work for the hardware.
Evaluation confirms the model performs identically to its software simulation (99.43%), and the hardware benchmark shows what that translates to on real silicon: under 46 ms per inference at under 10 mJ. AllNps mapping beats Minimal on both latency (45.8 ms vs. 91.0 ms) and total energy per inference (9.4 mJ vs. 14.8 mJ) — spreading the model across more of the chip finishes the job fast enough that it more than pays for the higher instantaneous power draw.
Code: Apache 2.0, from the BrainChip Developer Hub repository. Dataset: CC0 1.0.