FlyMimic is the codebase for the imitation learning experiments in the paper:
Musculoskeletal simulation of limb movement biomechanics in Drosophila melanogaster
This repository hosts:
- Musculoskeletal model of the fly legs with different joint passive properties
- Motion capture data of fly walking behavior
- RL tasks compatible with dm_control
- Imitation learning training with PPO Stable Baselines3
Note
This repository focuses on imitation learning experiments and provides MuJoCo models converted from OpenSim. For the original muscle model development and parameter optimization in OpenSim, please refer to this repository.
To install flymimic, clone the repository:
git clone https://github.com/gizemozd/FlyMimic.git
cd FlyMimicThen, create a virtual environment, and install the required dependencies:
conda create -n flymimic python=3.10
conda activate flymimic
pip install -e .(Optional) To install the optional dependencies for visualization, run:
pip install -e ".[viz]"To install the development dependencies, run:
pip install -e ".[dev]"# Train a model
python scripts/train_muscle.py
# Evaluate the trained model
python scripts/eval_rollout.pyTo train a model with a custom configuration:
python scripts/train_muscle.py --config-name=train_armTo evaluate a trained model:
python scripts/eval_rollout.py model_path=./logs/demo_model.zipNote
You can download the other trained models from here.
FlyMimic/
├── flymimic/
│ ├── assets/ # MuJoCo models and motion capture data
│ ├── config/ # Hydra configuration files
│ ├── env/ # Wrappers for dm_control
│ ├── evaluation/ # Evaluation tools
│ ├── tasks/ # RL environment tasks
│ ├── train/ # Training modules
│ └── utils/ # Utility functions
├── scripts/ # Training and evaluation scripts
└── logs/ # Training outputs and saved models
If you use flymimic in your research, please cite our paper:
@misc{ozdil2025musculofly,
title={Musculoskeletal simulation of limb movement biomechanics in Drosophila melanogaster},
author={Pembe Gizem Özdil and Chuanfang Ning and Jasper S. Phelps and Sibo Wang-Chen and Guy Elisha and Alexander Blanke and Auke Ijspeert and Pavan Ramdya},
year={2025},
eprint={2509.06426},
archivePrefix={arXiv},
primaryClass={q-bio.NC},
url={https://arxiv.org/abs/2509.06426},
}