A subscription to JoVE is required to view this content. Sign in or start your free trial.

Method Article

Protocol for Tracking and Automated Behavioral Quantification in Drosophila melanogaster

173 views

DOI:

10.3791/71417

July 24th, 2026

* These authors contributed equally

In This Article

Summary

This protocol uses pose estimation by Python to track key body points in paired Drosophila, facilitating the automated quantification of subtle social behaviors, especially in social interaction, as well as heatmaps and locomotor trajectories.

Abstract

To develop an open-source analytical tool that overcomes the limitations of traditional centroid-based tracking methods, we present a protocol to accurately analyze social interactions in freely behaving Drosophila pairs. Specifically, this protocol is inspired by the high-resolution network (HRNet) framework to simultaneously track five anatomical key points—head, thorax, abdomen, and left and right wing tips —aiming to generate high-resolution coordinate data for subsequent quantitative analysis of social behaviors. This protocol provides a complete workflow based on Python and a graphical user interface (GUI) we designed, including dataset construction, model training, and automated coordinate extraction, along with integrated modules for generating spatial occupancy heatmaps, locomotor trajectories, and social interaction ratios in flies. To validate this framework, it was tested by using two widely used strains, w1118 and Canton-S (CS). Our results demonstrated the stability of key-point detection and revealed genotype-specific differences in spatial utilization and locomotive structure. This methodology provides a scalable foundation for quantitative ethology and automated analysis of social interactions in Drosophila, while reducing manual annotation effort and improving reproducibility.

Introduction

Drosophila melanogaster is a widely used model organism with powerful genetic tools and well‑mapped neural circuits that enable mechanistic dissection of behavior1. It has a wide range of social behaviors, including courtship and aggression, and a strong learning ability2,3,4,5,6,7,8. Each is composed of distinct motor elements controlled by a compact but extremely well-organized nerve syste....

Access restricted. Please log in or start a trial to view this content.

Protocol

1. Fly preparation

  1. Collect and sex the flies around 3–4 days old under brief CO₂ anesthesia before experiments.
    NOTE: The duration of anesthesia and the CO₂ flow rate may vary depending on the specifications and pressure of the carbon dioxide cylinder used in each laboratory. Flies should be monitored continuously during anesthesia, and CO₂ exposure should be maintained only until the flies are fully anesthetized and exhibit complete cessation of movement.
  2. Place each fly individually into a 50 mL Falcon tube containing standard cornmeal–agar–glucose–yeast medium.
  3. Maintain flies at 25 °C under a 12 h light/dark cycl....

Access restricted. Please log in or start a trial to view this content.

Results

Figure 1 illustrates the arena geometry, illumination configuration, and camera placement used for recording natural social interactions in Drosophila. The setup ensures uniform lighting and stable imaging conditions suitable for pose estimation and coordinate extraction.

Automated pose estimation was applied to all recorded videos to extract two-dimensional coordinates for predefined anatomical key-points of each fly. The model consistently identified he.......

Access restricted. Please log in or start a trial to view this content.

Discussion

Our study shows that machine-learning-based pose estimation provides a scalable, reliable method for measuring fine-grained social interactions in Drosophila. It overcomes the limitations of centroid-based approaches15,16,17,18 by tracking five anatomical key-points in freely interacting pairs, allowing the acquisition of angular information provided by the body axis and head-to-head d.......

Access restricted. Please log in or start a trial to view this content.

Disclosures

The authors declare no financial conflicts of interest.

Acknowledgements

We acknowledge Dr. Jingyuan Zhang in the Graduate School at Guangzhou Medical University for providing and maintaining the imaging setup.

Funding: Guangzhou Major Medical Disciplines Project (2025-2027)

....

Access restricted. Please log in or start a trial to view this content.

Materials

List of materials used in this article
NameCompanyCatalog NumberComments
AgarBioFroxx8211GR500
camera(MV-CU013-A0UC)HikvisionMV-CU013-A0UC
Carbon DioxideMesser124-38-9
D(+)-Glucose anhydrousBioFroxx1179GR500
Drosophila Narrow Vials (Falcon tube)Biolgix51-0500
EthanolChron Chemicals64-17-5
LED panel//custom-made
MethylparabenSigma99-76-3
polyethylene plate//custom-made
Python/version 3.6
SucroseDaMao57-50-1
transparent acrylic plates//custom-made
YeastAngel100004237033

Reprints and Permissions

Tags

Drosophila TrackingSocial Interaction AnalysisKey Point DetectionAutomated TrackingHigh Resolution NetworkLocomotor TrajectoriesSpatial Occupancy HeatmapsQuantitative EthologyPython GUI