bioRxiv Science⌕ Search

bioRxiv · 10.64898/2026.07.24.740557

Cross-session generalization in automated behavioral tracking of Galleria mellonella larvae: comparison of classical computer vision, deep learning and generative domain adaptation

Abstract

BackgroundAutomated behavioral tracking is increasingly used in biological and biomedical research; however, robustness across heterogeneous imaging conditions remains a major challenge. Domain shifts caused by changes in illumination, contrast, or acquisition setup can substantially degrade the performance of computer vision and deep learning models, limiting their practical applicability. This issue is particularly relevant for small-scale biological datasets, where extensive annotation and retraining are often impractical. MethodsWe developed a behavioral tracking framework for Galleria mellonella larvae combining a classical computer vision (CV) pipeline, a YOLOv8s-seg + ByteTrack deep learning pipeline, and generative domain adaptation methods. Behavioral recordings were collected in two independent experimental sessions under distinct illumination conditions (top and bottom lighting), creating a natural cross-session domain shift. The classical pipeline was based on contour detection, adaptive preprocessing, temporal smoothing, and trajectory reconstruction. Deep learning models were trained on 320 manually annotated frames and evaluated in both within-session and cross-session settings. To improve generalization, we investigated generative augmentation using StyleGAN2-ADA and unpaired image-to-image translation using CycleGAN. Tracking outputs were further analyzed through behavioral descriptors, including trajectories, traveled distance, velocity, spatial occupancy heatmaps, and directional movement patterns. ResultsThe classical CV pipeline achieved high detection performance in both recording sessions, with mean detection rates of 99.05% and 99.71%, respectively. A YOLOv8s-seg model demonstrated strong within-session performance but exhibited severe degradation under cross-session evaluation, with larval mask segmentation performance dropping to mAP@0.5 = 9.1%, confirming the presence of a substantial domain shift. Despite differences in detection methodology, behavioral metrics derived from YOLO and CV pipelines showed strong agreement at the group level (Pearson correlation r = 0.89; median distance ratio = 0.99). Generative augmentation with StyleGAN2-ADA did not yield meaningful gains in tracking robustness -- likely because baseline performance was already near ceiling -- whereas CycleGAN-based domain adaptation substantially reduced the domain gap and improved cross-session detection performance while preserving biologically relevant trajectory structures and spatial behavioral patterns. ConclusionsCross-session variability represents a critical challenge for automated behavioral tracking in biological experiments. Our results demonstrate that carefully designed classical computer vision approaches can achieve highly reliable tracking in small-data settings, while deep learning models require explicit strategies to address domain shift. Generative domain adaptation, particularly CycleGAN-based image translation, offers an effective solution for improving cross-session generalization without additional manual annotation. The proposed framework provides a robust foundation for scalable behavioral phenotyping of Galleria mellonella and other small biological model organisms.

Explore related subjects

Keep this discovery

Explore connections, maps & timelines

BibTeXRIS

Smigielski, K., Piorkowska, N.. 2026-07-28. Cross-session generalization in automated behavioral tracking of Galleria mellonella larvae: comparison of classical computer vision, deep learning and generative domain adaptation. https://doi.org/10.64898/2026.07.24.740557

Cite the original work for its findings. Save a collection to share your selection of sources.

KEEP EXPLORING

Related preprints

Automated pup-level analysis reveals distinct effects of prenatal CBD and THC exposure on maternal retrieval

This study examined how prenatal CBD and {Delta}9-tetrahydrocannabinol (THC) exposure affects maternal caregiving in C57BL/6J mice. We developed the Machine-Automated Scoring of the Pup Retrieval Test (MAS-PRT) to overcome limitations of manual behavioral scoring. MAS-PRT integrates Multi-Animal DeepLabCut for dam and pup tracking with Detectron2 for dynamic nest reconstruction. Validated against 170 manually annotated retrieval trials, the pipeline showed high concordance with manual measurements and enabled reproducible extraction of encounter latency, retrieval latency, and locomotor trajectories. Prenatal exposure did not impair general nest-building or overall home-cage maternal care. However, pups from both CBD and THC groups showed reduced body weight at postnatal day 5. Cox proportional hazards modeling revealed divergent effects by compound: CBD-exposed dams exhibited a weight-dependent increase in probability of encountering and retrieving lighter pups, independent of pup sex. Spatial tracking further showed that dams traversed significantly shorter total trajectories when retrieving female progeny exposed to either compound. Longitudinal trial-by-trial analysis indicated intact task acquisition in controls and CBD dams, whereas THC dams displayed a flattened learning curve driven by lower retrieval latencies on initial trials. Together, these findings indicate that prenatal cannabinoid exposure does not produce generalized disruption of maternal care but instead induces compound-specific alterations in maternal reactivity, retrieval kinematics, and learning dynamics.

animal behavior and cognition↗

A comparison of female competitive traits: Female aggression peaks at nest building but female song spans multiple contexts in a temperate songbird

Female-female competition is increasingly recognized as a key driver of female ornamentation, including birdsong, which often functions in intrasexual competition. However, the specific resources females use elaborate traits to compete for remain unclear. In addition, few studies have simultaneously investigated the use of multiple competitive traits in females, despite growing independent interest in these traits (e.g., female song and aggression). We investigated the competitive contexts of female song, aggression and calling behavior in northern house wrens (Troglodytes aedon) to determine which resources females compete for across the breeding season. We simulated conspecific territorial intrusions using female song at three breeding stages representing different contexts: arrival (mate and territory acquisition), nest building (nest site and breeding status defense), and egg laying (brood defense). We tested whether female song and physical aggression varied as reproductive resources shifted across the breeding cycle. Females were significantly more aggressive during nest building, showing 5.8 times greater odds of a higher-intensity aggressive response during nest building compared to arrival. Female song output was similar across early stages but declined during egg laying, though this was not statistically significant after correction for multiple comparisons and individuals varied substantially in overall singing propensity. Non-song vocalizations varied by call type and breeding stage. Calls associated with aggression occurred most frequently during nest building, consistent with peak physical aggression responses. Together, these results identify nest building as the stage of highest female aggression, consistent with heightened competition over nest cavities and associated breeding status in this cavity-nesting species. In contrast, female song occurred across all stages and appears to function in multiple competitive contexts. This study provides evidence for context and mode-specific female signaling in a temperate songbird and highlights that females strategically use aggression, calls, and song to mediate social conflict across breeding contexts.

animal behavior and cognition↗

Tracking human foragers and their prey reveals adaptive predator-prey dynamics

Hunting for mobile prey is thought to have played a key role in hominin evolution, by providing high-quality nutrition that supported the development of the exceptionally large human brain. However, human-prey dynamics remain poorly understood because studies have not yet tracked human foragers and their prey simultaneously. Here, we employ high resolution tracking of groups of human foragers (ice-fishers) and their prey (fish shoals) to study human-prey dynamics. Our results show that foragers adaptively combined personal and social information in deciding where to forage and for how long, closely matching the prey distribution. Prey responded dynamically to human exploitation, showing increased attraction to fishing activity, alongside decreased biting probability. Furthermore, we found that foragers adaptively relied on memory, preferentially returning to areas with high prey presence, particularly when their current return rate was low. Our results show how human foragers overcome the challenges of extracting invisible, mobile and reactive prey by tightly tuning patch-selection, patch-leaving and patch-return decisions to the distribution and behaviour of their prey.

animal behavior and cognition↗