Abstract
Accurately distinguishing subtle phenotypic differences between Caenorhabditis elegans strains remains a major challenge in functional genetics and behavioural studies. Here, we evaluate how image resolution affects strain discrimination using an automated Multiview system combining macroscopic plate-level imaging with high-resolution microscopic single-worm recordings. Three strains were analysed: wild-type N2, a transgenic line with mild dysfunction of GABAergic neurons leading to subtle locomotor alterations (vltIs66), and a strongly uncoordinated mutant strain (unc-1(vlt10)). The three strains were analysed using traditional locomotion and shape descriptors. While both imaging modalities detected clear differences for the strongly uncoordinated unc-1(vlt10) strain, no traditional morphometric and kinematic descriptors reliably separated vltIs66 from N2. We then trained a CNN–Transformer directly on image sequences. When trained on macro-camera data, the model failed to discriminate between N2 and vltIs66, whereas the same architecture trained on micro-camera sequences achieved robust separation, revealing phenotype-specific patterns not captured by conventional descriptors. To quantify the impact of spatial detail, micro-camera recordings were progressively downscaled by factors of 2, 4, 8 and 16 and the model was retrained at each effective resolution. This resolution sweep showed that performance remains stable under moderate downsampling but degrades markedly at coarse resolutions, indicating a minimum effective pixel density required for subtle phenotype classification. These findings highlight the importance of high-resolution, sequence-based deep learning for detecting fine locomotor differences in C. elegans.
Keywords: Convolutional neural networks, Phenotypic differentiation, Deep learning, Statistical analysis, C. elegans
Subject terms: Biological techniques, Computational biology and bioinformatics
Introduction
Caenorhabditis elegans is a widely used model organism in studies of aging, neuroscience, and genetics1,2 due to its simplicity, short life cycle, and conservation of key molecular pathways with higher organisms3. Among the different metrics employed to study healthspan in C. elegans, displacement and locomotion analysis provide a non-invasive readout for evaluating the functional state and vitality of individuals over time4,5. Quantifying movement allows for the identification of altered motor phenotypes associated with aging6, genetic mutations, or pharmacological treatments7,8.
However, the sensitivity of locomotion-based phenotyping critically depends on the spatial resolution of the imaging system and on the downstream analysis methods used to extract behavioural descriptors. When image quality is limited, centroid-based trajectories may overlook subtle phenotypic signatures, especially between strains with mild locomotion differences. Although it is generally assumed that higher spatial resolution should improve behavioural phenotyping, the extent to which increased resolution translates into measurable gains in strain discrimination has not been systematically quantified. Existing studies do not establish when macroscopic imaging is sufficient for phenotype analysis and when microscopic imaging becomes necessary, nor do they evaluate how modern deep-learning models exploit these differences in information content.
A wide range of image-analysis approaches has been proposed for C. elegans behavioural phenotyping. Traditional pipelines rely on threshold-based segmentation, contour analysis, and traditional morphological and kinematic descriptors9,10, sometimes combined with classical machine learning algorithms such as Random Forest or support vector machines11,12. In parallel, recent work has increasingly leveraged deep learning for worm detection, tracking, and phenotype classification13,14, as well as computational models of worm shape and posture15–18. These methods target different physiological parameters (e.g., centroid motion, posture dynamics, body curvature) and differ in their dependence on image quality: posture-based descriptors and fine-grained texture features typically require higher spatial resolution than coarse centroid trajectories. These approaches can be broadly grouped into three families according to the physiological variables they quantify: centroid-based locomotion metrics, posture-based descriptors, and pixel-level texture or shape features. Each family operates at a different level of spatial detail and therefore exhibits different sensitivity to image resolution, as summarised in Supplementary Table S1.
After grouping these approaches, it is useful to briefly outline what each family captures and why resolution matters. Centroid-based locomotion metrics summarise the animal’s gross displacement (e.g., path length, speed, turning), and can often be extracted robustly from low-magnification plate recordings, but they may miss subtle phenotype signatures when strains differ mainly in fine-scale gait or posture. Posture-based descriptors quantify body shape evolution (e.g., curvature, bending waves, eigenworm coefficients) and therefore require sufficient spatial detail to recover reliable skeletons and width profiles; at coarse resolutions, segmentation and skeletonisation become unstable and informative posture dynamics are lost. Pixel-level texture or shape features operate directly on local appearance and can capture subtle morphological cues, but they are also the most resolution-dependent and are typically inaccessible in plate-level imaging where each worm spans only a few pixels in width.
In this work, we refer to traditional morphometric and kinematic descriptors as conventional, explicitly defined measurements extracted from trajectories and segmentations, including centroid-based locomotion statistics, mask-based shape measures, and skeleton/posture-dynamics metrics. This organisation highlights that only a subset of descriptors truly benefits from microscopic imaging, whereas others can be reliably extracted from macroscopic recordings.
Automation of C. elegans assays has also increased substantially due to advances in imaging hardware and computational analysis. Several systems have explored automated behavioural assays using computer vision to track locomotion and posture at plate or single-worm level7,19,20 while other platforms have specifically targeted large-scale automated lifespan and healthspan measurements21–23. Although these studies provide robust solutions for performing very comprehensive Lifespan and Healthspan experiments using images with several C. elegans (which in this study we consider macroscopic images), they fail to offer image sequences focused on a single C. elegans for its individual study, and they also do not offer a robust solution to resolve the problems of loss of identity when C. elegans cross, aggregate or leave the field of view. In parallel, previous works have introduced multi-camera and active-illumination strategies to improve robustness and throughput in automated C. elegans imaging24,25, further emphasising the practical trade-off between field of view and spatial resolution: low magnification enables high-throughput recordings of many animals per plate, whereas high magnification allows detailed single-worm tracking at the cost of throughput and increased data volume.
In this study we distinguish between macroscopic plate-level imaging (macro), which provides a global view of Petri dishes and enables centroid tracking of multiple worms (In this images, the widht of each C. elegans is aproximately 3 pixels) , and high-resolution microscopic single-worm imaging (micro), which captures detailed morphology and posture dynamics but at lower throughput (In this images, the widht of the central C. elegans is, normally, more than 70 pixels). The Multiview system26 used in this study combines two macroscopic cameras to obtain a global view of Petri dishes and locate individual worms, along with a high-resolution microscopic camera, which is automatically positioned over the individual via an XY motorized stage for detailed analysis. This setup allows the acquisition of displacement centroids at both global and individual scales, with differing levels of resolution.
While macroscopic imaging is often sufficient for studies centred on coarse locomotor activity–such as plate-level tracking, centroid trajectories, or estimates of overall displacement–its limited spatial resolution constrains the extraction of finer behavioural features. Subtle posture dynamics, local body deformations, head–tail asymmetries, or changes in oscillatory patterns typically require a detailed representation of the worm’s morphology that cannot be reliably captured at low magnification. In contrast, microscopic imaging provides a high-resolution, centred view of each individual, enabling more precise quantification of posture-derived descriptors and movement microstructure. Therefore, when the goal is to distinguish strains that differ only slightly in their locomotion phenotype, the additional information contained in microscopic images becomes particularly relevant and may substantially increase discriminative power compared with macroscopic recordings.
In this context, the transgenic strain vltIs66, which carries two copies of the insertion vltIs66[unc-25p::144CAG]; myo-2p::mCherry, provides a particularly demanding test case for locomotion-based phenotyping. Characterisations performed on standard NGM agar plates have shown that vltIs66 worms exhibit only a very subtle motor defect compared with strongly uncoordinated unc-1(vlt10) mutants, and that their locomotion closely resembles that of wild-type N2 animals27. In young adults, simple motility indices can become indistinguishable between N2 and vltIs66. As a result, vltIs66 has been explicitly described as a challenging benchmark for automated motility platforms27, since visual inspection on agar and coarse movement metrics often fail to clearly separate it from N2. This makes the N2 versus vltIs66 comparison a stringent testbed for evaluating whether increased spatial resolution and deep learning–based sequence analysis can reveal phenotypic signatures that escape conventional plate-based assays.
The aim of this work is to determine whether high-resolution microscopic imaging provides additional discriminative information compared with macroscopic recordings when analysing subtle phenotypic differences between C. elegans strains (N2 versus vltIs66). To this end, we first quantify locomotion using traditional centroid-based and morphometric descriptors, and evaluate whether these metrics can distinguish N2 from vltIs66 while correctly identifying the impaired unc-1(vlt10) phenotype. We then evaluate the discriminative power of these traditional descriptors both individually and jointly, and compare them against a sequence-based CNN–Transformer trained directly on image sequences, to contextualise how imaging modality (macro vs micro) and analysis approach interact in this subtle discrimination task.
Finally, we train a CNN–Transformer classifier on image sequences acquired with either macro- or micro-camera recordings, and systematically downscale the micro-camera images by different factors to analyse how performance degrades as a function of effective pixel size. This resolution sweep allows us to estimate the range of spatial resolutions over which subtle phenotypic differences remain detectable and to identify approximate points of diminishing returns in terms of additional information gained versus data volume and acquisition complexity.
Materials and methods
To evaluate the influence of image resolution on the sensitivity for detecting locomotor phenotypic differences in Caenorhabditis elegans, we designed an experimental protocol integrating both macro- and micro-imaging systems within an automated Multiview tracking platform. Below, we describe the technical specifications of the hardware, the image acquisition procedures, and the software used for data processing and statistical analysis.
We analysed three C. elegans strains spanning a range of locomotor phenotypes. The wild-type reference strain N2 is widely used as a control in genetic and behavioural studies. A transgenic line carrying two copies of the insertion vltIs66[unc-25p::144CAG; myo-2p::mCherry] (hereafter vltIs66) exhibits mild dysfunction of GABAergic neurons and subtle locomotor alterations while maintaining an overall phenotype similar to wild type. In contrast, the unc-1(vlt10) mutant strain displays pronounced locomotion defects, serving as a positive control for a strong motor phenotype. This combination of strains provides a stringent testbed to evaluate how resolution and analysis methods affect the discrimination of subtle versus strong locomotor differences.
In this work, the Multiview system is used to assess how image resolution and analytical strategy jointly influence phenotypic discrimination. First, we quantify locomotion using traditional centroid-based and morphometric descriptors under both macro- and micro-camera imaging, evaluating whether these descriptors can distinguish N2 from vltIs66 while correctly identifying the impaired unc-1(vlt10) phenotype. Second, we train a CNN–Transformer classifier on image sequences acquired with either macro- or micro-camera recordings, comparing its performance against the traditional-descriptor baseline. Finally, by systematically downscaling micro-camera images and retraining the same classifier, we analyse how performance degrades as a function of effective pixel size. Combining traditional statistics and deep learning within a unified platform allows us to determine when high-resolution imaging becomes necessary for subtle phenotypic discrimination and how much discriminative power is lost as spatial resolution decreases.
Experimental conditions and strains used
The experiments were carried out using Petri dishes of 55 mm in diameter, containing an agar medium on which 15 specimens of C. elegans were placed per plate. A total of 34 plates were used across the three strains. All animals were synchronized to the same developmental stage, corresponding to day 1 of adulthood, in order to avoid variability associated with differences in biological age.
In this study, three different C. elegans strains were analyzed:
N2: the standard reference strain, widely used as a control in genetic and behavioral studies. A total of 14 plates from this strain were used.
vltIs66: a transgenic strain developed at the Instituto de Investigación Sanitaria La Fe (Valencia, Spain). This strain carries two copies of the transgene vltIs66[unc-25p::144CAG]; myo-2p::mCherry, inserted into a defined genomic locus using MosSCI technology. The untranslated CAG expansion produces CAG transcripts that cause mild dysfunction of GABAergic neurons, leading to subtle locomotor alterations while maintaining an overall phenotype very similar to the wild type. A total of 14 plates from this strain were used.
unc-1(vlt10): a mutant strain characterized by pronounced locomotion defects, making it clearly distinguishable from N2 and vltIs66. A total of 6 plates from this strain were used. As will be discussed later in the study, significant differences between unc-1(vlt10) and the other strains were detected only in terms of movement quantity, which is why fewer unc-1(vlt10) plates were needed. The other two strains required more plates to train the classification CNN effectively to differentiate between the strains.
These standardized experimental conditions ensured comparability of the results obteined across the different strains.
Hardware
Experiments were conducted using an automated image acquisition platform based on the Multiview system, which integrates multiple imaging sources for simultaneous tracking at different scales. The configuration includes:
Two motorized picam v1.3 macroscopic cameras (resolution 2592x1944 pixels), equipped with 25 mm lenses and mounted in a top-down orientation to capture the entire surface of 55 mm Petri dishes. This setup provided a worm-level spatial resolution of approximately 36
m/pixel (28 pixels per millimeter).A Raspberry HQ microscopic camera (resolution 2592x1944 pixels, 12.3 MP), equipped with a CS/C-mount zoom lens (0.75x–5x) and a working distance of 90–97 mm. The camera was mounted on a 5 mm trapezoidal spindle with a 1 mm pitch, driven by a NEMA 17 stepper motor (200 steps per revolution), enabling precise focal control along the Z-axis and yielding a spatial resolution of approximately 1.0
m/pixel (992 pixels per millimeter).Petri dishes were placed on a display used to control illumination, allowing both the intensity and color of the light to be regulated. This was achieved through a closed-loop control system between the macro camera and the display, ensuring that all pixels reached the same reference level28. This setup also standardized illumination for accurate worm detection.
Macro image processing and software
The macro-imaging system was implemented in Python 3.11 to detect and track the centroid of each worm on the plate at every frame. Worm detection in macroscopic images was performed using a YOLO v8 Detection neural network, trained on 4,028 manually annotated images acquired with the Multiview system. In addition, 1,200 synthetic images generated with a simulator, in which synthetic worms were overlaid on the plate background, were also included in the training dataset. Synthetic worms were included to increase the diversity of poses, sizes and plate locations seen during training, improving generalisation to rare configurations (e.g., near the boundary, low contrast, partial occlusions) while reducing the amount of manual annotation required. This simulator was developed following the methodology described in22,29. Input images were resized to 1408 pixels for faster inference. The network was trained for 200 epochs with a batch size of 8, with almost no data augmentation except for minimal scaling (scale=0.02).
This macro-level tracking process is necessary to maintain, for each C. elegans, a unique identity and its position on the plate at every time point. Every worm must be correctly localised in the macroscopic view so that the microscopic camera can subsequently acquire high-resolution recordings of each individual. The macro pipeline therefore provides, for each frame, the (x, y) coordinates and identifier of every worm, which are shared with the other Multiview processes to decide which individual should be imaged next and how to move the XY stepper motors to centre that worm in the microscopic field of view.
An auxiliary segmentation pipeline, based on adaptive thresholding, morphological operations, and area filtering (OpenCV), was integrated to resolve tracking ambiguities. Starting from the original macroscopic image (Fig. 1A), this pipeline generates binary masks highlighting worm silhouettes and plate boundaries (Fig. 1C). Worm identities are maintained by enclosing each individual within the minimum circular region that surrounds it (Fig. 1B); if a circle in the previous frame overlaps with one in the current frame, it is considered the same worm. When multiple overlaps occur, the auxiliary pipeline extracts worm contours from the binary mask and assigns identities based on shape similarity. This procedure allows the system to recover worms temporarily missed by YOLO, by searching in an expanded neighbourhood and matching shapes to reassign the identity of the missing worm.
Fig. 1.
Macro-imaging processing steps in the Multiview system. (A) Raw macroscopic image of a 55 mm Petri dish containing multiple C. elegans, acquired with the top camera. A 2 mm scale bar is shown for reference. (B) Output of the YOLOv8 detector, where each worm is enclosed within a circular region and assigned a unique identifier. (C) Binary segmentation mask generated by the auxiliary pipeline.
Because the detection system assigns a unique identifier to each worm to enable simultaneous multi-individual tracking, it is critical to prevent identity switching, particularly when worms aggregate or cross paths. To address this challenge, the tracking strategy was inspired by the methodology proposed by Layana et al.17, which focuses on posture tracking and aggregation resolution in low-resolution C. elegans images. In this approach, worm skeletonization is used to improve identity preservation when individuals are in close contact or overlapping. Building on this, a UNet neural network was employed to resolve cases of worm collisions, while skeletons were extracted using the scikit-image library, ensuring robust tracking and accurate assignment of identities even in aggregations or noisy environments, following the methodology described in this paper29.
Figure 2 illustrates an example of this process during a worm aggregation. For each individual, the UNet-based module predicts a skeleton-likelihood map from the current cropped image and the previous skeleton. From these inputs, a set of plausible skeleton hypotheses is generated by propagating the previous posture. Each candidate skeleton is scored against the UNet prediction (for example, based on the overlap between the candidate centreline and high-probability pixels), and the hypothesis with the highest agreement is selected as the current-frame skeleton for that worm. In this way, collisions are resolved by combining temporal continuity with the UNet segmentation output, without requiring full multi-instance segmentation in a single pass.
Fig. 2.
Example of aggregation resolution in the macro-imaging pipeline. Two worms in close contact are shown in the original cropped images (left column), together with their corresponding binary masks (middle column) and skeletons predicted by the UNet-based module (right column, skeleton of the first C. elegans is above, and the skeleton of the other C. elegans is shown below).
This process is repeated iteratively until worms separate, ensuring that their identities are never lost at any point in time. Supplementary Fig. S1 provides a schematic overview of the macro-imaging pipeline, including the YOLO-based detection, auxiliary segmentation, tracking, and the parallel UNet-based process for resolving worm aggregations.
It is important to emphasise that this pipeline not only provides the online positional information required to coordinate the Multiview system, but also generates the macro-camera dataset used for subsequent offline analyses. For each frame, the macro images and the associated worm identities and positions are stored and later used to compute the behavioural descriptors described below (displacements, trajectory statistics, silhouette curves, etc.) and to construct the macro-based image-sequence dataset used to train and validate the CNN–Transformer model for distinguishing between N2 and vltIs66. These analyses are described in detail in the following sections.
Micro image processing and software
The micro-imaging subsystem operates downstream of the macro pipeline and uses the information provided by the macro cameras to acquire high-resolution recordings of individual worms. The macro tracking runs continuously, detecting all C. elegans on each plate and sharing their identities and plate-level (x, y) coordinates with the rest of the Multiview ROS2 nodes. A scheduler process selects, at each step, one worm that has not yet been recorded with the micro camera and designates it as the next target for high-resolution imaging.
Once a target worm has been selected, the XY motorised stage is commanded to move the corresponding region of the Petri dish under the micro camera so that the predicted position of the worm falls within the microscopic field of view. At this point, a dedicated micro-imaging pipeline takes over. Each incoming micro frame is processed by two neural modules that operate on the same image stream. First, another YOLO v8 Detection (different to the one used in the Macro image processing pipeline), trained on manually annotated micro images, attempts to localise the worm within the frame and provides its bounding box. If no worm is detected, the control logic initiates a circular search pattern: the XY stage is moved along a predefined trajectory around the current position until the worm is found or the search path is exhausted. When the detector successfully identifies the worm, a ROS2 control node uses the bounding-box coordinates to compute the offset between the worm and the image centre and sends StepsMsg commands to the XY motors so that the worm remains centred as it moves, effectively following its trajectory under the microscope.
In parallel, a convolutional neural network estimates the distance to the optimal focal plane from each micro frame. Its output is converted into Z-axis corrections that drive the focus stepper motor, ensuring stable sharpness throughout the recording. The YOLO detector and the focus CNN do not depend on each other directly: both process the same micro-camera images, and their outputs are combined by the control logic that updates XY and Z positions in closed loop.
For each target worm, this micro pipeline runs for a fixed duration of 60 s, during which the centred and focused micro frames are stored to disk at the acquisition frame rate. These 60 s image sequences constitute the high-resolution dataset later used for offline analysis, including the computation of traditional descriptors and the training of the CNN–Transformer classifier. Once the acquisition window has elapsed, the XY stage returns to its home position and the scheduler selects the next worm that has not yet been recorded. Throughout this process, the macro tracking continues to run in parallel, updating the identities and positions of all worms on the plate and maintaining a record of which individuals have already been imaged with the micro camera so that no worm is selected twice.
All components of this micro subsystem (image acquisition, YOLO detection, focus estimation, XY/Z motor control and scheduling) are implemented as ROS2 nodes that communicate through standard message topics. As summarised in Fig. 3, the macro tracking runs continuously and provides the list of worm identities and positions, while the micro pipeline sequentially selects individual worms, recentres them under the microscope, and records 60 s high-resolution sequences for offline analysis.
Fig. 3.
Micro pipeline: Chosen of the correct C. elegans and micro recording.
Traditional image processing metrics
All macro- and micro-camera recordings were exported and processed offline using custom Python scripts. For each worm and imaging modality, the corresponding 60 s sequence, together with its tracking information, was used to derive a set of traditional locomotion and shape descriptors. These analyses are decoupled from the online tracking pipeline: the macro and micro subsystems are responsible for acquiring and storing high-quality image sequences, and the offline Python code then computes the behavioural metrics described below and assembles the feature vectors used in the statistical and classification analyses.
From each sequence we extracted three main families of descriptors:
Locomotion descriptors derived from centroid trajectories, such as total distance travelled, linear and angular speed, and path tortuosity.
Global shape descriptors based on segmented binary masks, including major and minor axis lengths, head–tail distance, and width profiles along the centreline (from which head–tail width difference and width range are computed).
Posture-dynamics descriptors derived from skeletons and curvature, such as the number and amplitude of curvature maxima along the body, frame-to-frame changes in skeleton shape, and eigenworm coefficients capturing characteristic bending patterns.
A complete list of all implemented descriptors, together with their definitions and units, is provided in Supplementary Table S2. Figure 7 illustrates how these metrics are obteined from a single micro-camera frame: starting from the binary mask, a skeleton is computed and used as a reference centreline from which length, width and curvature-related measures are derived, as well as sine and Bézier curve fits that quantify global bending patterns.
Fig. 7.
Example of traditional descriptors computed from a single micro-camera frame of one worm. (A) Binary mask obtained after segmentation. (B) Skeleton obtained from segmentation. (C) Bézier curve fit to the mask. (D) Head–tail distance as a global length descriptor. (E) Sine fit in PCA space capturing global bending aligned with the skeleton. (F) Major axis and minor axis of the best-fitting ellipse. (G) Curvature points and lengths along the centreline. (H) Mask widths along the centreline. (I) Head and tail widths of the analyzed nematode.
For each Caenorhabditis elegans and each descriptor, we reduced the 60 s time series to a single scalar using a predefined aggregation rule. We distinguish between (i) quasi-static descriptors, whose frame-to-frame variability is mainly driven by occasional segmentation/skeleton artefacts (e.g., size and global-shape measures), and (ii) dynamic descriptors, whose variability reflects genuine temporal behaviour. For quasi-static descriptors we report the median across frames to obtain a robust central tendency. For dynamic descriptors, we use a low-complexity summary of temporal activity: when a descriptor is defined per-frame (e.g., eigenworm coefficients, curvature range), we compute the mean absolute frame-to-frame change
; when a descriptor is already defined as a frame-to-frame difference (e.g., displacement per step, skeleton or mask differences), we report its mean magnitude over time. The complete mapping descriptor
temporal aggregation
rationale is provided in Supplementary Table S3.
Additionally, we did not include dispersion statistics (e.g., variance or interquartile range) as separate features in the baseline, because for several descriptors these measures are strongly affected by occasional segmentation/skeleton failures and would disproportionately reflect pipeline noise rather than phenotype. For dynamic descriptors, temporal variability is already captured by the mean absolute frame-to-frame change (or, for descriptors that are themselves defined as frame-to-frame differences, by their mean magnitude over time). Exploring richer sets of aggregation statistics is an interesting direction, but it falls outside the goal of defining a conservative, low-complexity traditional baseline.
Thus, each individual was represented by a feature vector aggregating all traditional descriptors, and the same temporal window (60 frames at 1 fps) was used for both macro- and micro-camera recordings.
For consistency across modalities, all sequences were represented by
frames uniformly sampled over 60 s (1 fps effective rate) before computing traditional descriptors.
traditional-descriptor baselines in this work are intentionally conservative. Our goal is not to design an optimised feature-engineering pipeline, but to provide an interpretable and transparent reference that quantifies how much residual discriminative information remains after summarising standard locomotion and shape descriptors over time. This baseline therefore serves as a low-complexity point of comparison against the image-sequence CNN–Transformer, helping contextualise whether performance gains stem mainly from increased spatial detail, richer representations learned from pixels, or both.
In addition, to provide a multivariate baseline against the CNN–Transformer, we trained a Gaussian Naive Bayes (GNB) classifier on the aggregated traditional feature vectors to predict strain identity. Although several descriptors show non-Gaussian marginal distributions (hence our use of non-parametric tests in the univariate analysis), GNB is used here as a deliberately simple, low-capacity probabilistic baseline with minimal hyperparameter tuning and stable behaviour under limited data. In this context, the Gaussian assumption is an approximation rather than a claim about the true generative process, and the baseline is evaluated purely by cross-validated predictive performance after feature standardisation. More flexible non-parametric density estimators or higher-capacity classifiers could better match the feature distributions, but are outside the scope of establishing a conservative and interpretable reference for comparing macro vs micro descriptors and for contextualising the CNN–Transformer results.
CNN–transformer architecture and training protocol
The traditional descriptors described above provide an interpretable, feature-based representation of worm locomotion, but their limited discriminative power suggests that important information may be lost in the hand-engineering process. To complement this feature-based branch, we also evaluated a sequence-based deep learning approach that operates directly on raw image sequences. Within the overall analysis pipeline, the CNN–Transformer model sits at the end of the image-sequence branch: it takes as input the same 60 s macro- or micro-camera recordings that are used to compute the traditional descriptors, but bypasses the explicit feature extraction step and learns task-specific representations directly from the images. This design helps contextualise the relative impacts of the effects of spatial resolution (macro versus micro) from those of model capacity (traditional morphometric and kinematic descriptors plus a simple classifier versus a deep sequence model).
Each image in a sequence is first processed by a convolutional backbone (ResNet-18), which converts it into a low-dimensional feature vector that summarises the worm’s appearance in that frame. In practical terms, this step replaces the traditional descriptors computed frame by frame: instead of explicitly defining curvature points or width profiles, the CNN learns such visual features automatically from the data.
The resulting feature vectors are then fed into a Transformer encoder that models how posture evolves over time. To preserve temporal order, we add a positional embedding to each feature vector that tells the model whether a given feature vector comes from the beginning, middle or end of the 60 s sequence.
The same CNN–Transformer architecture and training protocol were applied independently to both the micro-camera and macro-camera datasets (we also used 110 one-minute sequences per class for both macro- and micro-camera training), enabling a direct comparison of the effect of image resolution on classification performance. As detailed in the Results section, the classifier trained on macro images failed to discriminate between N2 and vltIs66, whereas training on micro-camera sequences enabled robust classification. Together with the Gaussian Naive Bayes baseline trained on traditional descriptors, this sequence-based model allows us to separate the impact of spatial resolution (macro versus micro) from the effects of model capacity and feature engineering. Full CNN–Transformer training details (optimizer hyperparameters, learning rate schedule, number of epochs and hardware configuration) are provided in Supplementary Methods.
A schematic overview of the proposed CNN–Transformer model is presented in Fig. 4. The diagram illustrates the feature extraction stage based on the ResNet-18 backbone, the subsequent temporal encoding using Transformer layers, and the final classification head. This representation summarizes the main processing flow applied to image sequences for discriminating between N2 and vltIs66 strains.
Fig. 4.
Schematic representation of the CNN–Transformer architecture adapted to classify image sequences of C. elegans into N2 or vltIs66 strains.
A total of 110 one-minute sequences per class (N2 or vltIs66) were used for training and evaluation, each consisting of 60 frames captured at 1 frame per second. The macro-camera images correspond to full Petri dish recordings with a native resolution of 1944
1944 pixels, ensuring that all worms remained fully visible within the field of view throughout each sequence.
To explicitly assess how spatial resolution affects sequence-based classification, we designed a resolution sweep on the micro-camera dataset. Starting from the native micro images (approximately
), we generated four additional versions of the dataset by downscaling each frame with factors
using bilinear interpolation. For a given factor s, each image
was resized to (H/s, W/s) pixels, preserving the full field of view and the temporal sampling (60 frames at 1 fps per sequence). The same CNN–Transformer architecture, optimiser and cross-day cross-validation protocol were then applied independently to the original and to each downscaled dataset, so that changes in performance could be attributed solely to the loss of spatial detail rather than to differences in model capacity or training procedure.
An additional limitation is that the micro-camera tracking does not succeed for all individuals: only about 70–80% of attempted recordings yield a continuous 60 s sequence suitable for analysis. In this study, we mitigated this by recording more worms than strictly needed and by retaining only high-quality sequences for training and evaluation, so that tracking failures affect throughput rather than the reliability of strain labels. Nonetheless, improving online tracking robustness will be essential for future large-scale screening applications.
Figure 5 shows the difference between the macro and micro images that was used to train both CNN–Transformer models.
Fig. 5.
Comparison of C. elegans images acquired with the macro camera (left) and the micro camera (right).
Results
Time series of locomotion images from three different Caenorhabditis elegans strains were obteined using both the macro and micro cameras of the Multiview system. The data were analyzed to assess which of the two imaging approaches provides clearer detection of significant differences in locomotor activity among strains, based on a variety of statistical analyses.
For clarity, we use the following terminology throughout the Results: (i) macro-CNN–Transformer and micro-CNN–Transformer denote the same architecture trained on macro- and micro-camera sequences, respectively; and (ii) traditional-descriptor baseline denotes the multivariate classifier trained on aggregated traditional morphometric and kinematic descriptors.
Global comparison between capture methods
Qualitatively, N2 and vltIs66 worms display very similar exploratory crawling on NGM plates in both macro- and micro-camera recordings. In the macroscopic view, their trajectories and overall activity are essentially indistinguishable by eye, and no obvious differences in path shape or plate coverage can be reliably detected. In the high-resolution micro-camera sequences, some vltIs66 individuals exhibit slightly shorter excursions or some reduced bending amplitude (not always), but these patterns are subtle and not consistently strong enough to support manual scoring or simple thresholding of single descriptors. This qualitative similarity underscores the difficulty of the N2 versus vltIs66 discrimination task and motivates the use of sequence-based deep learning models to extract weak, distributed phenotypic signatures that are not apparent from visual inspection alone.
Sequences acquired with the macro camera provided full-plate images, which were used to compute displacement-related statistics such as the path length of each C. elegans. Due to the lower resolution per individual, the resulting measures tended to show more similar locomotor behaviors across strains.
In contrast, the image sequences obteined with the micro camera, which focused on a single worm at a time, offered substantially higher resolution (Fig. 5). Moreover, as the Multiview system employs motorized stages to dynamically center the worm under the micro camera, the precise displacement of each individual could also be tracked at every time point.
To provide a clearer comparison of the differences between capture methods, Figure 6 shows box-and-whisker plots of the total distance travelled by each strain, measured with both the macro and micro cameras. Already in macro-camera recordings, unc-1(vlt10) trajectories appear markedly shorter and less exploratory than those of N2 or vltIs66, consistent with its strongly uncoordinated phenotype.
Fig. 6.
Total distance travelled by each strain (unc-1(vlt10), vltIs66 and N2) measured with the macro- and micro-camera. For each imaging method, boxplots sharing the same letter are not significantly different (
; Mann–Whitney U test with Bonferroni for multiple comparisons), whereas boxes with different letters differ significantly (
).
For each imaging modality, pairwise comparisons between strains were performed using the Mann–Whitney U test with Bonferroni correction for multiple comparisons. Groups that do not bwlong to the same cluster are significantly different (
), whereas strains in the same cluster are not. In both imaging conditions, unc-1(vlt10) travelled significantly shorter distances than N2 and vltIs66, while no significant differences were detected between N2 and vltIs66.
Analysis using traditional image processing and centroids
Analysis of the descriptors indicated that mean displacement already revealed significant differences between unc-1(vlt10) and other strains. Since displacement data did not follow a normal distribution, non-parametric tests were used. A global Kruskal–Wallis test assessed whether significant differences existed across strains. When significant, pairwise comparisons were performed using the Mann–Whitney U test. To account for multiple testing, Bonferroni correction was applied, and only adjusted p-values were considered for significance. This information is displayed in Table 1.
Table 1.
Pairwise comparisons using the mean displacement per C. elegans, with the Mann-Whitney U test and Bonferroni correction. The global p-value from the Kruskal-Wallis test is also included for each method.
| Method | p K-Wallis | Comparison | p unadjusted | p Bonferroni |
|---|---|---|---|---|
| Macro | ![]() |
N2 vs. vltIs66 | 0.1559 | 0.4679 |
| N2 vs. unc-1(vlt10) | ![]() |
![]() |
||
| vltIs66 vs. unc-1(vlt10) | ![]() |
![]() |
||
| Micro | ![]() |
N2 vs. vltIs66 | 0.0785 | 0.2356 |
| N2 vs. unc-1(vlt10) | ![]() |
![]() |
||
| vltIs66 vs. unc-1(vlt10) | ![]() |
![]() |
However, for the highly similar N2 and vltIs66 strains, none of the metrics produced statistically significant differences (
). Importantly, this conclusion is not based solely on total distance travelled: multiple locomotion, shape, and posture-related descriptors were tested (Supplementary Tables S4–S5), and none yielded a significant separation. This suggests that centroid-based and conventional morphometric descriptors alone are insufficient to discriminate subtle phenotypic differences. Full statistical results are reported in Supplementary Table S4 (micro-camera dataset) and y Table S5 (macro-camera dataset).
Figure 7 illustrates how these traditional descriptors are extracted from a single micro-camera frame of one worm. Starting from the binary mask, a skeleton is computed and used as a reference centreline from which length, width and curvature-related measures are derived, as well as sine and Bézier curve fits that quantify global bending patterns.
These results motivated us to first evaluate their joint discriminative power using a simple multivariate classifier, and then to investigate a deep learning–based approach operating directly on image sequences. The same CNN–Transformer architecture was first trained using macro-camera image sequences. However, cross-validation revealed that the classifier failed to reliably separate N2 from vltIs66, with confusion matrices showing substantial misclassification across folds and accuracies approaching chance level. This result indicates that macro-resolution images do not provide sufficient information for deep learning models to capture the subtle phenotypic differences between the two strains.
Multivariate baseline using traditional morphometric and kinematic descriptors
To complement the univariate analysis of individual descriptors, we evaluated a simple multivariate classifier to quantify how much discriminative information is captured collectively by the traditional metrics extracted from macro- and micro-camera recordings. For this purpose, we trained a Gaussian Naive Bayes model on the aggregated feature vectors corresponding to each one-minute sequence of a single worm.
When trained on macro-camera descriptors, the classifier achieved only modest accuracy (mean
across cross-validation folds), confirming that the traditional metrics extracted at macro resolution are insufficient for reliable discrimination between N2 and vltIs66. When trained on micro-camera descriptors, the same classifier reached only slightly higher accuracy (mean
), remaining far from a robust separation of the two strains. Together with the univariate analyses, these results indicate that, even at high spatial resolution, the chosen traditional descriptors capture only limited discriminative information, and that the main gains in performance arise when rich features are learned directly from image sequences by the CNN–Transformer model.
Table 2 summarises the cross-validation performance of the Gaussian Naive Bayes classifier for both imaging modalities.
Table 2.
Cross-validation performance of the Gaussian Naive Bayes classifier trained on traditional descriptors extracted from macro- and micro-camera recordings.
| Imaging modality | Accuracy (mean) | Accuracy (std) |
|---|---|---|
| Macro-camera descriptors | 0.58 | 0.04 |
| Micro-camera descriptors | 0.61 | 0.02 |
These findings establish a quantitative baseline against which the CNN–Transformer can be compared, and highlight that, although micro imaging offers a slight improvement over macro descriptors, increased spatial resolution alone does not suffice to achieve robust discrimination in tasks involving subtle phenotypic differences.
Discrimination using convolutional neural networks and Transformers
Since traditional morphometric and kinematic analyses (e.g., spline and Bézier curves, sinusoidal amplitude, skeleton or mask differences) did not yield statistically significant differences betweenN2 and vltIs66, we implemented a deep learning approach. A hybrid CNN–Transformer architecture was designed to classify image sequences of C. elegans, it was trained on both macro- and micro-camera sequences using the same architecture and validation protocol, so that observed performance differences can be interpreted primarily in terms of the information content available at each imaging scale, while acknowledging that this is not a formal ablation of spatial vs temporal modelling components.
We first evaluated the macro-CNN–Transformer variant, where the model is trained on full-frame macro-camera sequences, and then the micro-CNN–Transformer trained on high-resolution micro-camera sequences. Finally, to characterise how spatial resolution affects performance, we systematically downscaled the micro-camera images to different effective pixel sizes and retrained the same architecture on each downsampled dataset. Both CNN architectures were trained with cross-day validation: in each fold, all recordings from one experimental day were used as the validation set, while the remaining days served as the training set.
The first CNN–Transformer architecture was trained using a dataset of 110 macro-camera sequences per class (N2 and vltIs66). However, as shown in Table 3, the classifier failed to reliably discriminate between those 2 strains, with performance close to random guessing across all folds. This indicates that macro-resolution images do not provide sufficient information for deep learning models to capture phenotypic differences between the two strains with simmilar locomotion and behaviour.
Table 3.
Cross-validation performance of the CNN–Transformer model trained with macro-camera sequences.
| Fold | Accuracy | Precision | Recall | F1-score |
|---|---|---|---|---|
| 1 | 0.5938 | 0.5941 | 0.5938 | 0.5934 |
| 2 | 0.5938 | 0.6159 | 0.5938 | 0.5733 |
| 3 | 0.4062 | 0.4167 | 0.4375 | 0.4000 |
| 4 | 0.3438 | 0.3431 | 0.3438 | 0.3431 |
| Mean | 0.4844 | 0.4925 | 0.4922 | 0.4775 |
| Std | 0.1289 | 0.1337 | 0.1234 | 0.1247 |
Unlike the macro-based model, which performed at chance level, the micro-based CNN–Transformer achieved robust discrimination. The micro-based classifier significantly discriminated between N2 and vltIs66, with accuracies ranging from 0.70 to 0.80 and an average close to 0.76. Precision and recall metrics remained balanced across classes, although some folds exhibited substantial confusion between N2 and vltIs66. Overall, the micro-based CNN was able to find subtle phenotypic differences undetected by traditional descriptors. These findings indicate that CNN–Transformer architectures can detect subtle phenotypic patterns not captured by traditional image descriptors. To further quantify variability across folds, we computed the standard deviation of each metric: accuracy
, precision
, recall
, and F1-score
. These values indicate that the CNN–Transformer classifier performed consistently across folds, with only minor fluctuations in performance. During training, the learning rate was adjusted automatically using the previously mentioned ReduceLROnPlateau scheduler.
Table 4 summarizes the performance of the CNN–Transformer model across the five validation folds. Accuracy, precision, recall, and F1-score are reported for each fold as well as the average across folds, including mean and standard deviation for each metric.
Table 4.
Cross-validation performance of the CNN–Transformer model for distinguishing between N2 and vltIs66, including mean and standard deviation across folds.
| Fold | Accuracy | Precision | Recall | F1-score |
|---|---|---|---|---|
| 1 | 0.80 | 0.79 | 0.76 | 0.78 |
| 2 | 0.71 | 0.71 | 0.70 | 0.71 |
| 3 | 0.78 | 0.78 | 0.79 | 0.79 |
| 4 | 0.80 | 0.79 | 0.80 | 0.79 |
| 5 | 0.73 | 0.72 | 0.71 | 0.71 |
| Mean | 0.76 | 0.76 | 0.75 | 0.76 |
| Std | 0.037 | 0.036 | 0.041 | 0.038 |
Effect of progressive downsampling on CNN–transformer performance
To move beyond a binary comparison between macro- and micro-camera recordings and to quantify more precisely how spatial resolution constrains sequence-based phenotypic discrimination, we performed a systematic resolution sweep on the micro-camera dataset. Starting from the native micro images (effective resolution
), we generated four additional versions of the dataset by downscaling each frame with factors
using bilinear interpolation. For a given factor s, each image was resized to (H/s, W/s) pixels while preserving the full field of view and the temporal sampling (60 frames at 1 fps per sequence). The same CNN–Transformer architecture, optimisation scheme and cross-day cross-validation protocol described above were then applied independently to the original and to each downscaled dataset, so that any changes in performance could be attributed solely to the loss of spatial detail rather than to differences in model capacity or training procedure.
At native micro resolution, the body of a young adult C. elegans typically spans on the order of 70-65 pixels in width, providing sufficient detail to resolve local curvature, head–tail asymmetries and width profiles along the centreline (while at macro resolution, a C. elegans widht is approximately 3 pixels). After downsampling by a factor s, this apparent width is reduced approximately by the same factor, so that for
and
the worm still occupies a clearly structured cross-section (approximately 35 and almost 20 pixels respectively), whereas for
and especially
the body is represented by only a handful of pixels in width (approximately 10 and 5 pixels, respectively) and fine postural features become heavily blurred. The described downscaling factors
, corresponding to effective resolutions of approximately
m/pixel (from a native
m/pixel). Example patches from the same individual at different downsampling factors are shown in Fig. 8, illustrating how the available morphological detail degrades as effective pixel size increases.
Fig. 8.
Example of the same C. elegans individual at different downsampling factors applied to the micro-camera images. As the downsampling factor s increases, the worm spans fewer pixels in width and fine postural details become progressively blurred. The change is most noticeable to the eye with
and
.
Figure 9 summarises the mean cross-day accuracy of the CNN–Transformer as a function of effective pixel size. The leftmost point corresponds to the native micro resolution, followed by the downsampled micro datasets for
, and finally the macro-camera result at
is shown for reference. Error bars indicate the standard deviation across validation folds.
Fig. 9.
Classification accuracy of the CNN–Transformer as a function of effective spatial resolution. The native micro-camera images (leftmost point) were progressively downscaled by factors
before training. The macro-camera result is shown for reference. Points indicate mean accuracy under the cross-day validation protocol; error bars denote the standard deviation across folds.
At native micro resolution, the CNN–Transformer achieved a mean accuracy of approximately 76% (cf. Table 4), consistent with the robust discrimination between N2 and vltIs66 reported above. For moderate downsampling (
and
), classification performance remained relatively high, with accuracies of 71.2% and 72.2%, respectively. Notably, the slightly higher accuracy observed at
compared with
is within the variability across folds and indicates that, within this range, the model is not yet limited by spatial resolution. This suggests that the CNN–Transformer can tolerate a substantial reduction in spatial detail as long as the worm still occupies a sufficient number of pixels and its posture dynamics remain well resolved.
These mean values should, however, be interpreted together with the variability across cross-validation folds. At native micro resolution, performance was not only higher but also more stable (standard deviation
), whereas the standard deviation increased to
for
, to
for
and
, and reached
for
. This progressive increase in variability indicates that, as spatial resolution decreases, the model becomes more sensitive to the specific train/validation split and optimisation conditions, reflecting a weaker and less reliable phenotypic signal in the downsampled images. Consequently, even when a coarser resolution yields a mean accuracy comparable to, or slightly higher than, that of a finer resolution, the larger variance suggests that the network is learning less robust decision boundaries based on more fragile visual cues.
In contrast, for stronger downsampling (
and especially
), accuracy dropped more markedly (to 62.5% and 62.0%, respectively) and approached chance level for the lowest effective resolutions, revealing that beyond a critical pixel size the subtle phenotypic signatures that separate these strains are no longer reliably encoded in the images.
This behaviour bridges the gap between the micro and macro regimes and shows that the gain provided by high-resolution imaging is not an all-or-none effect. As the effective pixel size increases, discriminative information degrades gradually rather than abruptly, with a relatively broad range of resolutions over which the CNN–Transformer still outperforms both the macro-based model and the Gaussian Naive Bayes baseline trained on traditional descriptors. Only when the downsampled micro images approach the worm size and contrast available in macro-camera recordings does performance collapse towards the macro-CNN and Naive Bayes accuracies (cf. Tables 3 and 2), which remain close to chance.
In practical terms, this resolution sweep provides a quantitative estimate of the range of spatial resolutions over which subtle phenotypic differences between N2 and vltIs66 remain detectable by a sequence-based deep learning model. It also helps delineate a regime of diminishing returns: below a certain pixel size, further increasing resolution primarily inflates data volume and acquisition complexity, whereas above a critical pixel size, reducing resolution severely compromises phenotyping sensitivity. These findings can thus inform the design of future automated platforms targeting similarly subtle locomotion phenotypes, by guiding the choice of imaging hardware and magnification in terms of both discriminative power and practical constraints.
Beyond the mean accuracy values, a clear transition is observed once downsampling reaches
. At this point, the CNN–Transformer not only performs substantially worse than at native or moderately downsampled resolutions, but also exhibits a marked increase in variability across folds, indicating reduced training stability. This combination of lower accuracy and higher dispersion suggests that the model is no longer able to extract reliable posture-level information when the worm occupies only a small number of pixels. In practical terms,
thus appears as a threshold beyond which the effective spatial resolution becomes insufficient for robust discrimination of subtle phenotypic differences between N2 and vltIs66.
Error analysis and performance
The performance of the Multiview system was analyzed in terms of its ability to consistently detect and track C. elegans across both macro- and micro-camera recordings. In addition to quantitative results, particular attention was given to error cases, processing times, and accuracy rates, as well as the identification of the main limitations and potential improvements.
Figure 10 further illustrates the difference in training dynamics between macro- and micro-based models. While the macro-based models exhibited unstable validation loss and failed to converge, the micro-based models showed consistent decreases in validation loss across folds, confirming that only high-resolution input provides the discriminative information required for successful training.
Fig. 10.

Training and validation loss curves across epochs for the CNN–Transformer model under cross-validation.
The current tracking pipeline occasionally fails when worms approach plate boundaries, move very rapidly, or form dense aggregations, which can lead to identity losses or shortened trajectories. For both macro- and micro-camera recordings, only sequences that met strict tracking-quality criteria (continuous centring and successful detection over the full 60 s window) were retained for computing descriptors and for training the CNN–Transformer. In practice, this was compensated by recording more worms than strictly needed, so that the final dataset size remained sufficient for all analyses. Tracking errors therefore mainly increase the acquisition effort and reduce the efficiency of the Multiview system, but do not introduce label noise or systematic bias in the phenotypic classification or in the comparison between imaging resolutions.
Discussion and conclusions
The ability to discriminate subtle phenotypic differences between Caenorhabditis elegans strains was assessed, in this benchmark, using image sequences acquired with a multi-view system combining macro and high-resolution micro cameras. Traditional morphometric and kinematic descriptors–including spline and Bézier curves of body shape, skeleton and binary mask differences, displacement metrics, and anatomical distances–did not reveal statistically significant differences between N2 and vltIs66 in the analyzed plates, although some consistent trends were observed.
An important observation from our multivariate baseline analysis is that, under both macro and micro imaging, a simple Gaussian Naive Bayes classifier trained on traditional descriptors achieves only modest accuracies (around 0.58 for macro and 0.61 for micro). This confirms that, although micro imaging slightly improves the quality of the descriptors, the chosen feature set and a simple probabilistic model are not sufficient to robustly separate N2 from vltIs66. In other words, the difficulty of the task is not only due to low image resolution, but also to the limited expressiveness of traditional traditional metrics. The CNN–Transformer therefore serves a complementary role: it provides a fully automated, descriptor-free alternative that operates directly on raw image sequences and is able to learn richer phenotypic representations than those captured by the engineered features. Crucially, the same model architecture allows us to quantify how discrimination performance degrades when spatial resolution is progressively reduced, thereby establishing practical resolution requirements for subtle phenotype classification that could not be inferred from traditional descriptors alone. Consistent with this view, the Naive Bayes baseline remains well below the CNN–Transformer trained on micro images, indicating that the deep model exploits visual cues that are either only partially represented or completely missed by the traditional feature set.
To overcome these limitations, we developed a deep learning model integrating a convolutional backbone (ResNet-18) with a Transformer encoder, designed to process image sequences and capture both complex phenotypic features and temporal dynamics. When trained with macro-camera sequences, the model did not reliably discriminate between N2 and vltIs66, suggesting that the visual information available at this resolution may be insufficient for capturing subtle phenotypic variations. In contrast, using the same cross-day cross-validation protocol, the micro-CNN–Transformer achieved significantly higher discrimination performance, indicating that finer image detail is essential for detecting these subtle motor differences.
Beyond this binary macro-versus-micro comparison, the resolution sweep experiment further clarifies how much spatial resolution is actually required to detect such subtle phenotypes. By progressively downsampling the micro-camera images and retraining the same CNN–Transformer, we observed that performance remained relatively stable for moderate reductions in resolution (downscaling factors
and
), and only degraded substantially for stronger downsampling (
and
). This pattern indicates that there exists a relatively broad regime in which the model is not yet resolution-limited and can still exploit posture dynamics and body shape information, followed by a regime in which discriminative cues are progressively lost and accuracy converges towards the performance of the traditional-descriptor baseline and the macro-based CNN. In this way, the resolution sweep bridges the gap between macro and micro imaging and provides a quantitative estimate of both the minimum effective resolution needed for subtle phenotype discrimination and the point at which further increases in resolution offer diminishing returns.
Consistent with this view, the resolution sweep indicates a broad regime in which performance remains stable up to moderate downsampling, and a clear degradation beyond strong downsampling. In particular, once the images are downscaled by a factor of
(C. elegans widht of approximately 10 pixels), both accuracy and stability across folds deteriorate noticeably, suggesting that this level of spatial detail is close to the practical lower bound for reliable discrimination of the subtle N2 versus vltIs66 phenotype.
Finally, we note that our experiments are not a formal ablation separating the role of temporal modelling (Transformer) from spatial resolution. However, keeping the CNN–Transformer architecture fixed while progressively degrading micro-camera spatial detail provides an informative proxy: the temporal model only becomes useful when the input frames retain sufficient morphological information to encode posture dynamics. As resolution decreases (especially beyond
), the available phenotype in the image sequence weakens, and performance collapses towards chance even though the temporal modelling capacity remains unchanged. This supports the interpretation that adequate spatial resolution is a necessary condition for sequence-based models to exploit temporal patterns in this subtle discrimination task.
A limitation of this study is that we evaluate resolution sensitivity using a conservative set of traditional descriptors and a single sequence model family (CNN–Transformer). Other pipelines (e.g., alternative posture embeddings, optical-flow-based descriptors, or different video architectures) may exhibit different resolution–performance curves on the same data. Nevertheless, the resolution-sweep protocol used here is model-agnostic: by keeping the acquisition and validation protocol fixed and degrading spatial detail in controlled steps, it provides a practical way to quantify when resolution becomes limiting for any chosen analysis method. Applying the same sweep to additional descriptor sets and modern video models is a direct next step to further generalise these conclusions.
Overall, our results show that, for the specific subtle discrimination task studied here (N2 vs. vltIs66) and under the Multiview acquisition protocol, high-resolution micro sequences provide the spatial detail required for sequence-based models to achieve robust separation. While this does not establish universal resolution thresholds across assays or strains, the proposed resolution sweep offers a practical way to quantify resolution sensitivity in similar settings.
Our multivariate baseline further confirms that, even when high-resolution micro images are available, the discriminative information captured by relatively simple classifiers trained on traditional descriptors is limited. Thus, both spatial resolution and model capacity play a critical role: high-resolution imaging is necessary but not sufficient on its own, and must be combined with sequence-based deep learning models to fully exploit the subtle phenotypic cues present in the data.
Rather than demonstrating an absolute limitation of low-resolution imaging, our findings emphasize that the choice of spatial resolution critically determines the discriminative capacity of both conventional and deep learning methods. Future work may explore whether improved preprocessing, alternative descriptors, or hybrid multimodal approaches could enhance discrimination performance even at lower resolutions.
Supplementary Information
Acknowledgements
We gratefully acknowledge the Laboratory of Molecular, Cellular and Genomic Biomedicine (Instituto de Investigación Sanitaria La Fe, Valencia) for their kind provision C. elegans used in this study.
Author contributions
J-J.P-J., S.E-B. and A-J.S-S. conceived the experiments, J-J.P-J. conducted the experiments, J-J.P-J., S.E-B., J-C.P., A.G-G and A-J.S-S. analyzed the results. All authors reviewed the manuscript.
Funding
This study was supported by Comunitat Valenciana (Spain) under grant INVEST/2023/541.
The authors thank the EU-FEDER Comunitat Valenciana 2014-2020 grant IDIFEDER/2018/025.
Data availability
The datasets and any remaining information can be obtained from the corresponding author upon reasonable request.
Declarations
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supplementary Information
The online version contains supplementary material available at 10.1038/s41598-026-40784-0.
References
- 1.Cole, R. D., Anderson, G. L. & Williams, P. L. The nematode caenorhabditis elegans as a model of organophosphate-induced mammalian neurotoxicity. Toxicology Appl. Pharmacology194, 248–256. 10.1016/j.taap.2003.09.013 (2004). [DOI] [PubMed] [Google Scholar]
- 2.Brenner, S. The genetics of caenorhabditis elegans. Genetics77, 71–94. 10.1093/genetics/77.1.71 (1974). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 3.Marck, A. et al. Age-related changes in locomotor performance reveal a similar pattern forcaenorhabditis elegans, mus domesticus, canis familiaris, equus caballus, andhomo sapiens. J. Gerontology Series A: Biol. Sci. Med. Sci. glw136, 2016, 10.1093/gerona/glw136. [DOI] [PMC free article] [PubMed]
- 4.Pincus, Z., Smith-Vikos, T. & Slack, F. J. Microrna predictors of longevity in caenorhabditis elegans. PLoS Genetics7, e1002306. 10.1371/journal.pgen.1002306 (2011). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5.Kaletta, T. & Hengartner, M. O. Finding function in novel targets: C. elegans as a model organism. Nature Reviews Drug Discovery, 5, 387–399, (2006) 10.1038/nrd2031. [DOI] [PubMed]
- 6.Banse, S. A. et al. The coupling between healthspan and lifespan in caenorhabditis depends on complex interactions between compound intervention and genetic background. Aging 10.18632/aging.205743 (2024). [DOI] [PMC free article] [PubMed]
- 7.Le, K. N. et al. An automated platform to monitor long-term behavior and healthspan in caenorhabditis elegans under precise environmental control. Communications Biology 3, (2020) 10.1038/s42003-020-1013-2. [DOI] [PMC free article] [PubMed]
- 8.Hahm, J.-H. et al. C. elegans maximum velocity correlates with healthspan and is maintained in worms with an insulin receptor mutation. Nature Communications 6, (2015) 10.1038/ncomms9919. [DOI] [PMC free article] [PubMed]
- 9.Liu, G., Dong, F., Fu, C. & Smith, Z. J. Automated morphometry toolbox for analysis of microscopic model organisms using simple bright-field imaging. Biology Open10.1242/bio.037788 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Wang, L., Kong, S., Pincus, Z. & Fowlkes, C. Celeganser: Automated analysis of nematode morphology and age, 10.48550/ARXIV.2005.04884 (2020).
- 11.Geng, W., Cosman, P., Berry, C., Feng, Z. & Schafer, W. Automatic tracking, feature extraction and classification of c elegans phenotypes. IEEE Transa. Biomed. Eng.51, 1811–1820. 10.1109/tbme.2004.831532 (2004). [DOI] [PubMed] [Google Scholar]
- 12.Zhang, H.-N., Huang, W.-M., Fu, J.-J., Xu, X.-P. & Xu, T. Application of computer vision in the automatic analysis of feeding behavior in c elegans. Acta Agronomica Sinica40, 188. 10.3724/sp.j.1206.2012.00266 (2013). [Google Scholar]
- 13.Ji, H., Chen, D. & Fang-Yen, C. Automated multimodal imaging of caenorhabditis elegans behavior in multi-well plates. GENETICS10.1093/genetics/iyae158 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Banerjee, S. C., Khan, K. A. & Sharma, R. Deep-worm-tracker: Deep learning methods for accurate detection and tracking for behavioral studies in c. elegans. Appl. Animal Behaviour Sci. 266, 106024, (2023) 10.1016/j.applanim.2023.106024.
- 15.Roussel, N., Sprenger, J., Tappan, S. J. & Glaser, J. R. Robust tracking and quantification ofc. elegansbody shape and locomotion through coiling, entanglement, and omega bends. Worm 3, e982437, (2014) 10.4161/21624054.2014.982437. [DOI] [PMC free article] [PubMed]
- 16.Sznitman, R., Gupta, M., Hager, G. D., Arratia, P. E. & Sznitman, J. Multi-environment model estimation for motility analysis of caenorhabditis elegans. PLoS ONE5, e11631. 10.1371/journal.pone.0011631 (2010). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 17.Layana Castro, P. E., Puchalt, J. C. & Sánchez-Salmerón, A.-J. Improving skeleton algorithm for helping caenorhabditis elegans trackers. Sci. Rep. 10, (2020) 10.1038/s41598-020-79430-8. [DOI] [PMC free article] [PubMed]
- 18.Layana Castro, P. E., Puchalt, J. C., García Garví, A. & Sánchez-Salmerón, A.-J. Caenorhabditis elegans multi-tracker based on a modified skeleton algorithm. Sensors 21, 5622, (2021) 10.3390/s21165622. [DOI] [PMC free article] [PubMed]
- 19.Swierczek, N. A., Giles, A. C., Rankin, C. H. & Kerr, R. A. High-throughput behavioral analysis in c. elegans. Nature Methods 8, 592–598, (2011) 10.1038/nmeth.1625. [DOI] [PMC free article] [PubMed]
- 20.Stroustrup, N. et al. The caenorhabditis elegans lifespan machine. Nature Methods10, 665–670. 10.1038/nmeth.2475 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 21.Puchalt, J. C. et al. Improving lifespan automation for caenorhabditis elegans by using image processing and a post-processing adaptive data filter. Sci. Rep. 10, (2020) 10.1038/s41598-020-65619-4. [DOI] [PMC free article] [PubMed]
- 22.García Garví, A., Puchalt, J. C., Layana Castro, P. E., Navarro Moya, F. & Sánchez-Salmerón, A.-J. Towards lifespan automation for caenorhabditis elegans based on deep learning: Analysing convolutional and recurrent neural networks for dead or live classification. Sensors 21, 4943, (2021) 10.3390/s21144943. [DOI] [PMC free article] [PubMed]
- 23.García-Garví, A., Layana-Castro, P. E., Puchalt, J. C. & Sánchez-Salmerón, A.-J. Automation of caenorhabditis elegans lifespan assay using a simplified domain synthetic image-based neural network training strategy. Comput. Struct. Biotechnol. J.21, 5049–5065. 10.1016/j.csbj.2023.10.007 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 24.Puchalt, J. C. et al. Small flexible automated system for monitoring caenorhabditis elegans lifespan based on active vision and image processing techniques. Sci. Rep. 11, (2021) 10.1038/s41598-021-91898-6. [DOI] [PMC free article] [PubMed]
- 25.Puchalt, J. C., Layana Castro, P. E. & Sánchez-Salmerón, A.-J. Reducing results variance in lifespan machines: An analysis of the influence of vibrotaxis on wild-type caenorhabditis elegans for the death criterion. Sensors 20, 5981, (2020) 10.3390/s20215981. [DOI] [PMC free article] [PubMed]
- 26.Puchalt, J. C., Gonzalez-Rojo, J. F., Gómez-Escribano, A. P., Vázquez-Manrique, R. P. & Sánchez-Salmerón, A.-J. Multiview motion tracking based on a cartesian robot to monitor caenorhabditis elegans in standard petri dishes. Sci. Rep. 12, (2022) 10.1038/s41598-022-05823-6. [DOI] [PMC free article] [PubMed]
- 27.Instituto de Investigación Sanitaria La Fe. Pliego de prescripciones técnicas: Servicio de pruebas de validación de dos aplicaciones automáticas con modelos C. elegans. Contract technical specification, Instituto de Investigación Sanitaria La Fe, Valencia, Spain (2023). Document from the Spanish public procurement platform.
- 28.Puchalt, J. C., Sánchez-Salmerón, A.-J., Martorell Guerola, P. & Genovés Martínez, S. Active backlight for automating visual monitoring: An analysis of a lighting control technique for caenorhabditis elegans cultured on standard petri plates. PloS one14, e0215548 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 29.Layana Castro, P. E., García Garví, A., Navarro Moya, F. & Sánchez-Salmerón, A.-J. Skeletonizing caenorhabditis elegans based on u-net architectures trained with a multi-worm low-resolution synthetic dataset. Int. J. Computer Vision 131, 2408–2424, (2023) 10.1007/s11263-023-01818-6.
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
The datasets and any remaining information can be obtained from the corresponding author upon reasonable request.



















