scieee AI-readable full text Open interactive document viewer

Unveiling host-seeking behaviour in entomopathogenic nematodes via lab-on-a-chip technology

Manduca, Gianluca; Zeni, Valeria; Casadei, Anita; Tarasco, Eustachio; LUCCHI, ANDREA; Benelli, Giovanni; Stefanini, Cesare; Romano, Donato

Abstract

Entomopathogenic nematodes (EPNs) can be employed as biological control agents (BCAs) for many insect pests’ sustainable management. Despite their widespread use, our understanding of EPNs biology, particularly interactions with their hosts, remains limited. Advancing knowledge of EPNs ecology and host interactions is crucial for optimising their efficacy in pest management. This study pioneers an interdisciplinary approach, at the interface of engineering and applied entomology, to investigate the behaviour of the EPN Steinernema carpocapsae. A novel method combining microfluidics, machine learning, and optical flow is presented. A lab-on-a- chip platform was designed to enable accurate investigation of EPN response to stimuli. A convolutional neural network (CNN) identified nematodes and distinguished their responses to host-derived cues achieving 0.94 accuracy and 1.00 precision in detecting stimulus presence at video-level, classifying EPN behaviour within a controlled environment that simulates host conditions. Optical flow analysis revealed differences in motor activity of EPN upon exposure to stimuli, providing new insights into their dynamic responses. Steinernema carpocapsae exhibited more intense activity in presence of host-borne cues (p = 0.0055). Support vector machine (SVM) and multilayer perceptron (MLP) classifiers distinguished stimulus contexts from optical flow features, with an area under the receiver operating characteristic (ROC) curve of 0.71. These results highlight that, although S. carpocapsae is typically considered an ambusher, it may actively engage in host-seeking behaviour, suggesting a shift in our understanding of its search strategies. This methodology significantly enhances the detection and understanding of EPN responses to cues, advancing their potential in precision biocontrol programs for sustainable pest management actions. Science4Impact statement (S4IS): This study develops a novel lab-on-a-chip platform integrating artificial intelligence (AI) for the precise investigation of host-seeking behaviours in the entomopathogenic nematode Steinernema carpocapsae, a biological control agent (BCA) with potential for sustainable pest management. By combining microfluidic design with deep learning, the platform accurately assesses nematode responses to host- derived cues, providing new insights into its foraging adaptability beyond conventional techniques. This research can help researchers and agricultural stakeholders by enhancing understanding of BCA behaviour, optimising pest control applications, and informing evidence-based decisions on sustainable crop protection. The findings also support quality assurance in biological control validation by offering a rigorous framework for evaluating nematode effectiveness under realistic conditions, promoting its broader adoption in integrated pest management strategies

Full text

Research Paper Unveiling host-seeking behaviour in entomopathogenic nematodes via lab-on-a-chip technology Gianluca Manduca a,b,* , Valeria Zeni c , Anita Casadei a,b , Eustachio Tarasco d , Andrea Lucchi c , Giovanni Benelli c , Cesare Stefanini a,b , Donato Romano a,b,** a The BioRobotics Institute, Sant’Anna School of Advanced Studies, Viale R. Piaggio 34, Pontedera, 56025, Pisa, Italy b Department of Excellence in Robotics and AI, Sant’Anna School of Advanced Studies, Piazza Martiri della Libert` a 33, 56127, Pisa, Italy c Department of Agriculture, Food and Environment, University of Pisa, Via del Borghetto 80, 856124, Pisa, Italy d Department of Soil, Plant and Food Sciences, University of Bari Aldo Moro, Via Amendola 165/A, 70126, Bari, Italy ARTICLE INFO Keywords: Biological control Deep learning European grapevine moth Integrated pest management Lab-on-a-chip Steinernema carpocapsae ABSTRACT Entomopathogenic nematodes (EPNs) can be employed as biological control agents (BCAs) for many insect pests’ sustainable management. Despite their widespread use, our understanding of EPNs biology, particularly interactions with their hosts, remains limited. Advancing knowledge of EPNs ecology and host interactions is crucial for optimising their efficacy in pest management. This study pioneers an interdisciplinary approach, at the interface of engineering and applied entomology, to investigate the behaviour of the EPN Steinernema carpocapsae. A novel method combining microfluidics, machine learning, and optical flow is presented. A lab-on-achip platform was designed to enable accurate investigation of EPN response to stimuli. A convolutional neural network (CNN) identified nematodes and distinguished their responses to host-derived cues achieving 0.94 accuracy and 1.00 precision in detecting stimulus presence at video-level, classifying EPN behaviour within a controlled environment that simulates host conditions. Optical flow analysis revealed differences in motor activity of EPN upon exposure to stimuli, providing new insights into their dynamic responses. Steinernema carpocapsae exhibited more intense activity in presence of host-borne cues (p =0.0055). Support vector machine (SVM) and multilayer perceptron (MLP) classifiers distinguished stimulus contexts from optical flow features, with an area under the receiver operating characteristic (ROC) curve of 0.71. These results highlight that, although S. carpocapsae is typically considered an ambusher, it may actively engage in host-seeking behaviour, suggesting a shift in our understanding of its search strategies. This methodology significantly enhances the detection and understanding of EPN responses to cues, advancing their potential in precision biocontrol programs for sustainable pest management actions. Science4Impact statement (S4IS): This study develops a novel lab-on-a-chip platform integrating artificial intelligence (AI) for the precise investigation of host-seeking behaviours in the entomopathogenic nematode Steinernema carpocapsae, a biological control agent (BCA) with potential for sustainable pest management. By combining microfluidic design with deep learning, the platform accurately assesses nematode responses to hostderived cues, providing new insights into its foraging adaptability beyond conventional techniques. This research can help researchers and agricultural stakeholders by enhancing understanding of BCA behaviour, optimising pest control applications, and informing evidence-based decisions on sustainable crop protection. The findings also support quality assurance in biological control validation by offering a rigorous framework for evaluating nematode effectiveness under realistic conditions, promoting its broader adoption in integrated pest management strategies. * Corresponding author. The BioRobotics Institute, Sant’Anna School of Advanced Studies, Viale R. Piaggio 34, Pontedera, 56025, Pisa, Italy. ** Corresponding author. The BioRobotics Institute, Sant’Anna School of Advanced Studies, Viale R. Piaggio 34, Pontedera, 56025, Pisa, Italy. E-mail addresses: [email protected] (G. Manduca), [email protected] (D. Romano). Contents lists available at ScienceDirect Biosystems Engineering journal homepage: www.elsevier.com/locate/issn/15375110 https://doi.org/10.1016/j.biosystemseng.2025.104159 Received 24 April 2024; Received in revised form 10 April 2025; Accepted 12 April 2025 Biosystems Engineering 255 (2025) 104159 Available online 9 May 2025 1537-5110/© 2025 The Authors. Published by Elsevier Ltd on behalf of IAgrE. This is an open access article under the CC BY license ( http://creativecommons.org/licenses/by/4.0/ ). Nomenclature Abbreviations AI Artificial intelligence AUC Area under the curve BCA Biological control agent CAD Computer-aided design CLAHE Contrast limited adaptive histogram equalisation CNN Convolutional neural network CV Cross-validation EGVM European grapevine moth EPN Entomopathogenic nematode GFLOPS Giga floating-point operations per second GPU Graphics processing unit IoU Intersection over union mAP Mean average precision MB Megabytes MLP Multilayer perceptron MP Megapixels PDMS Polydimethylsiloxane RBF Radial basis function RGB Red-green-blue ROC Receiver operating characteristic SVM Support vector machine UAV Unmanned aerial vehicle Symbols A1,A2Quadratic polynomial coefficient matrices b1,b2Polynomial coefficient vectors c1,c2Polynomial constant terms dDisplacement vector [px] (pixels) dtTime step [s] (seconds) dxDistance step along the x-axis [px] dyDistance step along the y-axis [px] fxImage gradient along the x-axis fyImage gradient along the y-axis ftImage gradient along the time I(x,y,t)Pixel intensity at coordinates (x,y) and time t NTotal number of classes uOptical flow component along the x-axis [px/s] vOptical flow component along the y-axis [px/s] XVector of coordinates (x,y) T FN False negatives number FP False positives number FPR False positive rate TN True negatives number TP True positives number TPR True positive rate 1. Introduction The entomopathogenic nematode (EPN) Steinernema carpocapsae Weiser (Rhabditida: Steinernematidae), has gained a growing attention for its potential as an effective biological control agent (BCA) against a number of arthropod pests (Lalitha et al., 2022; Tarasco et al., 2023). Traditionally reported as an ’ambusher’ species, S. carpocapsae is thought to target highly mobile, surface-dwelling pests due to its habit of accumulating near the soil surface (Campbell & Gaugler, 1997). However, several studies challenge this hypothesis, suggesting that S. carpocapsae can be effective in controlling a broader range of pests, including those living deep within the substrate or exhibiting cryptic behaviour (Gang & Hallem, 2016; Wilson et al., 2012). Despite its potential as a BCA, the widespread acceptance of S. carpocapsae ambush-foraging strategy has led to its dismissal in certain pest control scenarios (Gaugler, 1988; Koppenh¨ ofer & Kaya, 1996). Consequently, it is crucial to reassess and expand our understanding of the foraging behaviour of this EPN, particularly in contexts diverging from conventional soil environments (Stuart et al., 2015). Microfluidics and lab-on-a-chip technologies represent a paradigm shift in scientific instrumentation, offering unparalleled versatility and efficiency (Romano et al., 2022; Shanti et al., 2018). This transformative approach is revolutionising many research contexts, including genomic analysis, diagnostics, and environmental monitoring, promoting groundbreaking discoveries (Campana & Wlodkowic, 2018; Conde et al., 2016). Through precise fluidic control and reduced sample/reagent volumes, lab-on-a-chip platforms enhance experimental throughput and minimise waste (Sengupta & Hussain, 2022). In addition, rapid prototyping methods like 3D printing, micromachining, laser cutting, expedite device fabrication fostering innovation agility (Garmasukis et al., 2023). Recent advancements in artificial intelligence (AI) and automation are driving substantial technological progress, influencing social, healthcare, industrial, and environmental sectors (Ferreira et al., 2023). These approaches provide robust solutions to complex challenges and can offer tailored strategies for dynamic challenges in pest management and crop protection science (Manduca et al., 2023a; Mesías-Ruiz et al., 2023). Among these, deep learning techniques have demonstrated notable capabilities in a wide range of applications, from detecting and classifying insect species (Santaera et al., 2025) to recognising animal actions (Fazzari, Romano, Falchi, & Stefanini, 2025). This study introduces a novel lab-on-a-chip platform integrated with AI to investigate the behavioural patterns of S. carpocapsae in response to host-borne cues, overcoming the limitations of traditional observational methods. A convolutional neural network (CNN) model was employed to identify nematodes and analyse their behaviour in response to host-borne stimuli. Optical flow analysis was integrated to assess motor activity, offering deeper insights into host detection and exploitation mechanisms. Additionally, machine learning classifiers were employed to categorise nematode motor activity based on features extracted from optical flow data. Fig. 1 presents a workflow of the proposed approach. It is hypothesised that S. carpocapsae exhibits a more flexible and adaptable host-seeking behaviour than traditionally assumed, responding to a broader range of host-derived stimuli. A deeper understanding of the nematode’s foraging strategies could enhance its effectiveness as a BCA against key insect pests, contributing to sustainable crop protection. 2. Materials and methods 2.1. Steinernema carpocapsae EPNs at the infective juvenile stage (IJ) were tested, using NEMOPAK SC, a commercial product kindly supplied by Bioplanet (Cesena, Italy). The nematode’s body measures approximately 400–500 μ m in length and 30 μ m in width, as reported by Shinde et al. (2010). The EPNs were stored at 4–8 ◦C to maintain their viability and were reconstituted in distilled water prior to experimentation. EPNs were placed in water at 25 ◦C to activate them, where they were subjected to continuous agitation using a magnetic vortex for 20 min. This procedure was selected to reproduce environmental conditions promoting the nematode activity, thus ensuring optimal responsiveness. 2.2. Tested cues Herein, host-borne cues derived from moth larval faeces were chosen, as these cues are known to play a significant role in the host-seeking behaviour of several EPNs (Baiocchi et al., 2017). The reasoning behind this choice lies in the natural interactions between EPNs and their preferred hosts, as the chemical signals present in the faeces can potentially elicit behavioural responses from this nematode species. Earlier research reported the attractiveness shown by various cues on EPN behaviour (Jagodiˇ c et al., 2017; Zhang et al., 2021). In particular, the attraction triggered by host-borne cues, such as the host gut content, has been noted (Grewal et al., 1993). As host-borne cues, faeces of 5th instar larvae of the European grapevine moth (EGVM), Lobesia botrana (Den. & Schiff.) (Lepidoptera: Tortricidae), a primary pest of grapevine (Benelli et al., 2023a, 2023b), were used. EGVM larvae were reared in the laboratory on an artificial diet as detailed by Benelli et al. (2020). G. Manduca et al. Biosystems Engineering 255 (2025) 104159 2 2.3. Lab-on-a-chip design The lab-on-a-chip device was designed and fabricated to provide a controlled environment suitable to the analysis of EPN behaviour. Fig. 2 presents the design and fabrication of the platform. The design of the miniaturised two-choice arena was produced by using the computeraided design (CAD) software SolidWorks (Dassault Systemes, Velizy Villacoublay, France), ensuring precise dimensions and functionality. Subsequently, the fabrication of the microfluidic arena was obtained through rapid prototyping techniques, employing a biocompatible resin (VisiJet® M3 Crystal, 3D Systems). This setup is essential for investigating the parasitic behaviour and locomotion of EPNs in an environment that mimics their natural habitat and enhances their visibility (Wolozin et al., 2011). The microfluidic arena was crafted to feature a releasing chamber (diameter =5 mm; height =2 mm) and two chambers that can potentially contain selected cues (diameter =3 mm; height =2 mm). The design of the arena allows for the exploration of EPN’s behaviour without imposing spatial constraints on their motility, thereby minimising potential biases. Each chamber is seamlessly connected to the releasing chamber through dedicated aisles (length =3 mm for the horizontal branch; length =4 mm for the oblique branch; width =1 mm; height =2 mm), forming a Y-maze arena configuration. To facilitate observation and recording of S. carpocapsae behaviour, the floor of the lab-on-a-chip consists of a transparent glass plate firmly glued to the base of the upper component. This connection was obtained by depositing a polydimethylsiloxane (PDMS) film (Sylgard 184) with a curing time of 1 h at 100 ◦C (Johnston et al., 2014), ensuring stability and optical transparency throughout the experimentation process. The dimensions and the architectural design of the platform were selected to achieve optimal positioning beneath the inverted microscope (Nikon TMS Inverted, Nikon, Japan). Overall, the novel lab-on-a-chip is 75 mm in length and 25 mm in width. 2.4. Experimental procedure and recordings During experimentation, around 10 S. carpocapsae individuals were introduced into the releasing chamber using a pipette, enabling precise control over their placement within the microfluidic system. The number of nematodes selected was compatible with the dimensions of the platform’s channels, facilitating detailed morphological and behavioural analysis of the species. The microfluidic platform was positioned under a high-resolution 3D visual inspection microscope equipped with a total magnification of 25×. The overall setup facilitated detailed observation of EPN behaviour within the microfluidic system, enabling accurate recording of their responses to host-related cues provided within the chambers. The utilisation of this microfluidic platform ensured the recording of reliable and reproducible data, crucial for investigating the mechanisms underlying EPN behaviour and responses to selected stimuli. Prior to testing, several preparatory steps were undertaken. The chip was washed with water and 70 % ethanol to remove contaminants, reduce surface tension, enhance arena wettability, and improve nematode locomotion. A second washing was carried out using water to eliminate the alcohol traces potentially harmful to the EPN. The chip was then filled with the medium, i.e., 0.9 % NaCl physiological solution, since it is useful to avoid osmotic stress. For the cue attraction tests, faeces from 5th instar EGVM larvae were collected from rearing boxes using a Pasteur pipette and transferred to a separate container that had been previously cleaned with ethanol and left to air dry accurately. The host-borne cue (i.e. 0.07 ±0.008 mg of EGVM faeces) was positioned in the opposite arenas, alternating localisation, and flipping the arena to avoid any positional bias during the trials. Videos were recorded under the microscope for a total of 5 min. Video analysis considered only 60 s recording to avoid acclimation time and promote next Fig. 1. Workflow of the proposed approach: Design of the lab-on-a-chip device and visual representation of the entomopathogenic nematode Steinernema carpocapsae. The experimental setup is then presented, where the nematodes are exposed to stimuli. Data are subsequently collected and analysed using learning algorithms and optical flow to assess the nematodes’ responses to host stimuli. G. Manduca et al. Biosystems Engineering 255 (2025) 104159 3 computer vision and deep learning analysis. Videos were recorded by using a red-green-blue (RGB) camera (48 MP, aperture f-number 1.8) set on the microscope. Following each test, the device was washed and cleaned following the above-described procedures. 2.5. Deep learning detection A deep learning approach was used to distinguish a context in the presence of a host-borne stimulus based on the behaviour of EPNs. This approach enabled clear differentiation between these contexts and facilitated the analysis of motion variations captured in images, which were attributed to the presence of the stimulus. Nematodes served as biosensors, gathering information about their surrounding environment, while concurrently enabling the investigation of changes in behavioural traits in response to stimuli with the proposed deep learning approach. A YOLOv8n CNN model, pre-trained on the COCO dataset, a widely recognised benchmark for object detection tasks (Terven et al., 2023), was used. The choice of this CNN model was based on its versatility and proven effectiveness in object detection. YOLO networks, especially the v8 version, have been successfully deployed across a wide spectrum of detection challenges. These include tasks like identifying small objects in unmanned aerial vehicle (UAV) images (Huangfu and Li, 2023), assessing compliance with medical face mask usage in COVID-19 contexts (Ferreira, do Couto, & de Melo Baptista Domingues, 2024), and detecting various marine species (Manduca et al., 2023b). These examples highlight the adaptability and effectiveness of the YOLOv8 model across different applications. YOLOv8 employs a CNN architecture structured into three primary components: the backbone, neck, and head. The backbone, which is based on a modified CSPDarknet53 architecture, is responsible for extracting features from the input image. The neck merges feature maps from different stages of the backbone to capture information at various scales. The head predicts bounding boxes, objectness scores, and class probabilities for each grid cell in the feature map using multiple detection modules, which are then aggregated to produce the final detections. A key characteristic of YOLOv8 is its operation as an anchor-free detection model. In its v8n version, the model weighs 6.24 MB. The pre-trained CNN model was fine-tuned to specifically identify and differentiate nematodes exposed to a stimulus from those in a control setting. A dataset comprising 1680 images was curated from 50 videos, evenly distributed between control and stimulus contexts. The dataset was partitioned into training (1189 images), validation (339 images), and test (152 images) sets. Images were manually labelled using the Makesense software. The dataset also included approximately 10 % background images without EPN, proportionally allocated across the three sets. The CNN training process used a batch size of 8 for 200 epochs. Data augmentation was considered. The Mosaic method was used to create a diverse input by combining four resized images into a single mosaic. Both uniform and median blurring were applied with a randomly chosen kernel size between 3 and 7 and a 0.01 probability of use. Additionally, grayscale conversion was applied with a 0.01 probability, along with contrast limited adaptive histogram equalisation (CLAHE) for further augmentation, using a clip limit of 4 and a tile grid size of 8x8. Using the fine-tuned CNN model, a comprehensive analysis was conducted on 32 inference videos, each lasting 1 min and evenly divided between stimulus and control contexts. Frames were systematically extracted at a rate of 1 Hz, and for each frame, the CNN was applied to detect EPN under both conditions. The CNN detects and differentiates the nematodes in the arena into two classes based on their behaviour: control and stimulus. The results were aggregated to assess the presence or absence of a stimulus in each scenario, allowing for a comprehensive differentiation throughout the entire video. A prediction value of 0 corresponds to the control condition, while a value of 1 indicates the presence of a stimulus. For each frame, the average of the predictions Fig. 2. Lab-on-a-chip platform design and fabrication: Design and dimensions of the chip (A); assembly of the chip components involves spreading a thin layer of Sylgard 184 onto the glass slide, followed by placing the biocompatible resin chip on top of the PDMS layer, ensuring proper alignment and adhesion (B); the platform is cured in the oven at 100 ◦C for 1 h to increase Sylgard transparency and resistance (C); fabricated microfluidic platform ready to be employed (D). G. Manduca et al. Biosystems Engineering 255 (2025) 104159 4 was calculated. Subsequently, the average across all frames was computed to provide a single value representing each video. This iterative process was repeated for all videos, ensuring thorough analysis. The CNN training and subsequent analyses were performed using Ultralytics in Python, leveraging a Tesla T4 graphics processing unit (GPU). 2.6. Optical flow analysis Motor analysis was conducted employing an optical flow approach and the Farneb¨ ack algorithm (Farneb¨ ack, 2003). This methodology, widely recognised for its effectiveness, has been applied across different domains. For instance, in fire detection (Fatichah et al., 2019), or for recognition and localisation of anomalous events in crowd scenes contributing to enhanced security measures and crowd management strategies (Alhothali et al., 2023). Moreover, the application of optical flow analysis extends to driving scenarios, where it plays a crucial role in various applications (Ping et al., 2023). Additionally, its utility in violence detection (Mumtaz et al., 2023) underscores its significance in public safety and security initiatives. Optical flow represents the apparent motion of objects between two frames. Optical flow methods operate by analysing variations in intensity across both space and time I(x,y,t). When an object moves, its pixel intensity shifts by a displacement (dx,dy)over a time step dt. Assuming that the intensity of the object remains constant between frames, it results: I(x,y,t) = I(x+dx,y+dy,t+dt).(1) By applying a first-order Taylor series expansion, it results: I(x+dx,y+dy,t+dt) = I(x,y,t) + ∂ I ∂ xdx + ∂ I ∂ ydy + ∂ I ∂ tdt.(2) From Eqs. (1) and (2) it is possible to obtain the constraint equation: ∂ I ∂ x dx dt + ∂ I ∂ y dy dt + ∂ I ∂ t=0.(3) fx= ∂ I ∂ x, fy= ∂ I ∂ y, and ft= ∂ I ∂ t are the image gradients along the x-axis, yaxis, and time. u=dx dt and v=dy dt are the unknown variables. The Farneb¨ ack method uses polynomial expansion so that some neighbourhood of each pixel is approximated by using a quadratic polynomial: I1(X) = XTA1X+b1TX+c1,(4) where X= (x,y)T. A new signal is constructed over a displacement d: I2(X) = I1(X−d) = (X−d)TA1(X−d) + b1T(X−d) + c1 =XTA1X+ (b1−2A1d)TX+dTA1d−b1Td+c1 =XTA2X+b2TX+c2, (5) where, A2=A1,(6) b2=b1−2A1d,(7) c2=dTA1d−b1Td+c1.(8) From Eq. (7), in case of non-singular A1, the displacement can be computed: d= − 1 2A1−1(b2−b1).(9) In this study optical flow analysis was coupled with deep learning detection to access the motor activity of nematodes during experiments. Fig. 3 presents a graphical representation of the entire process. Deep learning was used to identify nematodes in the arena by defining bounding boxes around them, while optical flow analysis was applied to focus on these detected areas and quantify their movement intensity. This analysis aimed to compare the nematodes’ movement in response to different conditions: with and without cues. The procedure is detailed below. First, video frames were converted from RGB to grayscale. Optical flow between consecutive frames was computed, focusing on both the magnitude and direction of motion; however, only the magnitude was used for this analysis. Optical flow calculations were conducted with the Python OpenCV library and the calcOpticalFlowFarneback(.) function. The parameters were set as follows: scale =0.5, number of pyramid layers =5, averaging window size =15, number of iterations = 3, pixel neighbourhood size used for polynomial expansion at each pixel =7, and standard deviation of the Gaussian used to smooth derivatives for polynomial expansion =1.5. A total of 60 videos were considered, balanced between control and stimulus conditions. Given that nematodes exhibit body movements with a 2 Hz frequency according to literature (Buckingham et al., 2014), frames were sampled at 5 Hz for the optical flow analysis, in accordance with the Shannon theorem. The optical flow magnitude was computed by comparing two frames. The CNN model was used to obtain bounding boxes around each detected nematode. The average magnitude of motion was computed within each bounding box. Then, among the average magnitude values computed within each bounding box, the maximum and average values for each frame were considered. The maximum value was chosen to emphasise the most pronounced nematode movements, reducing the risk of considering background areas misclassified as EPNs Fig. 3. Optical flow analysis: Schematic representation of the entire process used to analyse nematodes’ motor activity through optical flow. Starting from a video dataset, optical flow is computed from frames comparison, focusing on detected nematodes. Two strategies are employed to extract optical flow magnitude profiles for each video to investigate nematodes’ movement dynamics. G. Manduca et al. Biosystems Engineering 255 (2025) 104159 5 during the analysis, while the average value offered a more comprehensive view of movement throughout the entire experiment. Temporal data were collected, and three features—mean, maximum, and variance—were extracted to provide a comprehensive measure of motion for each video, considering both strategies used for temporal data extraction. 2.7. Statistical analysis Data were normally distributed (Shapiro-Wilk test, p >0.01) and homoscedastic (Levene test, p >0.01). Statistical significance between stimuli and control was established using a t-test. Statistical analyses were performed using JMP Pro 17 software. The threshold was set at p = 0.05. 2.8. Machine learning classifiers Following the statistical analysis, significant features were selected to train various machine learning models aimed at distinguishing EPN motor activity in response to stimuli, based on features extracted from optical flow data. Two models were considered: Support vector machine (SVM) and multilayer perceptron (MLP). To ensure robust testing, nested cross-validation (CV) was employed, incorporating both 4-fold external and internal loops. Hyperparameter tuning was carried out using grid search CV. All analyses were conducted using scikit-learn in Python. For SVM, both radial basis function (RBF) and linear kernels were considered, along with a range of C values from 0.01 to 10. For MLP, a maximum of four nodes with a single hidden layer were tested. 2.9. Performance assessment When evaluating the performance of the AI models, multiple metrics were considered. Accuracy quantifies the ratio of correct predictions made by the model against the total number of predictions. Precision denotes the likelihood of accurately predicting positive samples among those predicted as positive. It is computed using the following formula: Precision =TP TP +FP.(10) The variable TP represents the number of true positives, while FP represents the number of false positives. Recall denotes the probability of accurately predicting positive samples among all actual positive samples. It is calculated as follows: Recall =TP TP +FN .(11) The variable FN denotes the count of false negatives. The F1-score provides the harmonic mean of precision and recall, thus offering a balanced evaluation that considers both metrics. It can be computed as follows: F1−Score =2⋅Precision⋅Recall Precision +Recall .(12) The mean average precision (mAP) is a performance metric used in object detection tasks. It is calculated using the following formula: mAP = ∑ N n=1 APn N.(13) N represents the total number of classes, and APn denotes the average precision of class n, which corresponds to the area under the precisionrecall curve. [email protected] denotes the mean average precision at an intersection over union (IoU) threshold of 0.5. IoU is a metric used to quantify the overlap between a predicted bounding box and the ground truth bounding box, calculated as the ratio of the intersection area to the union area of the two boxes. The receiver operating characteristic (ROC) curve plots the true positive rate (sensitivity) against the false positive rate (1-specificity) at various threshold values. The area under the curve (AUC) offers a comprehensive evaluation of the classifier’s performance across all thresholds. 3. Results Microscopic observations enabled the identification of key behaviours exhibited by EPNs, including increased movement and larger oscillation size. These investigations were made by using 25×total magnification and considering a circular area of 7 mm of diameter to be able to focus on the final part of the device. These observations indicate that the presence of host-borne cues influences the behavioural complex of S. carpocapsae. When placed in presence of the EGVM faeces, EPNs tended to increase their speed and turning rate, sometimes also crossing the entire central channel of the platform to reach the opposite chamber where the attractive cue was previously positioned. Indeed, control nematodes were less motile, moving with less broad oscillations; they rarely tried to cross the microfluidic platform. All these features had to be analysed by means of innovative and automated techniques to have a clear description of EPN’s responses to a new potentially attractive cue. The EPNs directional change towards L. botrana faeces highlights the attractiveness of the selected cue. This aspect, though not well known in existing literature, is crucial for deepening our understanding of the species’ behaviour and for optimising its use as a biological control agent. The convolutional neural network has been trained to identify nematodes within the arena, but its capabilities extend further. Indeed, the network has been trained to distinguish stimulated EPNs. Training took 5.04 h over 200 epochs on a Tesla T4 GPU. The final model consists of 168 layers with 3,006,038 parameters, with a computational requirement of 8.1 giga floating-point operations per second (GFLOPS). Overall, the model achieved a precision of 0.63, recall of 0.62, and a mAP at 0.50 threshold of 0.61 on the validation set. For the control class, 0.79 of the samples were correctly classified, with 0.07 misclassified as stimulus and 0.14 as background. For the stimulus class, 0.70 of the samples were correctly classified, while 0.06 were misclassified as control and 0.24 as background. Fig. 4 presents 12 sample images from the test set, showing the network’s detections. The images are evenly divided between stimulation and control conditions. As illustrated, the model identified nematodes within the arena and classified them based on their behaviour, distinguishing between stimulated and control. Results suggest that the presence of the stimulus may induce changes in movement, thereby validating the behavioural variations observed. The results improve when aggregating frame-level data to a broader video-level analysis. Fig. 5A presents the predictions from the video analysis. A model prediction value of 0 corresponds to the control condition, while a value of 1 indicates the presence of a stimulus. For each frame, the average of the predictions was calculated. Subsequently, the average across all frames was computed to provide a single value representing each video. As shown in the normalised confusion matrix in Fig. 5B, the model distinguishes EPN’s behaviours across various contexts within the video data. All control videos were correctly classified. Meanwhile, 0.88 of the videos with stimulus presence were correctly classified, with 0.12 misclassified as control. Fig. 5C presents the overall results across the different evaluation metrics. The model achieved an accuracy of 0.94, with a precision of 1.00, a recall of 0.88, and an F1score of 0.93. Subsequent optical flow analysis aims to delve deeper into dynamic variations in motor activity among EPNs in stimulus presence. Bounding boxes were generated for each video frame using the CNN model, and optical flow magnitude was calculated between consecutive frames. Fig. 6A illustrates two consecutive frames from a sample video with stimulus presence, showing detected EPNs and visualising the optical flow magnitude between them using MIN-MAX normalisation to G. Manduca et al. Biosystems Engineering 255 (2025) 104159 6 highlight motor activity. The average values within each bounding box were recorded, and the maximum and mean values were computed for each frame to construct temporal profiles across the video. These temporal profiles for the same sample video are shown in Fig. 6B and C, with the optical flow magnitude expressed in millimetres per second. The two strategies for calculating temporal profiles differ in the type of movement they emphasise: the maximum value focuses on the movement of the most active nematodes, while the mean value provides a more comprehensive overview of movement across the entire experiment. Given the detection results of the CNN model, the mean value can be relied upon, as the network does not confuse parts of the arena with the nematodes. While the network may occasionally misclassify nematodes as background, this does not affect the mean value, as their movement is excluded from its calculation, ensuring it remains a reliable indicator of overall motor activity. To quantify the overall activity for each video and compare the stimulus-presence context with the control, three features were considered: the mean, maximum, and variance of the temporal profiles. These features were computed across the entire video dataset and are presented in Fig. 7 for the two strategies used to obtain the temporal profiles. Panels 7A, 7B, and 7C show the mean, maximum, and variance of the temporal profiles, emphasising the motor activity of the most active nematodes in each frame. Panels 7D, 7E, and 7F display the same features of the temporal profiles, highlighting the overall motor activity across the video. Statistical analysis revealed significant features, indicating meaningful differences in motor activity and locomotion between the two groups. The mean values of the temporal profiles show significance both for profiles emphasising the motor activity of the most active nematodes (p =0.0162) and those highlighting overall motor activity (p =0.0078). In the latter case, the maximum (p =0.0055) and variance (p =0.0106) features also show significance. Steinernema carpocapsae exhibited a more intense activity in presence of host-borne cues. Given that the features derived from the temporal profiles highlighting overall motor activity offered a more comprehensive view of the nematodes’ behaviour across the video dataset, and due to their statistical significance, subsequent analysis focused on these. The extracted features not only captured the activity of the most active nematodes, but also the broader motor patterns throughout the experiment. Based on these features, two classifiers were trained, support vector machine and multilayer perceptron, each leveraging these key features to distinguish between the groups. This approach was utilised to differentiate the motor activity under different experimental conditions, ensuring a more robust and comprehensive analysis. Fig. 8 presents the results of the machine learning classifiers in distinguishing between stimulus and control contexts, based on the features obtained from optical flow analysis. Fig. 8A shows the comparison between the two classifiers using metrics such as precision, recall, accuracy, and F1-score, while Panels 8B Fig. 4. Detections on the test set: 12 sample images showing the model’s detections, evenly distributed between the stimulus and control conditions. The images are divided into two sets: 6 images from a control context (first and second columns, from left to right) and 6 images from a stimulus context (third and fourth columns). These examples demonstrate the model’s ability to identify nematodes and classify their behaviour in response to the presence or absence of a stimulus. Fig. 5. Video-level results: Averaged class prediction values (A); normalised confusion matrix (B); overall results across the different evaluation metrics (C). G. Manduca et al. Biosystems Engineering 255 (2025) 104159 7 and 8C display the receiver operating characteristic curves for the SVM and MLP classifiers, respectively. The performance results of the two classifiers indicate distinct differences in their ability to distinguish between nematodes under stimulus and control conditions. SVM classifier achieved a precision of 0.75, recall of 0.63, accuracy of 0.70, and F1-score of 0.67. MLP Fig. 6. Optical flow analysis: Two consecutive frames from a stimulus-context video sampled at 5 Hz, shown alongside the graphical representation of the optical flow magnitude, normalised using MIN-MAX scaling (A). Temporal profiles of the optical flow magnitude for the video sample, derived from the maximum (B) and mean (C) values calculated from the averaged magnitude values within the bounding boxes for each frame. Fig. 7. Optical flow results: Features extracted from the temporal profiles across the video dataset, comparing motor activity in the stimulus-presence context with the control. Mean (A), maximum (B), and variance (C) of temporal profiles emphasising the motor activity of the most active nematodes in each frame, and mean (D), maximum (E), and variance (F) of temporal profiles highlighting overall motor activity. Asterisks (*) on the boxplots indicate statistical significance. G. Manduca et al. Biosystems Engineering 255 (2025) 104159 8 classifier showed slightly lower performance, with precision, recall, accuracy, and F1-score around 0.66 and 0.67. Both classifiers achieved an area under the receiver operating characteristic curve of 0.71. This score shows that both classifiers performed similarly in separating the two classes. Given these results, it is evident that both classifiers, based on the features extracted through optical flow analysis, effectively distinguish between the nematodes’ motor activity in response to the presence of a stimulus compared to when no stimulus was present. 4. Discussion Engineered testing arenas, leveraging lab-on-a-chip technology, are increasingly applied in behavioural and ecological studies (Campana & Wlodkowic, 2018; Romano et al., 2022). In the case of nematodes this technology is well established and allows to test motility and taxis in presence of different stimuli such as chemical compounds or electrical stimuli conveyed in the microchannel by means of metal electrode (Ghaemi et al., 2015). Lab-on-a-chip technology is also employed as a valid technique to drug screening by using nematode’s sensing (Carr et al., 2011). Considering the growing significance within the scientific context of the lab-on-a-chip technique application (Romano et al., 2022; Shanti et al., 2018), this work provides a technological advancement in biosystems investigation and management. Lab-on-a-chip platforms are valuable for observing microscopic organisms within a device that mimics the microchannel structure of soil, while also reducing interference from environmental factors that could compromise data collection. A further advantage of microfluidics is the possibility to replicate numerous identical copies of the arena through fast prototyping techniques (Weisgrab et al., 2019), thus standardising the experimental phase to reduce the errors during the analysis of results (Haeberle & Zengerle, 2007). The integration of AI into lab-on-a-chip solutions could be a powerful tool for a deeper analysis on behavioural patterns, gaining insights into motor activities difficult to observe with traditional approaches. The engineering approach adopted in this work based on the combination of three different tools—microfluidics, machine learning, and optical flow—is still poorly explored in the current state of the art. But the possibility to merge and integrate these tools represents a strategy capable of collecting high-quality data and enabling in-depth analysis. A preliminary study with initial results was previously presented (Manduca et al., 2024a, 2024b), but in this work, a more in-depth analysis is provided, alongside the integration of machine learning classifiers to identify changes in motor activity in response to stimuli, based on data extracted from optical flow analysis. The integration of deep learning into microfluidic platforms has been previously used for segmentation and classification tasks, such as the segmentation of channel images and the classification of adhered cells into subtypes (Praljak et al., 2021) or for tumour cell screening (Hashemzadeh et al., 2021). In this study, deep learning was employed for three distinct purposes using the same CNN model: (1) to identify target elements in an environment, (2) to differentiate and analyse their behaviour in response to stimuli, and (3) to detect the presence of stimuli in an environment based on behavioural patterns, effectively using them as biosensors. The integration of optical flow with microfluidics, on the other hand, has predominantly been applied for flow rate measurement (Garbe et al., 2006; Nguyen & Truong, 2005). In this context, optical flow enabled a detailed analysis of the motor activity of the target individuals, identified by the network. Notably, within microchannels, fluid flow is predominantly laminar due to the low Reynolds number (Schulte et al., 2002), minimising interference from medium turbulence. Steinernema carpocapsae has been described for years as an ambusher EPN without the capability to search and move towards a potential host (Koppenh¨ ofer & Kaya, 1996). This trait is an important issue that, despite the simple mass rearing, avoids its effective application against many constrained pests (Ehlers, 2001). More recently, it has been described as an intermediate nematode, whose motility was influenced by different habitat conditions (Kruitbos and Wilson, 2010); actually, the presence of a high percentage of organic matter in the soil (peat soil) can enhance cruising in S. carpocapsae (Dembilio et al., 2010). This AI and microfluidics-based investigation reveals some relevant traits of a cruiser species and enhances the knowledge of S. carpocapsae behaviour paving the path for its broader application as a BCA. The achieved results show differences in the motor activity in presence of a given cue and deep learning image-based method underlined variations in EPN kinesis. The trained network showed some difficulties detecting nematodes at frame-level due to background interferences, but results may improve by using a different device set up when it is placed under the microscope. Furthermore, a more precise and efficient device for handling nematodes could enable the observation of individual specimens, improve video recording quality and the following analysis. Additionally, using a localised stimulus instead of one dispersed in a fluid medium could provide a clearer understanding of behavioural differences. Refining the microfluidic setup, such as incorporating a caging system to isolate the stimulus, along with the use of pose estimation techniques, could provide greater insight into movement patterns. Despite these limitations, the proposed approach remains a valuable tool for studying fundamental behavioural traits. Results improved at video-level where the network achieved a precision of 1.00. The optical flow analysis integration allowed for an investigation of the motor activity over time. Steinernema carpocapsae showed a significant distinction among different conditions, with a more intense activity in presence of EGVM faeces. Results confirm the presence of both ambusher and cruiser behavioural traits in S. carpocapsae (see also Wilson et al., 2012). Indeed, differences in S. carpocapsae motor activity were observed depending on the presence of an attractive cue. Fig. 8. Machine learning classifier performance in distinguishing between stimulus control contexts, using features derived from optical flow analysis: Comparison of the performance of two classifiers (support vector machine and multilayer perceptron) based on precision, recall, accuracy, and F1-score in terms of median and interquartile range across the 4 folds of the cross validation (A); receiver operating characteristic curves of SVM (B) and MLP (C) classifiers, with the corresponding area under the curve values displayed. G. Manduca et al. Biosystems Engineering 255 (2025) 104159 9