Hexbug Research

Machine Learning for Active Matter

Tracking and analyzing Hexbug locomotion using DeepLabCut to understand collective motion patterns and emergent behaviors in mechanical active matter systems.

Institution Augsburg University
Research Period Summer 2024
Framework DeepLabCut

Research Overview

Understanding the dynamics of biological and mechanical systems often requires tracking and analyzing their motion. This summer research project explores the movement of Hexbugs, small autonomous robots mimicking biological motion, within a controlled circular arena. By applying DeepLabCut (DLC), an open-source machine learning tool used for markerless tracking of moving objects, we were able to track their paths and analyze the underlying behavioral patterns.

The research demonstrates how models trained on a few annotated frames can generalize to predict trajectories across entire video datasets, enabling in-depth motion analysis with minimal manual labor. This approach leverages DeepLabCut's deep learning framework for markerless pose estimation and automated trajectory tracking of multiple Hexbugs simultaneously, providing a scalable solution for motion analysis.

Our analysis employs two key metrics: Mean Squared Displacement (MSD) to quantify motion patterns, and the Order Parameter (Φ) to measure collective behaviors. Through this quantitative analysis, we discovered unexpected intermittent synchronization and clustering behaviors resembling natural swarm dynamics observed in biological systems such as bacterial colonies and flocking birds.

This work provides insights into how machine learning can efficiently track and analyze active matter systems, with implications for understanding collective motion in both mechanical and biological contexts. The trained model successfully tracked Hexbugs with high accuracy, generating clean and continuous trajectories that reveal complex motion patterns within the circular arena.

Methodology

A systematic approach combining experimental design with machine learning analysis

1. Arena Design

The Hexbugs were placed in a circular arena with an enclosing ring to simulate biological motion patterns. This controlled environment allowed us to observe and record their interactions and movement behaviors systematically. The circular boundary created constraints that influenced the collective dynamics of the system.

2. Video Recording

An overhead camera was mounted to capture high-resolution movement patterns for comprehensive analysis. The recording setup ensured consistent lighting and frame rate throughout the experiments, which was critical for accurate tracking and analysis of the Hexbug trajectories.

3. Frame Annotation

Manual labeling of key points on a small subset of frames was performed to train the neural network. This initial annotation phase required careful identification of tracking points on each Hexbug, establishing the foundation for the machine learning model to learn spatial relationships.

4. Model Training

DeepLabCut's convolutional neural network was trained to learn spatial relationships and key point recognition. The model utilized transfer learning from pre-trained networks, allowing it to generalize from the limited labeled data to predict positions across entire video sequences with high accuracy.

5. Automated Tracking

Once trained, the model applied predictions across entire video datasets with high accuracy. This automation eliminated the need for manual frame-by-frame tracking, dramatically reducing the time required for analysis while maintaining consistency and precision in the measurements.

6. Metric Computation

We calculated Mean Squared Displacement (MSD) and Order Parameter to quantify motion patterns and collective behavior. These metrics provided quantitative insights into the diffusive versus directed motion characteristics and the degree of alignment among the Hexbugs over time.

Experimental Visuals

Video recordings and data visualizations from our experiments with different Hexbug configurations

5 Hexbugs - Pre-Labeled Video

Raw video footage showing 5 Hexbugs in the arena before DeepLabCut tracking

5 Hexbugs - DeepLabCut Tracked Output

Tracked video output with predicted positions and trajectories overlaid by DeepLabCut

Trajectory Plots

5 Hexbugs Configuration
Trajectory plot for 5 Hexbugs

Trajectory plot showing the complete movement paths of all 5 Hexbugs throughout the experimental trial

7 Hexbugs Configuration
Trajectory plot for 7 Hexbugs

Trajectory plot showing the complete movement paths of all 7 Hexbugs with increased agent density

Mean Squared Displacement (MSD)

5 Hexbugs Configuration
MSD plot for 5 Hexbugs

Mean Squared Displacement analysis quantifying how far the Hexbugs moved from their initial positions over time

7 Hexbugs Configuration
MSD plot for 7 Hexbugs

Mean Squared Displacement analysis showing motion patterns with higher agent density in the arena

Velocity Measurements

5 Hexbugs Configuration
Velocity plot for 5 Hexbugs

Time series velocity measurements showing the speed variations of each tracked Hexbug

7 Hexbugs Configuration
Velocity plot for 7 Hexbugs

Velocity time series demonstrating the complex dynamics of increased agent interactions

Order Parameter (Φ)

5 Hexbugs Configuration
Order parameter for 5 Hexbugs

Order parameter analysis revealing the degree of collective alignment and coordination over time

7 Hexbugs Configuration
Order parameter for 7 Hexbugs

Order parameter showing collective behavior variations with increased population density

7 Hexbugs - Pre-Labeled Video

Raw video footage showing 7 Hexbugs in the arena with increased agent density

7 Hexbugs - DeepLabCut Tracked Output

Tracked video with predicted positions demonstrating multi-agent tracking capabilities

Key Results

Insights from trajectory analysis and behavioral pattern recognition

Trajectory Mapping

The trained model successfully tracked multiple Hexbugs simultaneously, generating clean and continuous trajectories that reveal complex motion patterns within the circular arena. The trajectory plots demonstrate the model's ability to maintain consistent tracking even when Hexbugs moved in close proximity to one another or temporarily overlapped in the video frame.

Motion Analysis

Mean Squared Displacement analysis revealed that Hexbugs exhibited a mix of diffusive and directed motion patterns, with behavior varying based on boundary conditions. The MSD calculations showed transitions between ballistic motion when Hexbugs moved freely and confined motion when they encountered the arena walls or other obstacles.

Collective Behavior

Order parameter analysis indicated varying degrees of collective alignment, influenced by initial conditions and the number of Hexbugs in the arena. The data revealed periods of synchronized movement alternating with more chaotic phases, suggesting emergent coordination despite the lack of explicit communication between the mechanical agents.

Key Findings

  • High-accuracy automated tracking achieved with minimal manual annotation
  • Intermittent synchronization observed, suggesting emergent coordination
  • Clustering behaviors similar to natural swarms documented in biological systems
  • Model generalizes well across different trials and arena configurations
  • Efficient scalability demonstrated through successful multi-agent tracking

Python Analysis Code

Detailed implementation of data analysis and visualization

All Python code used for trajectory analysis, MSD calculations, order parameter computation, and visualization generation is available in a separate repository. The code includes data processing scripts, metric computation functions, and plotting utilities used to generate the figures shown in this research.

Analysis Metrics

Mathematical frameworks for quantifying motion and collective behavior

Mean Squared Displacement (MSD)

MSD(τ) = ⟨|r(t + τ) - r(t)|²⟩

Quantifies how far Hexbugs move from their initial positions over time, where r(t) represents position at time t and τ is the lag time.

Interpretation:

• Linear MSD → Ballistic motion
• MSD ∝ τ → Diffusive behavior
• Sub-linear MSD → Confined motion

Order Parameter (Φ)

Φ = (1/N)|Σᵢ vᵢ/|vᵢ||

Measures collective directionality and alignment, where vᵢ is the velocity vector of Hexbug i and N is the total number of Hexbugs.

Interpretation:

• Φ ≈ 1 → Strong alignment (collective motion)
• Φ ≈ 0 → Random/chaotic motion
• Intermediate values → Partial coordination

Research Team

Collaborative effort between students and faculty at Augsburg University

YG

Yuva Gottimukala

Lead Researcher

HL

Hanna Le

Research Collaborator

MD

Dr. Moumita Dasgupta

Research Mentor & Advisor

Augsburg University