IN
DEGREE PROJECT MEDICAL ENGINEERING, SECOND CYCLE, 30 CREDITS
STOCKHOLM SWEDEN 2020 ,
Analysis of Mouse Whisker Movement Synchronicity
JOHANNA ELISABETH DE VOOGEL
KTH ROYAL INSTITUTE OF TECHNOLOGY
SCHOOL OF ENGINEERING SCIENCES IN CHEMISTRY,
BIOTECHNOLOGY AND HEALTH
Analysis of Mouse Whisker Movement Synchronicity
JOHANNA ELISABETH DE VOOGEL
Master in Medical Engineering Date: March 10, 2020
Supervisor: Arvind Kumar & Gilad Silberberg Examiner: Madelen Fahlstedt
School of Engineering Sciences
in Chemistry, Biotechnology and Health
Swedish title: Analys av musens synkroniserade rörelse av
morrhåren
iii
Abstract
In active sensing, sensory organs are actively controlled by the motor system to optimize stimuli acquisition. Coupling behaviour of animal models with electrophysiological signals could give us important insights in the workings of this active sensing in health and disease. In this work, a contribution is made towards this aim. A modern machine learning method, called DeepLab- Cut, is evaluated and optimized for the use of tracking whiskers from videos of head-fixed, free whisking mice from two groups. Novel to the approach is the longer observation of the mice, without markers or trimming. This track- ing is then used to investigate the natural statistics of whisking in healthy and Parkinsons Disease (PD) modeled animals. Two groups of mice (6 healthy versus 4 PD) were filmed for 5 minutes on 1-3 days per animal during head- fixed free air whisking, resulting in 21 filmed days in total. 6 Whiskers were tracked with 4 points per whisker using DeepLabCut and as few as 105 man- ually labeled images. A tracking accuracy of <3 pixels training error and <
15 pixels test error was achieved. Qualitatively, tracking errors occurred both along and perpendicular to the whisker, but the perpendicular error reduced after 30 Hz low-pass filtering. The observed whisking was non-stationary and predominantly slow (<10 Hz). Whisking was also synchronized in time, as the cross-spectra were significantly higher than the random shuffled cross-values (p KS <0.05), but this synchronicity was lost on the right side in lesion ani- mals with whisking frequencies between 15 and 25 Hz. In this PD-modeled group, a difference between left and right side co-synchronization was found (J SD=0.067, p KS <0.05) for higher frequencies (15-25 Hz). In total, con- trol animals where whisking 34.1% of the time versus 35.6% for the lesion animals. Upon examining these active bouts, it was found that lesion animals have relatively more long bouts of co-activation than healthy controls across all subgroups (p KS <0.001). Furthermore, in lesion animals the activity dis- tributions are laterally different (LL vs RR, J SD=0.178, p KS <0.001), but this cannot be concluded for healthy controls. Thus, it can be concluded that DeepLabCut is a promising method to speed up whisker tracking. Future im- provements could be made in sharpness and contrast of the tips of the whiskers;
incorporating information on the relation of whisker position in time; extend-
ing the tracking to 3D; and evaluating tracking by means of biomechanical
models. These improvements will enable observation in a more realistic en-
vironment, and for a longer time. Finally, coupling of whisker position data
to electrophysiological recordings will hopefully result in new insights in the
relation between sensorimotor behaviour and global brain dynamics.
v
Sammanfattning
Vid ’active sensing’ styrs sinnesorgan aktivt av motorsystemet för att optimera insamling av stimuli. Koppling av djurmodeller med elektrofysiologiska sig- naler skulle kunna ge oss viktig insikt i funktionen av denna ’active sensing’ i hälsa och sjukdom. I detta arbete görs ett bidrag till detta mål. En modern ma- skininlärningsmetod, kallad DeepLabCut, utvärderades och optimerades för användning av spårning av morrhår från videor där möss i två grupper hade huvudet fixerat men morrhåren kunde rör sig fritt. Nytt för denna metod är den längre observationen av mössen utan märkning eller hårklippning. Denna spårning användes sedan för att undersöka den naturliga statistiken över morr- hårens rörelse i kontrollgruppen och gruppen med Parkinsons sjukdom (PD).
Två grupper av möss (6 kontroll mot 4 PD) filmades i 5 minuter på 1-3 dagar per djur där huvudet var fixerat men morrhåren kunde röra sig fritt, vilket re- sulterade i totalt 21 filmade dagar. Sex morrhår spårades med 4 punkter per hår med hjälp av DeepLabCut med så få som 105 manuellt märkta bilder. En spår- ningsnoggrannhet med träningsfel på <3 pixlar och testfel på <15 pixlar upp- nåddes. Kvalitativt inträffade spårningsfel både längs med och vinkelrätt mot morrhåret, men det vinkelräta felet minskade efter 30 Hz lågpassfiltrering. Den observerade rörelsen av morrhåret var föränderlig och övervägande långsam (<10 Hz). Rörelsen av morrhåren synkroniserades också i tid, eftersom kors- spektra var signifikant högre än de blandade korsvärdena (p KS <0, 05), men denna synkronitet förlorades på höger sida i PD djur med frekvenser mellan 15 och 25 Hz. I denna PD grupp hittades en skillnad mellan vänster och höger sida i samsynkronisering (J SD=0, 067, p KS <0, 05) för högre frekvenser (15- 25 Hz). Kontrollgruppen rörde på morrhåren i totalt 34,1 % av tiden mot 35,6
% för PD gruppen. Inom denna aktiva period visade det sig att PD djur hade relativt mer långa perioder av samaktivering än kontrolldjur i alla delgrupper (p KS <0.001). Dessutom var aktivitetsfördelning laterallt olika i PD gruppen (LL vs RR, J SD=0, 178, p KS <0, 001), men detta kunde inte påvisas i kon- trollgruppen. Således kan man dra slutsatsen att DeepLabCut är en lovande metod för att påskynda spårning av rörelse av morrhår. Framtida förbättringar skulle kunna göras med förbättrad skärpa och kontrast av morrhårens ändar;
innehålla information om morrhårens postion relativt till varandra över tid; ut-
vidga spårningen till 3D; och utvärdera spårning med hjälp av biomekaniska
modeller. Dessa förbättringar möjliggör observation i en mer realistisk miljö
och under en längre tid. Slutligen kommer koppling av morrhårspositionens
data till elektrofysiologiska inspelningar förhoppningsvis att resultera i ny in-
sikt i förhållandet mellan sensorimotoriskt beteende och global hjärndynamik.
Contents
Abstract iii
Sammanfattning v
List of Figures ix
List of Tables xiii
Acknowledgements xiv
1 Introduction 1
1.1 Problem description and problem statement . . . . 2
1.2 The importance of studying whisking behaviour . . . . 3
1.3 Target readers and report structure . . . . 3
2 Methods 4 2.1 Whisking data . . . . 4
Experimental model and subject details . . . . 4
Video specifications . . . . 5
2.2 Whisker tracking with DeepLabCut . . . . 5
2.3 Analysis of synchronicity . . . . 7
Angle computation . . . . 7
Spectral cross-correlation . . . . 8
Activity . . . . 9
Activity duration comparison . . . 10
3 Results 11 3.1 Whisker tracking evaluation . . . 11
3.2 Healthy behaviour . . . 15
Frequency analysis . . . 16
vi
CONTENTS vii
Spectral cross-products . . . 16
3.3 Comparison of lesion animals versus controls . . . 20
Activity and co-activity . . . 21
4 Discussion 24 4.1 Interpretation of the work . . . 24
4.2 Conclusions . . . 26
4.3 Future work . . . 26
Bibliography 28 A State of the Art 31 A.1 Introduction to the background . . . 31
A.2 Whisker anatomy . . . 31
Location . . . 31
Musculature . . . 32
Geometry . . . 34
Afference . . . 34
Efference . . . 34
A.3 Whisker function . . . 35
A.4 Behaviour and dynamics terminology . . . 36
Whisking cycle . . . 36
Whisking modes . . . 37
Angle definition . . . 37
Asymmetry in whisking . . . 38
Biomechanical models . . . 39
A.5 Tracking methods comparison . . . 41
Current whisker tracking methods . . . 41
Common challenges and method design choices . . . 41
The argument for DeepLabCut . . . 42
List of Figures
2.1 Set-up of the experiment. Mice were head-fixed with a clip in a tube, and filmed from a distance of approximately 30 cm on a white background surface. . . . . 6 2.2 DeepLabCut workflow adapted from Mathis et al. [13] . . . . 7 2.3 Schematic of angle computation, with manual labels (+), fit-
ted whiskers (black lines), base vectors of the left side (blue arrows) and right side (red arrows). The resulting azimuthal angle is displayed in green. . . . 8 2.4 Activity segmentation process. From top to bottom: com-
puted azimuthal angle (θ) time series after filtering (black);
normalized signal (black) and threshold (blue) at 1.2; thresh- olded signal convolved with an exponential kernel (black) and threshold (red) at 0.03; original time series (black) with the resulting segmented active periods (green). . . . . 9 3.1 Loss-convergence of the two training networks. Finding the
best network is an optimization problem, and corresponds to minimizing the loss-function. . . 12 3.2 The 3 test images from the control animals. Manual labels
are marked with a cross (+), predicted labels with a dot (.) in the following colors: L1 (blue), L2 (cyan), L3 (green), R1 (yellow), R2 (orange) and R3 (red). Eyes and nose are marked in dark blue. . . . 13 3.3 The 3 test images from the lesion animals. Manual labels are
marked with a cross (+), predicted labels with a dot (.) in the following colors: L1 (blue), L2 (cyan), L3 (green), R1 (yellow), R2 (orange) and R3 (red). Eyes and nose are marked in dark blue. . . 14
ix
x LIST OF FIGURES
3.4 Position coordinates in pixels for 4 points of whisker L2 (left- central) in a healthy animal. P1-P4 are the traces for the pre- dicted proximal to distal whisker points. The x-coordinates (light blue), y-coordinates(dark blue), and segmented activa- tion (green) are shown. . . 15 3.5 Computed azimuthal angle traces (black) for all 6 tracked whiskers
in a healthy animal, low-pass filtered at 30 Hz. Active whisk- ing bouts are highlighted in green. Only a short subset (15 seconds) of the entire video is shown. . . . 16 3.6 Angle series displayed on top of the power spectral density
for frequencies <30 Hz. Frequency resolution of 1 Hz, time windows of 1 second without overlap. The same 15 seconds for the healthy animal are used. . . 17 3.7 Cross-product for a healthy animal (blue) and a lesion animal
(red), computed by summing the products of corresponding time-windows of the spectrograms for every frequency band.
The diagonal is the auto-cross-product. The mean of the shuf- fled cross-spectra ± 1 standard deviation are shaded in blue (control) and red (PD). . . 17 3.8 Control group average cross-products for frequencies <30 Hz,
grouped in seven subgroups. Shaded bands are the mean shuf- fled values ± 1 standard deviation. . . 19 3.9 Lesion group average cross-products for frequencies <30 Hz,
grouped in seven subgroups. Shaded bands are the mean shuf- fled values ± 1 standard deviation. . . 19 3.10 Right-side (RR: R1R2, R1R3, R2R3) average cross-products
for frequencies <30 Hz for control and lesion animals. Shaded bands are the mean shuffled values ± 1 standard deviation over the lesion and control group. Individual animals are shown with dots. . . 20 3.11 Cumulative distribution (cdf, shaded) and probability distri-
bution (pdf, line) of active whisking bouts duration. Individ- ual control animals (blue, dashed) are compared with individ- ual lesion animals (red, dashed), as well as the average of the groups (solid lines). . . . 22 3.12 Cumulative distribution (cdf) and probability distribution (pdf)
of active whisking bouts duration for control and lesion ani-
mals, grouped in 7 subgroups. . . 23
LIST OF FIGURES xi
A.1 Principles for mystacial pad architecture. Reprinted from Brecht, Preilowski, and Merzenich [1] with permission . . . 31 A.2 Whisker anatomy . . . 33 A.3 Average whisker shaft angle during the triphasic whisking cy-
cle. Reprinted from Hill et al. [9]. . . . 36
A.4 Angle definitions . . . 37
List of Tables
2.1 Data acquisition overview. Filmed days are marked with an X. 5 2.2 Grouping for activity duration. L=left, R=right, X=cross-wise,
1=caudal, 2=central, 3=rostral . . . 10 3.1 Average Euclidean error between manual labels and predicted
labels in pixels, computed over n frames. . . 12 A.1 Comparison of whisker tracking methods. Adapted from Perkon
et al. [24] and Nashaat et al. [25]. . . 40
xiii
Acknowledgements
For this project, I would like to thank the following people. To start, of course, I want to thank my supervisor Arvind Kumar for his helpful advice and ex- planations on the computational side of the project, and Gilad Silberberg for the physiological interpretations. Also, the people at Karolinska Institutet and SciLifeLab have been of important value. I want to thank Roberto specifically, for filming the mice and helping with the data acquisition, and Johanna, for the pointers in the literature. Next, I would like to thank Athira for helping me to get started with DeepLabCut and to explain the cluster computing, and the people at HPC2N for helping me with any further questions I had. Further- more, the group supervision meetings with Xiaogai, Geraldine, Mathilde and Nicole have helped me in the process of writing my master thesis. Lastly, but not least, I want to thank my parents, my sisters, and Sven, for their emotional support.
xiv
Chapter 1 Introduction
How do we understand the world around us? What active strategies do we use to gather information, which our brain can then interpret? In active sensing, sensory organs are actively controlled by the motor system to optimize stimuli acquisition. Therefore we need to understand the sensorimotor system. A first step to this understanding, is to find how the sensory organs are operated and to find the differences in behaviour of sensorimotor systems in health and disease.
For example, one could study Parkinson’s disease (PD). PD is a nervous system disorder with motor symptoms such as tremor, rigidity and bradykine- sia. The prevalence of PD is estimated to be 100 to 200 per 100,000 people worldwide [1], and 196 per 100,000 inhabitants of Stockholm [2]. The aging population will only lead to more patients with PD.
Coupling behaviour of animal models with electrophysiological signals could give us important insights in the workings of active sensing [3]. Mice actively use whiskers, tactile hair organs, to gather information about their surroundings.
Mice have several rows of whiskers which differ in shape and length ac- cording to their position [4]. Each whisker is wrapped by an intrinsic mus- cle, and the mystacial pad on which the whiskers are situated is moved by a set of extrinsic muscles [5]. Whisking emerges through triphasic rhythmic protraction (forward motion) and retraction (backward motion) [6]. Whiskers have no spindles, but instead mechanoreceptors on follicles could transduce information about position [7]. One hypothesis is that the angular position of the whisker encodes the contact with a surface. Frequency and amplitude of the whisking differentiate several modes of whisking. In foveal whisking, the hairs move in low amplitude cycles with a frequency of 15-25 Hz. Ex-
1
2 CHAPTER 1. INTRODUCTION
ploratory whisking is characterized by large amplitude, low frequency (5-15 Hz) sweeps [8]. Terms that describe asymmetry of whisking are for example
‘contact induced asymmetry’, ‘head-turning asymmetry’, ‘rapid cessation of protraction’, and ‘angular separation’ [9].
1.1 Problem description and problem state- ment
The aim of this study was twofold: to track whiskers from videos in head- fixed, free whisking mice from two groups, without markers or trimming; and to investigate the natural statistics of whisking in healthy and PD animals.
First, the whiskers need to be tracked in enough detail. Thus far, this tracking has been problematic for multiple reasons. One reason is that, since whisking is fast, high-speed video is required, which has only become available recently.
Another reason is that whiskers are very thin and thus require high resolution images. These two combined create the further problem of big size of data, and could explain why previous work has focused on short whisking videos.
Lighting conditions can cause unwanted shadows on the background which are hard to distinguish from the whiskers. Furthermore, the different rows of whiskers often cross, overlap or move out of focus. Attempts to overcome these problems are trimming or labeling the whiskers, but they are sub-optimal as they might change the behaviour of mice and movement of all whiskers together [10]. However, the biggest limitation in tracking whiskers has been that manually tracking whiskers is very time-consuming. Recently, methods have been developed to make tracking (semi)-automatic, with varying results [11, 12]. DeepLabCut is such a machine learning method to track animal behaviour [13, 14]. The novelty of this work lies in the application of this method specifically to mouse whisker tracking, in more natural circumstances like untrimmed free-whisking for a longer time.
Furthermore, because tracking of the whiskers has been problematic, a thorough review of whisking behaviour in freely moving mice during a longer period is still lacking. To the best of my knowledge, no research is published on the difference in whisking behaviour in PD.
The goal of this thesis was to track and analyze untrimmed and unmarked
whisking, using only videos. Thus, an existing tracking method called DeepLab-
Cut was evaluated for the specific use of mouse whisker tracking. A second
goal was to measure synchronicity between whiskers and compare this syn-
chronicity in whisking behaviour between healthy and PD-modeled mice.
CHAPTER 1. INTRODUCTION 3
1.2 The importance of studying whisking be- haviour
Studying the sensorimotor system helps to understand how we gather infor- mation about the world, and more specifically how we recognize objects. Fur- thermore, we need insights in behaviour under PD to understand the disease and thus to help to improve the quality of life of patients.
The rationale for studying the mouse whisker behaviour is as follows. The whisker system is a well-known sensorimotor system, that has been studied ex- tensively. In particular, the output behaviour, whisking, is directly observable.
However, a detailed description of whisking behaviour is still missing (owing to the previously described problems). Just like humans use their fingers to probe an object, mice can actively use their whiskers to locate themselves, de- tect objects, and differentiate surfaces. Similar mechanisms might be in place during active surface exploration [15], and tactile object localization [16]. It is therefore expected that the whisking system is comparable to active sens- ing in humans and thus makes a suitable model. Furthermore, the human PD condition can be modeled by inducing a lesion in mice, through injection of 6-hydroxydopamine (6OHDA) resulting in dopamine-depletion [17]. This allows for certain experiments that would have been impossible in humans.
Moreover, longer observations in an experimental setting are possible.
1.3 Target readers and report structure
This report was written for a master’s degree of 30 ECTS in medical engi- neering. The purpose of this work was to improve tracking of whiskers us- ing videos, and to characterize whisking behaviour statistics in healthy and diseased mice. Thus, it is largely intended for medical engineering students.
However, it could also be useful to researchers in the field of neuroscience, machine learning, computational ethology, and of course to anyone studying whisking behaviour directly.
The report is structured as follows. By now, some key definitions and back-
grounds are introduced. A more extensive review of the State-of-the-Art can
be found in Appendix A. In the next section, the methods for filming, tracking
and analysing whisking are explained. The results are split into a first part
for the accuracy of the tracking, a second part for healthy whisking behaviour
and a third part for the comparison of whisking behaviour for healthy versus
lesioned mice.
Chapter 2 Methods
2.1 Whisking data
Experimental model and subject details
For the PD model, the procedure of Ketzef et al. [17] was used: All experi- ments were performed according to the guidelines of the Stockholm municipal committee for animal experiments under an ethical permit to Gilad Silberberg (N12/15). A D1-Cre (EY262 line) mouse line was crossed with the Channel- rhodopsin (ChR2)-YFP reporter mouse line (Ai32, the Jackson laboratory) to induce expression of ChR2 in either dMSNs or iMSNs. Female mice were housed under a 12 hr light-dark cycle with food and water ad libitum. All experiments were carried out during the light phase.
Mice (4 females, 8-10 weeks of age) were anesthetized with isoflurane and mounted in a stereotaxic frame (David Kopf Instruments, Tujunga, California).
Mice received one unilateral injection of 1 ml of 6OHDA-HCl (3.75 mg/ml dissolved in 0.02% ascorbic acid) into the medial forebrain bundle, accord- ing to the following coordinates (in mm) [18]: antero-posterior -1.2, medio- lateral +1.2 and dorso-ventral -4.8. Only 6OHDA-injected mice that showed rotational behavior [19] were used in the experiments. Unlesioned mice (6 females, 8-10 weeks of age) were used as a healthy control group.
The 6 healthy and 4 lesion animals were filmed over several days. An overview of the filmed days can be found in Table 2.1. A clip was mounted to each animal for head-fixing, but no whiskers were trimmed or marked.
4
CHAPTER 2. METHODS 5
Table 2.1: Data acquisition overview. Filmed days are marked with an X.
Animal / Day 1 2 3 4 5 Lesion
1 x x
2 x x x
3 x x x
4 x x
Control
1 x x
2 x
3 x x
4 x
5 x x x
6 x x
Video specifications
All mice were free-whisking, meaning that the whiskers were not obstructed by any object. To approximate natural behaviour, the animals were not stim- ulated to whisk, as is commonly achieved by for example air-puffs or object localization tasks in return for rewards. The camera was placed overhead, and whisker movements in the horizontal plane were recorded with a resolution of 896 x 432 pixels at a distance of approximately 30 cm. The set-up is shown in Figure 2.1. For each day, 5 videos of 1-minute duration were filmed consecu- tively, with 50, 200 and 400 fr/sec. For the final analysis, 400 fr/sec was used because whiskers were least blurred wit this frame rate. After experimenting with different lighting conditions, white light was chosen over infrared light as it resulted in the best contrast and visibility of the individual top-row whiskers.
2.2 Whisker tracking with DeepLabCut
For the tracking of the whiskers, DeepLabCut/2.0.4-Python-3.6.6 was used [14] [13], [20]. This is an algorithm which uses a pretrained pose-estimation network, to train a deep neural network to track features, using only limited training data.
The pipeline of DeepLabCut, adapted to this research, is shown in Figure
2.2. To create a training and test set, 6 whiskers were labeled once manually
6 CHAPTER 2. METHODS
Figure 2.1: Set-up of the experiment. Mice were head-fixed with a clip in a tube, and filmed from a distance of approximately 30 cm on a white back- ground surface.
with 4 points on each whisker. The tracked whiskers were chosen by their size,
horizontal orientation and visibility, and attempted to be the same across dif-
ferent animals and different filming days. Furthermore, the nose and eyes were
labeled for the angle computation (see next section). 5 Dissimilar frames were
selected with K-means from the first 6 seconds of every video and consecu-
tively labeled for each day for each mouse, leading to a total of 50 manually
labeled frames for the lesion animals, and 55 manually labeled frames for the
control animals. An example of the labeled frames is shown in Figure 2.3. The
network was trained with ResNet50 for 200000 iterations, using 47 and 52 of
the labeled images for lesion animals and control animals, respectively. The
average Euclidean error was computed by comparing the predicted labels with
the manual labels for 3 test images. Finally, all videos were analysed using the
newly trained network. Consequently, the output x- and y-coordinates for each
label were merged across the five 1-minute videos per day per animal, to be
used for further analysis.
CHAPTER 2. METHODS 7
dlc-models Directory
created
File created
Process Create project
Extract frames
Label frames (GUI)
videos labeled-data
training-datasets
config.yaml
Create training datasets
Train network
Evaluate network
No
Yes
Good Results
Yes
No
Need more training data?
Analyze video stop
Analyze video Extract outlier frames
Refine labels (GUI) Merge datasets
evaluation-results
HPC2N computing
cluster Windows
GPU
Figure 2.2: DeepLabCut workflow adapted from Mathis et al. [13]
2.3 Analysis of synchronicity
Angle computation
For each timepoint, the angle of the whisker was computed as follows. First,
a third-degree polynomial was fitted with least-squares through the 4 points
of each whisker. As Knutsen, Biess, and Ahissar [21] showed, the whisker
can be approximated with a quadratic curve, and thus moves predominantly
in a flat (horizontal) plane. Furthermore, the shape of the whisker remained
the same during head-fixed, free air whisking. Therefore, the azimuthal angle
was defined as the angle between the tangent of this fit at the first whisker point
8 CHAPTER 2. METHODS
𝜃𝑅 𝜃𝐿
L1
L2 R3 L3
R2
R1 Right eye Left eye
Nose
L2-p1
L2-p2
L2-p3 L2-p4
+ +
L1-p2
L1-p3
L1-p4
L3-p1 L3-p2
L3-p3 L3-p4 R1-p3
R1-p2 R1-p4
R2-p2 R2-p1
R2-p3 R2-p4
R3-p1 R3-p3
R3-p4
R3-p2