Abstract
PyMouseTracks (PMT) is a scalable and customizable computer vision and radio frequency identification (RFID)-based system for multiple rodent tracking and behavior assessment that can be set up within minutes in any user-defined arena at minimal cost. PMT is composed of the online Raspberry Pi (RPi)-based video and RFID acquisition with subsequent offline analysis tools. The system is capable of tracking up to six mice in experiments ranging from minutes to days. PMT maintained a minimum of 88% detections tracked with an overall accuracy >85% when compared with manual validation of videos containing one to four mice in a modified home-cage. As expected, chronic recording in home-cage revealed diurnal activity patterns. In open-field, it was observed that novel noncagemate mouse pairs exhibit more similarity in travel trajectory patterns than cagemate pairs over a 10-min period. Therefore, shared features within travel trajectories between animals may be a measure of sociability that has not been previously reported. Moreover, PMT can interface with open-source packages such as DeepLabCut and Traja for pose estimation and travel trajectory analysis, respectively. In combination with Traja, PMT resolved motor deficits exhibited in stroke animals. Overall, we present an affordable, open-sourced, and customizable/scalable mouse behavior recording and analysis system.
Significance Statement
An affordable, customizable, and easy-to-use open-source rodent tracking system is described. Most current tools, commercial or otherwise, can only be fully automated to track multiple animals in a single defined environment and are not easily setup within custom arenas or cages. Moreover, many tools require users to have extensive hardware and software knowledge. In contrast, PyMouseTracks (PMT) is easy to install and can be adapted to track rodents of any coat color in any user-defined environment with few restrictions allowing quantification of behavior in multiple animals simultaneously.
Introduction
Paradigms have been developed for identifying abnormal behavioral phenotypes in animal models of neuropsychiatric disorders (Sourioux et al., 2018). Traditionally, these approaches rely on manual phenotyping which is time, labor, and skill intensive. At the same time, results are not only prone to investigator bias and handling effects on animals (Ohayon et al., 2013), but also random errors dependent on the evaluator. As expected, results from traditional paradigms are usually high in interexperiment variability and can be difficult to reproduce (Kafkafi et al., 2018). Thus, there is an increasing need for behavior assays to be fully automated.
In recent years, a number of tools use technologies including combinations of computer vision, machine learning, neural networks, and physical tagging (de Chaumont et al., 2019; Romero-Ferrero et al., 2019; Singh et al., 2019; Kiryk et al., 2020; Segalin et al., 2021; Walter and Couzin, 2021) to automatically capture rodent behaviors. In particular, video tracking coupled with radio frequency identification (RFID) has become a popular and reliable approach for automatic identification of mice among groups without the use of visible markings (Bains et al., 2016; de Chaumont et al., 2019; Peleh et al., 2019). Physical tagging such as RFID on the animal is necessary for the complete automation of accurate tracking as each identity error (when mice cross or overlap) can propagate throughout the rest of the video without a method of periodic verification (Branson, 2014). Although there are markerless trackers available, these tools require: manual validation/correction of animal identities (Lauer et al., 2022), animals to be of different coat colors (Segalin et al., 2021) or require videos to have uniform lighting and high background contrast (Romero-Ferrero et al., 2019; Walter and Couzin, 2021). Such requirements render most current open-source automatic tracking systems restrictive and in turn have only narrow applications within particular arenas (de Chaumont et al., 2019) and experimental paradigms (Geuther et al., 2019).
We present PyMouseTracks (PMT): an affordable, open-source, easy-to-set-up, and customizable/scalable behavior recording software and hardware system. The system is capable of recording and tracking multiple mice of varied coat colors for extended periods of time in any user-defined environment. Video and RFID recordings use a Raspberry Pi (RPi) microcomputer. In the offline processing, mice are first detected and tracked in videos using the You Only Look Once version 4 (Yolov4) algorithm coupled with a modified version of the Simple Online and Realtime Tracking (SORT), respectively (Bewley et al., 2016; Bochkovskiy et al., 2020).
PMT home-cage recording used in our home-cage study contains six RFID readers and currently costs ∼520 USD per home-cage. The RFID reader numbers and locations can be adjusted to other home-cage variations or recording environments to fit a specific investigator’s need. To demonstrate flexibility and scalability, we also performed tracking of (1) six black coat-colored mice in an open-field, and (2) three white coat color mice in a three chambers arena with a low-contrast video background.
Materials and Methods
PMT recording setup
All components are connected to and controlled by a RPi 3B+/4 microcomputer running Raspbian Buster (https://www.raspberrypi.org) as seen in Figure 1A. All essential parts are listed in Table 1. During each recording, frames are written to an H264 video file while the timestamp of each frame was collected in a separate csv file. RFID antenna (Sparkfun, SEN-11828) and reader (Sparkfun, SEN-09963) output are also recorded in a separate file. Hardware installation is plug-and-play with off-the-shelf electronic components having few restrictions on the rodent arena employed (Movie 1, and Movie 2). The software is modular and customizable to control the data quality at various acquisition rates. A maximum video frame rate of 90 frames per second (fps) can be achieved at a resolution of 640 × 480 using a RPi V1 camera or equivalent (Waveshare, SKU10299). For further information on the possible frame rate and resolution please refer to the official picamera documentation (https://picamera.readthedocs.io/en/release-1.13/index.html#).
Extended Data 1.
PMT online data collection module. Complete software package for online data recording. The package should be installed on a RPi microcomputer. Figure Contributions: Tony Fong wrote, tested the software, analyzed, and created the video. This extended data file supports Figure 1. Download Extended Data 1, ZIP file.
Extended Data 2.
PMT offline data analysis module. Complete software package for offline data analysis. The package was installed and ran in an Anaconda environment (https://www.anaconda.com). Code was tested on a Windows 10 PC (AMD Ryzen 7 5800X; 64 GB; RTX 2080Ti) and Linux (Ubuntu 20.04.2 LTS) PC (Intel i7-7800X; 94 GB; GTX Titan X). Figure Contributions: Tony Fong wrote and tested the software. This extended data file supports Figure 1. Download Extended Data 2, ZIP file.
Extended Data 3.
Assembly and installation instructions. A complete guide on setting up the hardware components and installing the software for PMT. Links to video tutorials and demonstrations can also be found in the guide. Download Extended Data 3, DOCX file
In brief, a Pi-camera is situated above the rodent arena with an unobstructed view. RFID readers are connected to RPi through a self-powered USB hub and placed underneath the arena. The number of RFID tag readers used can be adjusted to arenas of any dimension as long as they are spaced 12 cm apart to minimize RFID interference. Currently, up to nine readers have been tested in a single setup. The RPi board can thermal throttle leading to decreases in performances such as drops in frame rate and RFID readings. Therefore, we recommend installing a supplemental cooling solution (listed in Table 1).
PMT offline analysis pipeline
The PMT offline analysis pipeline runs on a computer capable of CUDA-processing, using Python3.7, managed in an Anaconda environment (https://www.anaconda.com) and has been tested on Windows 10 and Ubuntu 20.04 operating systems. The pipeline contains three components as shown in Figures 1B and 2A: (1) deep-learning-based Yolov4 for mouse detection (Bochkovskiy et al., 2020), (2) modified SORT for mouse tracking (Bewley et al., 2016), and (3) RFID to SORT ID matching for identity assignments.
First, bounding boxes around mice are detected by Yolov4 (Bochkovskiy et al., 2020). All such bounding boxes are then assigned an ID by a modified SORT algorithm, which uses a Kalman filter to predict and track each mouse to preserve the identities. As shown in Figure 2B, two features were added to the SORT algorithm: (1) the Kalman filter predictions for lost tracks and (2) SORT-ID reassociation to enhance tracking performance. The Kalman filter can predict mouse position based on its previous positions, and is useful when tracking by Yolov4 fails, for example, because of visual occlusion or overlapping detections. Similarly, new false positive IDs can be assigned to a previous bounding-box that disappeared. In other words, occasionally, new SORT IDs can be generated for the same mouse, discarding a previously tracked ID. The generation of these new false SORT-IDs is because of the sudden changes in travel trajectories of mice and are difficult to be fully predicted by SORT’s underlying Kalman filter. Regardless, the modified SORT algorithm provides highly accurate tracking of individual animals during clustering scenarios (Movie 3).
In the last stage of PMT offline analysis, the SORT IDs are matched to RFID readings. The general overview of the matching process is illustrated in Figure 2C. RFID reader locations are user defined regions of interest in the video. When a tag is read by an RFID reader, there are four possible scenarios which then, in turn, can lead to three possible outcomes: (1) ID to RFID matching in all previous and future frames, (2) no matching, or (3) matching of future frames and correction of previous frames to a point of occlusion. Both centroid distance and intersection over union (IOU) were used to determine whether an ID detection is in the range of an RFID reader. In the first scenario, the ID has not previously been matched to a tag and therefore, it will be matched with the tag in all previous and future frames. In the second scenario, the ID has already been correctly matched to the tag being read, so no matching would occur. In the third scenario, there is more than one ID (i.e., more than one mouse) in range of the RFID reader. To ensure clean RFID matching, again no matching would occur. In the final scenario, the ID is incorrectly matched to a tag. Therefore, all ID to RFID matches in future frames and previous frames are corrected. Corrections occur up to a point where the ID was in proximity with another, a situation where identity swaps are likely to occur due the use of IOU.
Yolov4 training and weight generation
Weights for Yolov4 detection were trained in its original Darknet (Bochkovskiy et al., 2020) implementation through transfer learning using pretrained weights as the performance has not been fully reproduced on the TensorFlow 2 framework (Hùng, 2021). Trained weights were then converted to Tensorflow weights for the detection to run natively in Python. For the home-cage experiments using dark C57BL/6 black mice, weights were trained using over 2500 random, distinctive images from multiple experiment sessions observing three to four mice for 1–2 h at 25 fps. Similarly, weights for the open-field with six dark C57BL/6 black mice and three-chamber experiments with three FVB/N mice were trained on 300 random, distinctive images recorded at 40 and 60 fps, respectively, for 10 min. During Yolov4 training, training and validation split were set to 80 and 20%, respectively All testing of system reliability were conducted with videos collected independent of training data. A minimum mean average precision (mAP) value >99.5% was achieved on the test dataset for all weights (Extended Data Fig. 3-1).
Extended Data Figure 3-1
Yolov4 Training Loss and mAP. A, Training loss and mAP on home-cage weights using 2500 images with 6000 iterations. B, Training loss and mAP on the open-field arena using 300 images with 6000 iterations. The training was manually stopped when mAP > 99.5%. C, Training loss and mAP on the sociability chamber arena using 300 images with 6000 iterations. The training was manually stopped when mAP > 99.5. Figure Contributions: Tony Fong labeled the images and trained the weights. This extended data figure supports Figure 3. Download Figure 3-1, TIF file.
Extended Data Figure 3-2
Evaluation of PMT performance on the open-field arena with six mice. A, PMT detection Performance was measured by total detection, the appearance of false negative detections, and false positive detections. False positive and false negative detections were expressed as a % of total ground truth mice in videos. B, Tracking performance of PMT was measured by coverage, MOTA, and % errors in detections with RFID matched. Coverage represents % of detections being matched with an RFID tag. A total of two videos were evaluated. Figure Contributions: Tony Fong and Hao Hu analyzed the data. Tony Fong created the figure. This extended data figure supports Figure 3. Download Figure 3-2, TIF file.
Motion detection and trajectory analysis
To identify and segregate keyframes of interest, i.e., frames containing mice with active movements, a simple motion detector is built into the PMT pipeline. Background subtraction against an accumulated average between current and previous frames was used to detect consecutive frames of motion. Specifically, a Gaussian filter was applied to average pixel intensities across a region of 21 × 21. An absolute value between the current frame and the accumulated weights of previous frames was calculated to yield contours representing regions of motion. Specific settings of the motion detector can also be adjusted within the offline tracking pipeline. Travel trajectories are first smoothed using the Ramer–Douglas–Peucker algorithm (ε = 10; Sharmila and Sabarish, 2021) and analyzed using Traja (Shenk et al., 2020) by the input of center coordinates outputted by PMT.
Manual validation of videos
To evaluate the performance of PMT, 10-min videos were recorded at 15 fps at 512 × 400 from the modified home-cage containing one to four animals. Two videos were recorded at 30 fps at 960 × 960 in the open-field arena and one video at 30 fps at 640 × 480 in the three-chamber arena. Videos were then evaluated frame for frame by students for appearances of false positive detections (FP), false negative detections (FN), incorrect ID and RFID matches. In each video, the total number of mice in ground truth (all frames) was calculated by the addition of false negative detections and subtraction of false positive detections found. FP and FN are expressed as a percentage of ground truth mice calculated, whereas incorrect ID and RFID matches are expressed as a percentage of total matches made. To objectively compare PMT to existing object trackers, the Multiple Object Tracking Accuracy (MOTA) index proposed by Bernardin et al. (2006) was used. Specifically, MOTA was calculated by the following equation:
Home-cage recording setup and PMT pipeline line adjustments
To perform 3-d chronic recordings in a home-cage, a shoebox-sized mouse home-cage (19 × 29 × 12.7 cm) was modified to hold a water bottle holder, a housing area, and its connecting tunnel as seen in Figure 3A. For video capture, a single fisheye lens Pi-camera [RPi Camera (I), fisheye lens; SKU:10 703; angle of view: 160°] and IR lights were fitted to the top of the cage. A RFID reader is attached underneath the tunnel leading to the mouse housing area. A custom-cut acrylic sheet is also placed between the Pi camera with its related wirings and the cage main body. A total of 30 ml of pellet bedding and food pellets were distributed on the floor of the main cage. A pellet-type bedding was used for home-cage recording as less clumping would occur and therefore minimize animal RFID tag distance to readers, however other forms of bedding should work, provided it is not too deep; deep bedding would increase the distance from tags to readers. Recordings were done in 12-h intervals and were temporarily interrupted for 15 min every 2 d for cage cleaning. For performance validation, 15 10-min videos were recorded at 25 fps containing one to four mice.
Modifications to the offline tracking pipeline were made so that all matching processes from cage RFID readers stop at a certain distance to the housing area entrance as seen in Figure 3C. The final modification was the use of an entrance RFID reader (underneath the tunnel to the housing area) for ID to RFID matching. The reasons for these modifications are that the entrance will provide scenarios where a new mouse may appear, a tracked mouse may disappear, or both may occur.
Open-field and three chamber recording
Nine RFID readers were placed underneath an open-field (32 × 32 cm) as illustrated in Figure 3B. When recording, the open-field arena was placed in a chamber covered by black-out curtains. Two videos were recorded at a resolution of 960 × 960 under IR light at 40 fps using a regular lens Pi camera for analysis.
For three chamber testing, four RFID readers were placed underneath an arena (20 × 20 cm for each chamber) as illustrated in Figure 3C. Videos were recorded at a resolution of 640 × 480 under natural background lights using a regular lens Pi camera. One 10-min video recorded at 60 fps was used for analysis.
Animals
Male C57BL/6 mice three to four months old (unless indicated) of varied genotypes were used for the behavior recording in the custom home-cage and the open-field arena. We are not reporting the genotype as the experiments were not powered to make comparisons between different animals. Instead, our goal was to evaluate tracking accuracy using surplus animals and will reserve cross-genotype work for future studies. FVB/N mice that were six months old and of varied genotypes were used for behavior recording in the three-chamber arena. Mice were group-housed in a conventional facility in plastic cages similar to the home-cage setup and kept under a normal 12/12 h light/dark cycle (7:00 A.M lights on). All procedures were conducted with approval from the University of British Columbia and in accordance with national guidelines.
RFID capsule implantation
To enable the identification of mice, animals were implanted with glass RFID capsules (Sparkfun, SEN-09416) before recording. RFID capsules were sterilized with ethanol before each implantation. Animals were anesthetized with isoflurane and given buprenorphine via subcutaneous injection (0.05 mg/kg) for analgesia. Betadine was applied to disinfect the incision site and a small incision was made below the nape of the neck or in the lower abdomen, depending on RFID placement. A sterile injector (Fofia, ZS006) was then used to insert the RFID capsule subcutaneously below the nape of the neck or at the abdomen (abdominal will yield better performance). RFID capsules were sterilized with ethanol before each use. Only animals in the three-chamber test received RFID implants through the neck, the rest received abdominal implants. The incision was sutured, and the animal was removed from anesthesia, allowed to recover, and then returned to its home-cage. Animals were closely monitored for a minimum of one week to ensure healthy recovery and proper placement of the RFID capsule postsurgery.
Stroke induction
A photothrombotic occlusion was introduced at a target area between the sensory and motor cortex, stereotactic coordinates (1.5; 0.5) mm from bregma. Mice were first fitted with a chronic transcranial window. In brief, animals were anesthetized with isoflurane (2% in pure O2) and the skin covering the skull was removed and replaced with a cranial window fixed with dental cement. For photothrombotic occlusion, mice were injected intraperitoneally (0.1 ml/10 g body weight) with a photosensitive dye solution Rose Bengal (RB; R3877-5G, Sigma-Aldrich). Two minutes after the injection, a 40-mW diode pump solid-state 532-nm laser attenuated to 11 mW through a polarizer was turned on at the target area to induce focal ischemia. The final beam diameter measures 1.2 mm at full width at half max amplitude. Previous studies show that tissue damage is limited to the targeted area of the green laser irradiation when combined with Rose Bengal administration (Schaffer et al., 2006). Ten-minute behavior recordings of individual mice were performed at 1-h prestroke, 1 d poststroke, and 7 d poststroke in the open field illustrated in Figure 3B. Travel trajectories are first smoothed using the Ramer–Douglas–Peucker algorithm (ε = 10) and analyzed using Traja. The center area of the arena is defined as 0.5*width and 0.5*length around the center of the open-field arena.
Social stimulus test
A test mouse is left in the open-field arena, as described above, with a stimulus mouse cagemate (mouse from the same cage) or a noncagemate (mouse from a different cage) for 10 min. For all trials, the test mouse was first tested with a cagemate and later with a noncagemate with a 20-min gap between trials. As the same mouse within a cage was used as the cagemate mouse, tests with the cagemate first prevented any crossover in odor from a noncagemate mouse. The cage was cleaned with 70% ethanol between trials.
Track pattern difference score is calculated using the dynamic time warping algorithm published by the DTAI Research Group (Shokoohi-Yekta et al., 2017). Both trajectories were z-normalized before dynamic time warping alignment to calculate a track difference score expressed in Euclidean distance. Spatial proximity (SP) is calculated by the average of all minimal distances of each point on a trajectory to the other and is also expressed in Euclidean distance. Distal trajectory pairs were defined as trajectories segments with an SP >300, whereas proximal trajectory pairs were defined as trajectories segments with an SP <300. Track difference pattern score was expressed as an average for each trial per test animal.
Traditional social interaction detection
Social interaction (ITC) was calculated by the sum duration of overlap of enlarged (25% area) bounding boxes of detected mice. An ITC episode was defined as the duration between onset and offset of the overlap between mice bounding boxes. Number of ITC episodes were calculated by the count of ITC episodes and the average duration of ITC episodes were also calculated.
Statistical analysis
Data are all presented as mean ± SEM. Statistical significance was determined using either a multivariate regression analysis (MANOVA) followed by a post hoc univariate ANOVA or repeated measures ANOVA (RM-ANOVA) followed by paired Student’s t tests (with Bonferroni correction) as appropriate using R. The level of significance is denoted on the figures as follows: *p < 0.05, **p < 0.01, and ***p < 0.001.
Code accessibility
The code/software for PMT online recording and offline analysis is available at https://github.com/tf4ong/tracker_rpi and https://github.com/tf4ong/PMT, respectively. The code is also available as Extended Data 1 and 2, respectively. All data are available at the open science framework https://osf.io/78akz/.
A full guide to setup and use the online and offline system can be found in the https://github.com/tf4ong/PMT page and as Extended Data 3. Video tutorials and demonstrations can be found at the following link https://youtube.com/playlist?list=PLmcjDqLt_Xk6AAlll3ztvgNI9P3yQxPc2.
Custom home-cage parts
All related CAD files can be found at our GitHub: https://github.com/tf4ong/PMT.
3D-printed parts (black PLA)
RFID_reader_base.stl
Nest_tunnel.stl
Nest_body.stl
Nest_lid.stl
Camera_LED_mount.stl
Cage_Lid.stl
Data availability
All data will be uploaded to the OSF data repository: https://osf.io/78akz/.
Results
PMT detection and tracking performance in home-cage
In Materials and Methods, we describe the setup and implementation of PMT for both standard “shoebox-sized” mouse cages and more complex arenas (Fig. 3). To evaluate PMT’s performance, one to four mice were placed in the modified home-cage for 10 min recordings at 15 frames per second (Fig. 4). Results were compared with manual human frame-by-frame validation. Figure 4A shows the detection reliability of the pipeline. Both the FP and FN detections remain extremely low in all 14 videos analyzed, never exceeding 3% of the total number of mice in manually labeled ground truth. On average, the FP rate were 0, 4.3, 10.5, and 19.9 per minute for videos containing one to four animals, respectively. Whereas, FN rate were 1.7, 20, 22.1, and 3.6 per minute. In regard to tracking, performance was mainly evaluated by coverage, MOTA value, and identity error rate as seen in Figure 4B. Coverage is represented as the percentage of mice detected that are matched with an RFID tag and remained above 90% in most videos analyzed. Specifically, the average coverage for one to four animals was 100.0, 97.9, 96.2, and 91.8%, respectively. Among the detections matched with an RFID tag, the identity error rate, i.e., the percent of detections with incorrectly matched RFID tags, was on average 0, 4, 1, and 4% of all matched detections in videos of one to four animals. Each 10-min video would contain on average 6 episodes where detections were matched with an incorrect RFID tag (∼45 frames in length). In our validation set, the minimal value achieved for detection coverage and identity accuracy were 88% and 85%, respectively.
The Multiple Object Tracking Accuracy (MOTA) index proposed by Bernardin et al. (2006) is currently one of the main metrics for determining the effectiveness of a multiple object trackers (de Chaumont et al., 2019; Lauer et al., 2022). MOTA evaluates a tracker’s overall performance by calculating metrics which represent errors in both detection and tracking including false positive/negative detections and identity mismatches, respectively. Therefore, a tracker with no false positive/negative detection and no identity tracking would yield a MOTA value of 1. In the current study, the average MOTA value for videos containing one, two, three, and four animals were calculated to be 0.998, 0.945, 0.973, and 0.949, respectively. As a point of reference, the MOTA values for live mouse tracker (LMT; de Chaumont et al., 2019) on videos with one, two, three, and four animals are 0.993, 0.991, 0.984, and 0.970, respectively. However, LMT only used one video to conduct MOTA calculations. Sample images and travel trajectories of mice can be observed in Figure 4C and in Movie 4, 5, 6, 7.
PMT detection and tracking performance in open-field and three chamber arena
To evaluate the scalability and customizability of the PMT tracker, additional behavior recordings were performed in an open field arena with dark C57BL/6 black mice and in a three-chamber sociability arena with lighter coat color FVB/N mice. In total, two videos were analyzed to evaluate the performance of PMT in an open field arena in a similar fashion illustrated in Figure 3B. In the two videos, FP and FN detections remained under 1% of total mice in ground truth (Extended Data Fig. 3-2; Movie 8). In these larger arenas, virtually all detections can be matched with an RFID tag, with an average coverage of 99.99% between the two videos. Moreover, MOTA values were also very high in the two videos averaging at 0.97. Surprisingly, PMT achieved a very low identity error rate with that of both videos being <4%.
For the three-chamber arena, performance was similar as in the open-field arena. After retraining Yolov4 on white coat color mice detection, FN and FP were 0.03 and 0.14% respectively. MOTA index value was 0.965 and the identity error rate was 3.33% of all RFID matched detections. Sample illustrations of PMT tracking in a three-chamber arena can be observed in Figure 3C and in Movie 9 based on a single video example.
Stroke induced changes in open-field behavior
A total of four mice were recorded and used for analysis to pilot whether PMT can resolve measurable changes because of stroke induction. Figure 5A illustrates a sample travel trajectory of a mouse prestroke, 1 d poststroke, and 7 d poststroke to the sensory-motor cortex. Consistent with the literature, stroke acutely induces motor impairments in mice observable in the open field (Bains et al., 2016). Turn angle distributions of prestroke versus 1 d after stroke showed a consistent pattern of decreased number of sharp angle turns (<45°) as shown in Figure 5B. Further analysis revealed statistically significant changes in mean speed (df = 2, F = 8.018, p < 0.05) and number of sharp angle turns (df = 2; F = 10.16, p < 0.05) between prestroke and 1 d poststroke. as shown in Figure 5C. Surprisingly, no difference was found between distance traveled between prestroke to post 1 or 7 d after stroke. Duration spent in center (df = 2, F = 11.13, p < 0.01) was also different between prestroke and 1 d poststroke in animals.
Extended Data Figure 5-1
Open-field travel trajectories of mice prestroke, post 1 and 7 d after stroke. Ten-minute open-field recording 24 h before stroke (green), 1 d poststroke (red), and 7 d poststroke (blue). Trajectories were smoother using Ramer–Douglas–Peucker algorithm (ε = 10). Figure Contributions: Tony Fong and Pankaj Gupta analyzed the data. Tony Fong created the figure. This extended data figure supports Figure 5. Download Figure 5-1, TIF file.
Chronic tracking in custom home-cage
A total of four cages each containing three mice were recorded. The effects of day/night cycle (lights on and lights off) on dependent outcomes such as distance traveled, active duration, average speed, wide angle turn count, sharp angle turn count, and average acceleration along with anxiety measures such as duration spent in the center, interacting with one or two mice were determined using an MANOVA (Seibenhener and Wooten, 2015). As expected, mouse activity levels follow a reverse circadian rhythm (Ananthasubramaniam and Meijer, 2020). Specifically, animals show higher levels of motor measures such as distance traveled (p < 0.001; effect size = 0.79), active duration (detected by the underlying motion detector; p < 0.001, effect size = 0.54), average speed (p < 0.01; effect size = 0.51), number of wide (>90°; p < 0.001; effect size = 0.62), and sharp (<90°; p < 0.001; effect size = 0.79) angle turns during periods of lights off as opposed to periods of lights on as shown in Figure 6A. However, no changes were observed in traditional anxiety related parameters such as duration spent in the center area, interacting with one or two mice as seen in Figure 6B.
Social stimulus test
An advantage of PMT is the ability to track multiple animals simultaneously and in doing so can provide a report of potential social interactions. Analysis of mouse interactions could be important for assessing phenotypes related to mouse models of autism. Accordingly, we have evaluated tracks of multiple interacting mice to provide a method to approach these questions. Track pattern difference score, as its name implies, represents the similarity in pattern of the segmented pairs of travel trajectories regardless of length and spatial location. The larger the score would indicate a more dissimilarity in overall pattern between the trajectories. Therefore, comparison of identical trajectories would yield a value of 0. Spatial proximity is a measure of the distance/proximity between two trajectories; the lower the values, the closer the tracks are. Figure 7B,C illustrates sample trajectory comparisons of a single test mouse against a noncagemate and a cagemate, respectively. During the 10 min of recording, track pattern difference scores (p < 0.05), total ITC duration (p < 0.001), and number of ITC episodes (p < 0.05) were found to be statistically significant whereas average duration per ITC was not (p > 0.05) as seen in Figure 7C. For comparison to the more common 5 min of video recording used in the literature, the first 5 min was also separately analyzed as seen in Figure 7D, which resulted in similar results. Interestingly, the track pattern difference score is only statistically significant (p < 0.05) when comparing proximal segment pairs (SP < 300, proximal are potentially more similar) and not distal segment pairs (SP > 300) as shown in Figure 7F, segment pair comparison of an illustrative test animal to a cagemate and noncagemate stimulus animal.
Discussion
Most automated animal assessment tools, while desirable, remain difficult to access for the broader neuroscience community because of costs, setup time, and ease of use. As of writing, live mouse tracker (LMT) is the only open-source RFID and video tracking system available (de Chaumont et al., 2019). PMT offers some advantages over LMT: (1) affordability, (2) scalability, (3) ease of setup/use, and (4) customizability. A PMT recording system with 6 RFID readers costs ∼520 USD. Affordability combined with PMT’s small footprint would enable investigators to implement and use at larger scales, for example, monitoring racks of mice in an animal facility. Most importantly, the key distinction of PMT is the ability to be customized for tracking different rodents (varied coat color or species) in varied housing environments. As more in-depth questions are asked, the complexity of experimental designs have also increased (Basso et al., 2021; Slivkoff and Gallant, 2021). Investigators need readily adaptable tools for their experiments involving rodents of different coat colors in different environments. As shown, PMT can be adapted to record and track mice in a variety of environments, other than our home-cage configuration. Most importantly, PMT can be retrained to recognize mice of different coat colors against different backgrounds. For more details on when and how to retrain, please to our documentation guide (Extended Data 1, 2, 3). At the same time, PMT tracking accuracy of darker coat-color mice is lower to that shown previously (de Chaumont et al., 2019) and currently unable to perform real-time tracking in exchange for the benefits mentioned above. Indeed, LMT can also further extrapolate postures and types of social interaction behaviors using depth information using depth sensing cameras (de Chaumont et al., 2019). However, PMT also has the capability to incorporate output of posture estimation from multianimal DeepLabCut (Lauer et al., 2022), which may enable similar features in the future (Fig. 8; Movie 10).
Differences in PMT tracking performance were observed between our custom home-cage and open arena settings. The differences observed were likely related to two factors: bedding and the existence of an entrance area. In the home-cage, bedding acted as a physical barrier increasing the distance between the RFID tags and RFID readers, in turn, decreasing the likelihood of an RFID tag being read. Given that bedding tends to clump (as with the common aspen wood shavings), this can further exacerbate reader range error from our experience. When using a home-cage setting similar to ours, we recommend a pellet type bedding which is less likely to clump and easier to shift around. Regarding the entrance area, it can pose a source of false negatives, false positives, and identity errors, as it provides a space for mice to cluster and can complicate detection when mice enter or exit the cage with new IDs. As evident, better performance of tracking were observed in the open-field and three-chamber arena. Therefore, when using PMT to design their own experimental paradigms, investigators should take these two factors into account.
PMT has not only demonstrated capabilities to chronically track multiple mice, but also detect underlying animal phenotypes (stroke). Consistent with other studies, chronic recordings in the modified home-cage revealed diurnal locomotor activity patterns in mice (Wang et al., 2019; Ananthasubramaniam and Meijer, 2020). In an open-field arena, mice showed locomotor deficits immediately after stroke induction similar to other studies (Shenk et al., 2020; Shvedova et al., 2021). Similar to previous studies (Vahid-Ansari et al., 2016; Larpthaveesarp et al., 2021), stroke induced anxiety phenotype was also observed in mice as shown by less time spent in the center zone of the open-field. Interestingly, mice made a lower number of sharp angle turns (<90°) after stroke. A possible explanation for this is that high motor coordination between limbs is required to make precise turn angles. However, motor coordination is impaired because of stroke (Pollak et al., 2012; Wang et al., 2019), which lead to unsuccessful sharp angle turn attempts. Further validation of turn angle parameters may yield an assessor of motor coordination in open-field paradigms.
Social function deficits are key symptoms in many psychiatric disorders including autism, depression, and schizophrenia (Benekareddy et al., 2018; Fujikawa et al., 2022). Currently, the most widely used test in rodents is the three-chamber sociability and social preference assay (Golden et al., 2011; Kim et al., 2019).The main outcome of interest is the duration spent by the subject mouse in a chamber containing a stranger (noncagemate) mouse compared with that in a chamber of a familiar (cagemate) mouse, both of which are confined by a wired cage. In general, mice would have a higher preference in investigating a stranger mouse compared with a familiar mouse as measured by the duration spent together and number of approaches (Golden et al., 2011; Kim et al., 2019; Beery and Shambaugh, 2021). However, mouse social interactions are complex and affected by the states of both participating parties presenting the possibility that confinement of a mouse may risk reducing ecological validity. PMT would allow the investigation of social preference in freely moving mice pairs. Indeed, mice still tend to have an increased duration of total interaction time and number of interactions with a stranger mouse compared with a familiar mouse. Moreover, we applied dynamic time warping, a method common in travel trajectory pattern comparisons (Brankovic et al., 2020), to compare similarities of trajectory patterns of a subject animal to that of a stranger or familiar mouse. Interestingly, it was found that travel trajectories of noncagemate pairs tend to be similar when in proximity compared with that of cagemate pairs. Therefore, the comparison of travel trajectory patterns may offer a novel method in determining sociability of mice pairs that could provide an adjunct to the 3-chamber sociability test.
Overall, we have demonstrated the effectiveness of the PMT for tracking visually different rodents in a range of experimental settings and have shown the system’s ability to detect pathologic changes in motor kinetics induced by stroke. We hope that this tool can enable the use of more complex experimental paradigms. In our online repository and guide, we provide detailed instructions to setup and use PMT’s online data collection and offline analysis software. In the future, we hope to further improve PMT based on the community’s feedback.
Acknowledgments
Acknowledgments: We thank Pumin Wang and Cindy Jiang for surgical assistance and Jeffrey M. LeDue for technical assistance.
Footnotes
The authors declare no competing financial interests.
This work was supported by the Canadian Institutes of Health Research (CIHR) Foundation Grant FDN-143209 (to T.H.M.) and the University of British Columbia (UBC) Institute of Mental Health Marshall Scholars and Fellowship Program. T.H.M. was also supported by the Brain Canada Neurophotonics Platform, a Heart and Stroke Foundation of Canada grant in aid, the National Science and Engineering Council of Canada (NSERC) Grant GPIN-2022-03723, and a Leducq Foundation grant. This work was supported by resources made available through the Dynamic Brain Circuits cluster and the NeuroImaging and NeuroComputation Centre at the UBC Djavad Mowafaghian Centre for Brain Health (RRID SCR_019086) and made use of the DataBinge forum.
This is an open-access article distributed under the terms of the Creative Commons Attribution 4.0 International license, which permits unrestricted use, distribution and reproduction in any medium provided that the original work is properly attributed.