add README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- connectome
|
| 5 |
+
- drosophila
|
| 6 |
+
- computational-neuroscience
|
| 7 |
+
- drone
|
| 8 |
+
- fpv
|
| 9 |
+
- liftoff
|
| 10 |
+
- pytorch
|
| 11 |
+
- recurrent-neural-network
|
| 12 |
+
- imitation-learning
|
| 13 |
+
- reinforcement-learning
|
| 14 |
+
library_name: pytorch
|
| 15 |
+
pipeline_tag: reinforcement-learning
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Haltere: a fruit-fly connectome brain that flies an FPV drone
|
| 19 |
+
|
| 20 |
+
A recurrent network whose 30,000 neurons and 2.77 million synaptic connections are copied from the
|
| 21 |
+
[Janelia male CNS connectome v1.0](https://www.janelia.org/project-team/flyem/male-cns-connectome)
|
| 22 |
+
(FlyEM, Cambridge Connectomics, Google Connectomics), trained to fly a quadcopter in the FPV
|
| 23 |
+
simulator [Liftoff](https://store.steampowered.com/app/410340/). The drone's senses are written into
|
| 24 |
+
the fly's own sensory neurons (haltere, wing campaniform, optic-flow, ocellar, Johnston's organ,
|
| 25 |
+
compass and goal cells) and the four stick commands are read out of the wing motor neurons and their
|
| 26 |
+
premotor partners. Synaptic structure and sign are fixed by the connectome; per-synapse gains,
|
| 27 |
+
neuron gains, biases, time constants, sensory encoders and the readout are trained.
|
| 28 |
+
|
| 29 |
+
Code, training pipeline, Liftoff integration and videos: https://github.com/skulitom/haltere
|
| 30 |
+
|
| 31 |
+

|
| 32 |
+
|
| 33 |
+
## Files
|
| 34 |
+
|
| 35 |
+
| file | what | use |
|
| 36 |
+
|---|---|---|
|
| 37 |
+
| `ftSmooth_best.pt` | recommended brain for Liftoff: fine-tuned with 50 ms extra latency and a smoothness penalty | `haltere liftoff fly ftSmooth_best.pt` |
|
| 38 |
+
| `ftRobust_best.pt` | wide domain randomization; first brain that flew in Liftoff | |
|
| 39 |
+
| `imJ_best.pt` | imitation of the MLP controller with the premotor readout | |
|
| 40 |
+
| `mlp_baseline.pt` | the MLP teacher (no connectome) | control experiment |
|
| 41 |
+
| `flight.npz`, `flight.nodes.parquet`, `flight.meta.json` | the built flight graph: 30,000 neurons, signed synapse counts, named populations | required by every brain checkpoint |
|
| 42 |
+
|
| 43 |
+
The checkpoints are slim (parameters only, about 12 MB); the graph is loaded next to them. Full
|
| 44 |
+
checkpoints with optimizer state are on the
|
| 45 |
+
[GitHub release](https://github.com/skulitom/haltere/releases/tag/v0.1.0).
|
| 46 |
+
|
| 47 |
+
## Results
|
| 48 |
+
|
| 49 |
+
| controller | simulator, full difficulty | Liftoff |
|
| 50 |
+
|---|---|---|
|
| 51 |
+
| MLP baseline | 0.05 m mean error, 100% within 0.5 m | not flown |
|
| 52 |
+
| `imJ_best` (imitation) | 0.22 m, 95% | drifts 1.4 m on the physics stand-in |
|
| 53 |
+
| `ftRobust_best` (+ domain randomization) | 0.20 m, 99.6% | 2 m hover, 0.34 m mean error over 40 s; 3 m square pattern |
|
| 54 |
+
| `ftSmooth_best` (+ latency, smoothness) | 0.30 m, 95% (50 ms delay) | 4x smaller stick jitter at Liftoff-like latency |
|
| 55 |
+
|
| 56 |
+
Full difficulty: 25 degrees of tilt, 90 deg/s rotation, 1 m/s velocity and 1 m offset at the start,
|
| 57 |
+
targets anywhere in a 6 x 6 x 2 m box, physics jittered by 35%.
|
| 58 |
+
|
| 59 |
+
## How to use
|
| 60 |
+
|
| 61 |
+
```bash
|
| 62 |
+
git clone https://github.com/skulitom/haltere && cd haltere
|
| 63 |
+
uv venv --python 3.13 .venv && uv pip install --python .venv/Scripts/python.exe torch --index-url https://download.pytorch.org/whl/cu128
|
| 64 |
+
uv pip install --python .venv/Scripts/python.exe -e ".[dev]"
|
| 65 |
+
# put the files of this repo into artifacts/ and data/built/, then:
|
| 66 |
+
haltere eval artifacts/ftSmooth_best.pt # simulator evaluation
|
| 67 |
+
haltere render artifacts/ftSmooth_best.pt # neural activity + drone video
|
| 68 |
+
haltere liftoff doctor # everything needed to fly it in Liftoff
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## Data
|
| 72 |
+
|
| 73 |
+
Connectome: male CNS v1.0, Janelia FlyEM, CC BY 4.0, downloaded by `haltere fetch` from
|
| 74 |
+
`gs://flyem-male-cns` (neuron annotations, neurotransmitter predictions, connection weights). Not
|
| 75 |
+
redistributed here.
|
| 76 |
+
|
| 77 |
+
## Method in one paragraph
|
| 78 |
+
|
| 79 |
+
Lappalainen et al. 2024-style connectome-constrained RNN (rate units, weights proportional to
|
| 80 |
+
synapse counts with fixed neurotransmitter signs) on a 30k-neuron subgraph of the male CNS (all
|
| 81 |
+
neurons within two synapses of the flight senses and the wing motor neurons, plus the central
|
| 82 |
+
complex and all descending neurons). Trained in a batched differentiable quadrotor simulator with
|
| 83 |
+
Betaflight-style rates and rate PID (Liftoff's own Zetaflight gains) by imitation of an MLP
|
| 84 |
+
controller, then fine-tuned by back-propagation through the simulator with domain randomization.
|
| 85 |
+
Flown in Liftoff through its UDP telemetry and a virtual Xbox controller (ViGEmBus).
|