Skip to main page content
U.S. flag

An official website of the United States government

Dot gov

The .gov means it’s official.
Federal government websites often end in .gov or .mil. Before sharing sensitive information, make sure you’re on a federal government site.

Https

The site is secure.
The https:// ensures that you are connecting to the official website and that any information you provide is encrypted and transmitted securely.

Access keys NCBI Homepage MyNCBI Homepage Main Content Main Navigation
. 2025 Feb 6;12(2):ENEURO.0031-24.2024.
doi: 10.1523/ENEURO.0031-24.2024. Print 2025 Feb.

Analysis of Operant Self-administration Behaviors with Supervised Machine Learning: Protocol for Video Acquisition and Pose Estimation Analysis Using DeepLabCut and Simple Behavioral Analysis

Affiliations

Analysis of Operant Self-administration Behaviors with Supervised Machine Learning: Protocol for Video Acquisition and Pose Estimation Analysis Using DeepLabCut and Simple Behavioral Analysis

Leo F Pereira Sanabria et al. eNeuro. .

Abstract

The use of supervised machine learning to approximate poses in video recordings allows for rapid and efficient analysis of complex behavioral profiles. Currently, there are limited protocols for automated analysis of operant self-administration behavior. We provide a methodology to (1) obtain videos of training sessions via Raspberry Pi microcomputers or GoPro cameras, (2) obtain pose estimation data using the supervised machine learning software packages DeepLabCut (DLC) and Simple Behavioral Analysis (SimBA) with a local high-performance computer cluster, (3) compare standard Med-PC lever response versus quadrant time data generated from pose estimation regions of interest, and (4) generate predictive behavioral classifiers. Overall, we demonstrate proof of concept to use pose estimation outputs from DLC to both generate quadrant time results and obtain behavioral classifiers from SimBA during operant training phases.

Keywords: DeepLabCut; Raspberry Pi; Simple Behavioral Analysis (SimBA); operant behavior; pose estimation; predictive classifiers; self-administration; video recording.

PubMed Disclaimer

Conflict of interest statement

The authors declare no competing financial interests.

Figures

Figure 1.
Figure 1.
Schematics for each behavioral phase. All experiments included A cocaine self-administration training (Coc-SA, 2 h sessions, minimum of 10 sessions) in a distinct context, followed by B extinction training (Ext, 2 h sessions, minimum of 8 sessions) in a second context. C, Rats were returned to the previous cocaine-paired (Coc-pair) context during Relapse Tests (2 h session).
Figure 2.
Figure 2.
Video acquisition with Raspberry Pi (RasPi) or GoPro cameras. RasPi camera involves steps to install and assemble RasPi 4 microcomputer and camera for video recording, and install Termius and SSH to control the camera. The RasPi 4 (Model B) has a storage limit of 64 GB with a maximum video resolution of 640 × 480 px and 24 frames/s. The GoPro installation requires less steps, but a GoPro premium subscription or use of Ffmpeg open-source software is needed to process videos. The GoPro (Hero 8 black) has a storage limit of 512 GB with a maximum resolution of 4,096 × 2,160 px and 240 frames/s.
Figure 3.
Figure 3.
Key steps to acquire pose estimation of lever response behavior: DeepLabCut (DLC) workflow. After acquiring behavioral videos, DLC desktop can be used to A extract frames with user-defined labels added to various body parts. Labeled frames are then used to B train the network using MSU's high-performance computer cluster (HPCC). C, The output from DLC network training should be evaluated for test error, training loss, and % accuracy. Depending on the results, more frames can be labeled and/or the network trained for more iterations (gray-shaded text), or the output can proceed to D segmentation of statistical analysis.
Figure 4.
Figure 4.
Key steps to acquire region of interest and predictive classifier data: Simple Behavioral Analysis (SimBA) workflow. Pose estimation outputs from DeepLabCut (DLC) can be transferred into SimBA to A create predictive classifiers and correct outliers based on movement and location (workflow Scenario 1). Regions of interest (ROIs) can then be created with the active lever, Quadrant A; area behind the active lever, Quadrant D; area containing nose poke receptacle, Quadrant B; inactive lever, Quadrant C; and area behind the inactive lever, Quadrant E. Model training can then be performed B after feature extraction, and >200,000 frames should be annotated with behaviors of interest. C, The models trained can be evaluated using their F1 score and can be considered a good fit provided visualization of predictive classifiers demonstrate accurate tracking. If necessary, more frames can be labeled (workflow Scenario 3, gray-shaded text) or the output can proceed to D running the model on new videos (workflow Scenario 2) which can be used for subsequent classifier analysis.
Figure 5.
Figure 5.
Med-PC lever response analysis. Rats were trained to respond for cocaine rewards. An active lever response resulted in cocaine infusion, whereas an inactive response resulted in no consequences. A, Over the 10 sessions of cocaine self-administration (Coc-SA) training, active lever responses increased (S1 < S8–10, #p < 0.01), in contrast to inactive responses which remained low throughout (S1 = S8–10). B, The mean number of responses on the last three sessions of Coc-SA was significantly higher for the active versus inactive lever, *p < 0.01. C, Over the eight sessions of extinction (Ext) training, active and inactive responses decreased (S1 < S8, #p < 0.01). D, During the Relapse Test, active lever responses were higher in the cocaine-paired (Coc-pair) context compared with the last session of Ext (Ext S8 < Coc-pair, #p < 0.01), and Relapse Test active responses were higher than inactive (*p < 0.01).
Figure 6.
Figure 6.
SimBA quadrant time analysis. Rats were trained to respond for cocaine rewards. An active lever response resulted in cocaine infusion, whereas an inactive response resulted in no consequences. A, Over the 10 sessions of Coc-SA training, time spent in the active quadrant (A and D) increased (S5 < S8–10, #p < 0.05), in contrast to time spent in the inactive quadrant (C and E), which remained low (S5 = S8–10). B, The mean time spent in quadrants on the last three sessions of Coc-SA was significantly higher in the active versus inactive quadrant, *p < 0.01. C, Over the eight sessions of extinction (Ext) training, time spent in both the active and inactive quadrants remained stable. D, During the Relapse Test, time spent in the active and inactive quadrants was similar in the cocaine-paired (Coc-pair) context compared with the last session of Ext. Active responses were higher than inactive during the last session of Ext and the Coc-pair Test (*p < 0.01). E, Wind rose plots depicting the orientation of rats to the active lever during Coc-SA (S5, 8–10), Ext (S1, 8), and Relapse Test. Plots were generated by calculating the angle between two vectors: one from the center head point to the catheter point and another from the active lever to the center head point. Angles were divided into 30° bins, with 0° notating orientation to the active lever. Frequency of orientation throughout each session: very high (dark orange) to very low (teal).
Figure 7.
Figure 7.
SimBA behavioral classifier analysis. Predictive classifier analysis for A Bout count and B Total bout length (in seconds) for exploration, grooming, and pacing behaviors. Exploration was present in all phases of behavior (gray-shaded), but pacing was primarily present during Coc-SA (pink-shaded), with more grooming behaviors present during Ext and Relapse Test phases (teal-shaded). Definitions of exploration, grooming, and pacing behaviors are noted in Table 4.
Figure 8.
Figure 8.
SimBA quadrant time analysis. Parallel Figure 6 Results from time in operant quadrants generated with SimBA for the A right head and B left head body parts. Rats were trained to respond for cocaine rewards. An active lever response resulted in cocaine infusion, whereas an inactive resulted in no consequences. Qualitative presentation of time spent in the active quadrant (A and D), compared with the inactive (C and E) or nose poke B quadrants during A, Bi,ii cocaine self-administration (Coc-SA) phase, A, Biii extinction (Ext) training, A, B,iv the last session of Ext, and A, B,v during the Relapse Test in the cocaine-paired (Coc-pair) context.

Similar articles

References

    1. Arguello AA, Valade CT, Voutour LS, Reeves CA (2024) Cocaine reward and reinstatement in adolescent versus adult rodents. Front Behav Neurosci 17:1278263. 10.3389/FNBEH.2023.1278263 - DOI - PMC - PubMed
    1. Centanni SW, Smith ACW (2023) PiRATeMC: a highly flexible, scalable, and low-cost system for obtaining high quality video recordings for behavioral neuroscience. Addict Neurosci 8:100108. 10.1016/J.ADDICN.2023.100108 - DOI - PMC - PubMed
    1. Charpentier ANH, Olekanma DI, Valade CT, Reeves CA, Cho BR, Arguello AA (2023) Influence of reconsolidation in maintenance of cocaine-associated contextual memories formed during adolescence or adulthood. Sci Rep 13:13936. 10.1038/S41598-023-39949-Y - DOI - PMC - PubMed
    1. Cho BR, Gerena J, Olekanma DI, Bal A, Charpentier ANH, Arguello AA (2020) Role of adolescent-formed, context-drug-associations on reinstatement of drug-seeking behavior in rats. Psychopharmacology 237:2823–2833. 10.1007/s00213-020-05575-z - DOI - PMC - PubMed
    1. Clemensson EKH, Abbaszadeh M, Fanni S, Espa E, Cenci MA (2020) Tracking rats in operant conditioning chambers using a versatile homemade video camera and DeepLabCut. J Vis Exp:61409. 10.3791/61409 - DOI - PubMed

LinkOut - more resources