Research ArticleNEUROSCIENCE

A bird’s-eye view of brain activity in socially interacting mice through mobile edge computing (MEC)

See allHide authors and affiliations

Science Advances  02 Dec 2020:
Vol. 6, no. 49, eabb9841
DOI: 10.1126/sciadv.abb9841


Social cognition requires neural processing, yet a unifying method linking particular brain activities and social behaviors is lacking. Here, we embedded mobile edge computing (MEC) and light emitting diodes (LEDs) on a neurotelemetry headstage, such that a particular neural event of interest is processed by the MEC and subsequently an LED is illuminated, allowing simultaneous temporospatial visualization of that neural event in multiple, socially interacting mice. As a proof of concept, we configured our system to illuminate an LED in response to gamma oscillations in the basolateral amygdala (BLA gamma) in freely moving mice. We identified (i) BLA gamma responses to a spider robot, (ii) affect-related BLA gamma during conflict, and (iii) formation of defensive aggregation under a threat by the robot, and reduction of BLA gamma responses in the inner-located mice. Our system can provide an intuitive framework for examining brain-behavior connections in various ecological situations and population structures.


A longstanding problem in the brain and social sciences is to understand the neuronal mechanisms underlying complex social group behaviors. The behavior of individuals within groups has generally been explained in frameworks of collective motions (e.g., migration and huddling), local behaviors (e.g., competition), and population architectures (e.g., hierarchy). Conversely, studies on the neural mechanisms of social behaviors have depended on comparative measurement and analysis at the level of individual brains; yet, group behaviors are not a simple sum of individual member behaviors. Although these reductionist approaches have clarified the causal links between neural elements and social behaviors, in most cases, the collective behaviors that arise from communication and interactions among individuals are very difficult to deduce from single brain studies, because many global properties of social groups are consequences of coordinated interactions among group members (1). In addition to the behavior level, the involvement of particular brain regions and neural circuits has been reported to be dependent on social contexts (2, 3), necessitating the simultaneous study of two or more interacting individuals (4).

To link specific brain activities with the execution of specific social interactions, there is a critical need for simultaneous monitoring of the brain activities of multiple subjects that can be used to discover previously unidentified brain activities during spontaneous interactions. Moreover, successful brain-behavior analysis also requires recognition of the individual identities. In recent years, efforts have been made to record and analyze the correlated neural activities in socially interacting monkeys (5) or mice (6) or bats (7) but were limited to pairs of two. On the other hand, solutions to automatically track or phenotype the naturally interacting multiple subjects have been proposed using radio frequency (RF)–identified tagging (8) or color tracking (9) or artificial neural network (10), but simultaneous neural recording has not been assayed yet.

To expand understanding in complex social behaviors of a larger number of higher animal groups, a new methodology that supports simultaneous spatiotemporal visualization of neural event in socially interacting behavior is critically needed. Previous telemetry technologies offer a convenient means of simultaneously monitoring multiple individuals (1113), as it avoids the need for wiring that tethers the individual to a monitoring device. However, because of the complexity of the neural signals, the analyses are conducted after experiments, often describing a complex phenomenon in terms of simple constituents. As most of social and ecological contexts are hard to reduce into simple prior conditions, some of phenomena are seemingly unanswerable without seeing the brain activity during experiments. Given these inherent difficulty of reducing complex social behavior into individual components, direct observation of the brain in behaving animals would provide a more satisfactory context in which to explore the neural mechanisms underlying complex social behaviors.

To overcome the difficulty in observing brain activities during complex social behaviors, we adapted edge computing technology (14, 15) in wireless neurotelemetry systems for mice. Edge computing is the latest technology in internet-of-things services that support real-time and context-aware applications by offloading computing tasks from the centralized cloud to an edge (16). Combining edge computing and real-time neuroreporting concepts, we integrated mobile edge computing (MEC) elements into a telemetry unit that records, digitizes, transmits neural signals, and subsequently reports a certain types of neuronal activities by illuminating light emitting diodes (LEDs) embedded in the headstage. LEDs provide the information of mouse location and the existence of certain neural activity with high spatiotemporal resolutions in socially interacting mice. This system, which we call CBRAIN (collective brain research platform aided by illuminating neural activity), consists of neural signal recording, built-in edge computing processors, LEDs, RF antenna, spectral camera, and image processing software that captures and analyzes neuroreporting signals to support the bird’s-eye view of brain-behavior links. Here, we embedded Fourier transform and deviant detection algorithm to detect statistically significantly evoked oscillations. To efficiently follow each mouse, a blue LED was continuously illuminated and used as a tracker with sub-millimeter spatial resolution.

To demonstrate a proof of concept, we used CBRAIN to monitor gamma oscillations in the basolateral amygdala (BLA gamma). Gamma oscillatory activities indicate neural synchrony within or across brain regions for neural communications (17), and the amygdala is a central part of the networks of brain regions underlying social cognition (18). Recently BLA gamma was shown to be involved in neural communication with rhinal cortex (19), prefrontal cortex (20, 21), and hippocampus (21). Nonetheless, a unifying description of the relevant behaviors and a delineation of the link between particular social behaviors and BLA gamma have been lacking. So far, most of amygdala studies have been based on individually conditioned experimental setups rather than group-based natural environments. While a vast amount of findings in amygdala have revealed its importance in autonomic reaction to fear (22) and higher-level cognitions such as threat expectation (23) and social cognition (24, 25), the role of amygdala and BLA gamma in processing the relevant cognition is still inconclusive mainly due to lack of dynamic observation in discrete neuronal events. The difficulty stems, in part, from the emergent nature of the behavior and, in part, from the substantial individual variance in response to stimuli. Therefore, precise information on the spatial and temporal distribution of all mice combined with their BLA gamma activities are critical. Here, we used an escape paradigm using a spider robot as threat agent and applied CBRAIN. A bird’s-eye view of BLA gamma during natural actions not only shows the vigilance-associated activation of BLA gamma as commonly known (20) but also lifted out some underlying features, which could be missed in offline ensemble analysis. Furthermore, post hoc analysis of the trajectories aided by deep learning revealed that the BLA gamma during dynamic interaction with the threat agent was reduced by the presence of other conspecifics. Overall, our research system enables the real-time tracking and the identification and characterization of brain-behavior links in freely moving groups of mice in a variety of contexts, including ecologically relevant situations or within particular population structures.


CBRAIN system overview

To study the links between neural activity and social behavior, we present the CBRAIN system for simultaneously assessing movements and brain activities of individual subjects within a group. Figure 1 (A to D) shows the overview of the CBRAIN system consisted of headstage, data acquisition, and software, and a spectral camera above the cage. The CBRAIN headstage consists of recording, edge computing, telemetry, and LED neuroreporting units, as depicted in Materials and Methods. The unique feature of the CBRAIN headstage is simultaneous recording, analysis, and result display right on the board, which is absent in the recently availed wireless headstages dedicated to neural recording, as presented in table S1. Each CBRAIN headstage is able to record and transmit neural signals up to 16 channels and display neurolabeling up to four channels. In this study, we customized the CBRAIN to record the local field potential (LFP) at 1024 Hz and report gamma bursts, the transient gamma oscillations in the low gamma band (30 to 50 Hz), as illustrated in Fig. 1E. Multiple headstages were synchronized by a transistor–transistor logic (TTL) signal, and counter signals from each device were used for post hoc time alignment. The tolerance of synchrony uncertainty was lower than the time interval of the interrupt handler (see Materials and Methods), which was 976.5 μs. The CBRAIN and video were recorded with the same computer, and the computer time was logged to synchronize the neural signals and video. The errorless wireless transmission ranged up to 2 m, approximately (fig. S1A). Here, we used one LED for the purpose of tracking using a continuously lit blue light and one LED for the purpose of neuroreporting by toggling a red light upon the detection of gamma burst. We embedded MEC algorithms for real-time detection of gamma burst and LED trigger, as depicted in fig. S1B and Materials and Methods. MEC was invoked by the interrupt handler right after data sampling. The execution time was 568 μs, which did not exceed the sampling interval, 976.5 μs in the current setup. Basically, CBRAIN is designed to deliver two types of neural data—electrophysiological signals transmitted via Bluetooth communication and digitized neural event in space obtained from camera. The power consumption of the headstage was 31 mW, which increases up to its twofold on freely moving mouse. One-third of power is used for data recording and transmission and two-thirds are consumed for MEC and LED operation.

Fig. 1 Overview of the CBRAIN system for monitoring brain activity in a group of mice.

(A to D) Schematic diagrams of the CBRAIN system. (A) Photo of a mouse wearing the 2.6-g-weight CBRAIN headstage. (B) A headstage consisting of an amplifier, edge computing processor, telemetry, and LEDs records, analyzes, transmits BLA signals, and reports the neural activity. A high-speed bird’s-eye view spectral camera records the group behaviors and LED lights. (C) The data acquisition software CBRAIN Studio synchronizes and records neural signals from multiple mice. (D) A schematic diagram of the experimental setup for CBRAIN. Here, the blue and red dots represent the tracking and the neuroreporting LEDs. (E) An example trace of the neural signal in the amygdala that contains gamma oscillations (top) and gamma oscillation detection by edge computing (bottom). (F to H) Example of CBRAIN neurolabeling data with trajectories. (F) Captured image frame with identity markers. (G) A frame of video with the trajectory and neuroreporting events provided by CBRAIN for eight mice over a period of about 1 s. (H) The trajectories and neuroreporting events for all mice over a 15-s time period. Photo credit: Nam Kyun Kim and Jisoo Kim, Korea Institute of Science and Technology.

As an initial validation, we performed the performance test of real-time detection via MEC by analyzing the receiver operating characteristic (ROC) curve for the detection of gamma burst. Figure S2A illustrates how the sensitivity and specificity were calculated in each epoch. Figure S2B shows an example of the calculation and the ROC curve obtained from the MEC with respect to post hoc visual scoring of randomly picked 4-s epochs with set size of 29. The area under the ROC curve was 0.938 with an exponential model fit. The detected gamma burst can be merged with trajectories of the mouse, as exemplified in Fig. 1 (F to H).

Demonstration of CBRAIN in seeing BLA gamma and behaviors in mice

As a proof of concept of CBRAIN, we examined transient BLA gamma in the frequency range of 24 to 56 Hz in naturally behaving groups of mice. BLA gamma is known to be associated with brain state of vigilance arising from fear or anxiety (20), suggested as a key neural event in studying fear or anxiety-related social cognition. Here, we used CBRAIN in monitoring BLA gamma activities during spontaneous group behavior and tested the efficacy of the system in studying the amygdala’s role in social cognition.

Before group monitoring, we equated the neuroreporting across mice by confirming the electrode position via intraoperative stimulation test (fig. S3) and using a calibration process for determining the threshold value for BLA power. First, we tested whether a threat evokes BLA gamma responses and introduced a spider robot in a group of eight mice, who were acquainted with one another via group housing. As demonstrated in movie S1, the BLA gamma activities occurred a lot as soon as the spider robot entered the arena, and this occurrence was significantly higher when the robot was in the arena compared to the times without a robot (fig. S4, A to C), which is consistent with the previous findings (20, 23). Second, we examined how BLA gamma occurs in fighting mice by placing three male mice together who are naïve to one another (movie S2). As commonly seen in male rodents, a mouse aggressively chased and initiated a fight with another mouse. BLA gamma was observed in the bystander mouse who was not involved in any form of physical violence. As depicted in Fig. 2, the BLA gamma of the bystander occurred significantly more when one mouse chased the other or when two mice were engaged in a fight than during the baseline (P = 0.008 for baseline versus chasing, P = 0.008 for baseline versus fighting, and P = 0.84 for chasing versus fighting; Wilcoxon signed-rank test, N = 5, observation time per mouse = 40 min). The trajectories with neuroreporting events show these features clearly. This BLA gamma did not increase when the mouse was in a safe place regardless of hearing and/or seeing the fights (fig. S4, D and E).

Fig. 2 Representative scenes of BLA gamma.

(A) A chase scene. BLA gamma activity was not observed in the chasing and chased mice but was observed in a third, static mouse (as indicated by the red light). (B) Representations of 6-s trajectories of the three mice in (A) combined with BLA gamma occurrence (red dots). (C) BLA gamma rate of the bystander during the other’s chasing moment (P = 8.6 × 10−3, paired t test). (D) A fight scene. BLA gamma oscillations were not observed in the mice involved in the fight. However, they were observed in the third static mouse. (E) Representations of 2-s trajectories of the three mice in (C) combined with BLA gamma occurrence. (F) BLA gamma rate of the bystander during the other’s fight (P = 0.040, paired t test). The rate was normalized by the baseline rate of the individual mice. There was no significant difference in BLA gamma in chasing versus fighting (P = 0.41, paired t test). All trajectories in (B) and (D) were converted to disc coordinates for ease of showing the tendency to remain close to the walls by calculating xD=x1y2/2 and yD=y1x2/2 from the normalized coordinates, x and y. BLA gamma detection was conducted at 30 frames per second. Photo credit: Chaewoo Kim, Korea Institute of Science and Technology.

Effects of group conditions on fear-associated BLA gamma oscillations

Next, to investigate the effects of being in a group on BLA gamma activity, we compared behavioral and neural responses in individual versus group situations. Previous experiments have mainly investigated when one animal encounters a threat alone (26), but the more common situation in nature is that prey animals defend themselves by grouping together. Here, we conducted threat-and-escape experiments by introducing a spider robot into the arena with two zones in a group of eight mice who were acquainted with one another during habituation (Fig. 3, A and B; fig. S5; and movie S3). In the presence of the robot, the BLA gamma oscillations were activated more frequently and more strongly (stage 2), decreased in its occurrence after they escaped (stage 3), and further decreased below baseline levels of stage 1 after the removal of the robot (stage 4) (Fig. 3, C to F). The space occupancy maps of the robot were drawn across trials or mice or conditions (fig. S6A). There are no eminent patterns in the occupancy maps, indicating that the observed patterns of BLA gamma were not induced by stereotyped movements of the robot. Also, we tested whether the repetition of experiments affects the BLA gamma. The emergence of BLA gamma activity was not attenuated across the eight trials in all mice, showing that the repeated exposure to the robot did not affect the occurrence of BLA gamma (fig. S7). Multiple comparison tests revealed that BLA gamma activity was affected by all test sources (single/group × stage × mouse), and their interactions with BLA gamma oscillation occurrence and power were statistically significant (table S2). Second-by-second comparisons showed that the influence of the robot on the occurrence and power of BLA gamma activity was significantly lower when in the group than when alone (Fig. 3, G and H). In the stage-by-stage comparison, the group effect appeared as a significantly reduced BLA gamma response during the robot attack and a reduced undershoot effect in stage 4 (Wilcoxon signed-rank test, P = 0.013 for stage 2, P = 8.6 × 10−3 for stage 4; Fig. 3I). The group effect was also present during stage 1 in a way that BLA gamma was significantly reduced in group than in single (Wilcoxon signed-rank test, P = 1.07 × 10−5; Fig. 3J). We tested the possibility that the LED from other mice affects BLA gamma in the group condition and confirmed that the flickering red lights of others do not affect BLA gamma activity (fig. S6, B and C). In terms of power, the gamma power distributions in the single versus group conditions displayed opposite patterns in the low and high gamma bands (Fig. 3, K and L). While the power in the low gamma band was globally reduced in the group condition, power in the high gamma band was generally elevated in the group compared to the single condition. In sum, the BLA gamma activities evoked by a threat significantly reduced in the presence of other mice, compared to when the mouse was alone.

Fig. 3 Effects of the group condition on BLA gamma.

(A and B) Movie stills in the single condition (A) and in the group condition (B). The arena was divided into two zones by a wall with a retractable door allowing only one mouse to pass through at a time. (C and D) Grand average of BLA gamma occurrence rate subtracted by averaged baseline value (average value of all stage 1 trials in single condition), in single (C) versus group (D) conditions. The dark gray lines indicate the SEM. Each 1-s time period with significantly elicited BLA gamma is marked by gray shades (P < 0.005, Wilcoxon signed-rank test). The BLA gamma events across all eight trials are depicted in raster plots. (E and F) Mean z scores of spectral power density for all trials and all mice in the single (E) versus group (F). (G and H) Comparisons of single (blue) versus group (red) in the relative BLA gamma occurrence rate (G) and power (H). The bars along the x axes mark the moments with a significant difference between single and group (P < 0.05, Wilcoxon signed-rank test). (I) Ensemble average of the relative gamma rate, across all stages in the single (blue) versus group (red). (J) Average gamma rates during baseline in single (blue) versus group (red) conditions. *P < 0.05, Wilcoxon signed-rank test. (K and L) Gamma power distribution in single versus group. Power in the low gamma (24 to 56 Hz) (K) and high gamma (60 to 92 Hz) (L) bands during the baseline stage 1 (black) and threaten stage 2 (red). The low gamma power in stage 2 had a significant positive correlation with a slope of 0.52 (R2 = 0.15). In both bands, the threat resulted in increased BLA power (Kolmogorov-Smirnov test, P = 4.1 × 10−71 and 5.8 × 10−28 for low and high gamma bands, respectively). Photo credit: Jisoo Kim, Korea Institute of Science and Technology.

In addition we used a general linear model (GLM) to identify the behaviors or situations that are influential in enhancing BLA gamma and to determine whether the experimental condition of group per se is influential in reducing BLA gamma. First, the spider robot was detected using a convolutional neural network, and its position was determined on the basis of the center of mass of the probabilistic mask. Second, six different types of behavior (i.e., mouse escaping, mouse approaching, spider moving away, spider approaching, close encounter, and staying far) were identified using distance and speed values (see fig. S8, A and B). Movie S4 shows one full scene of stage 2, labeled with classified behaviors, and Fig. 4A shows its snapshot. The cumulative time for each behavior was calculated in individual mice (Fig. 4B). The proportion of each behavior shows that the most frequent behaviors were mouse escaping and spider approaching. In the group condition, the cumulative time of mouse escaping was significantly reduced (P = 0.011, paired t test), and the cumulative times for mouse approaching and spider moving away were significantly increased (P = 0.018 and P = 0.003, respectively, paired t test). Next, a GLM was implemented on the classified behaviors and experimental condition (i.e., single or group) to predict the probability of BLA gamma using a logistic regression model (mean R2 = 0.04), and the positivity and negativity of the regression coefficients was tested. Figure 4C shows mean regression coefficients obtained from four mice, whose trajectories were determined without any loss across the entire recording sessions (16 sessions). Null hypothesis test shows that the situation of mouse escaping, mouse approaching, and spider moving away significantly increased BLA gamma (β = 0.98, P = 0.005; β = 0.82, P = 0.014; and β = 0.30, P = 0.025, respectively), whereas the group condition and the behavior of staying far from the robot decreased BLA gamma (β = −0.14, P = 0.042 and β = −0.37, P = 0.018, respectively).

Fig. 4 Mouse-robot interaction modulates the BLA gamma activity.

(A) A captured scene during the spider robot interaction analysis. Small squares denote the location of each mouse, and the dots show the trajectories for the past 1 s. (B) Total durations of classified behaviors compared in single versus group conditions. Error bars represent the SD of the means. Escap, escaping; aprch., approaching; mov., moving; stay., staying. (C) Regression coefficients of the predictor terms in GLM analysis. Error bars represent the SD of the means. *P < 0.05 and **P < 0.01; n.s., nonsignificant. Paired t test. Photo credit: Jisoo Kim, Korea Institute of Science and Technology.

Reduced BLA gamma activities of inner-located mice during defensive aggregation

An interesting pattern observed in groups is an emergence of aggregation with the spider (Fig. 5A and movie S5). We consider this grouping as defensive aggregation, a widely observed antiattack behavior in prey species (27, 28). To date, this pattern has been considered as a form of self-organization that derives from each individual’s preference to avoid harmful encounters, which enable effective defense against predators (29), but the brain activity of individuals within these groups has not been explored in this context. We compared this defensive aggregation with huddling during baseline (Fig. 5B) in terms of the number of mice involved in the pattern and BLA gamma activities during those two aggregations. We found that the two aggregations did not differ in terms of mouse number comprising the pattern (P = 0.22, Wilcoxon rank sum test, Fig. 5C) but a smaller proportion of mice were exposed at the edges than in huddling aggregations, i.e., smaller ratio of outer- to inner-located mouse numbers (P = 3.4 × 10−3, Wilcoxon rank sum test; Fig. 5D). The main effect of aggregation type and position on BLA gamma was significant [F[3] = 17.62, P = 5.3 × 10−9, one-way analysis of variance (ANOVA) test], as were post hoc comparison between outer- and inner-located mice (P = 4.0 × 10−4 for defensive aggregation and P = 0.98 for huddling, Scheffe test) and between aggregation types (P = 5.2 × 10−5 for outer located and P = 1 for inner located, Scheffe test), showing significantly elevated BLA gamma in the outer-located mice of the defensive aggregation type (Fig. 5E). To investigate whether the reduction in BLA gamma was due to the longer distance from the robot or due to the protection by the outer mice, we calculated the gamma rate along the normalized distance (the radius from the corner divided by the radius of the outer mouse position) (Fig. 5F). The distributions in Fig. 5G show that the BLA gamma activity of inner-located group did not decrease along the distance, reflecting a reduced fear, anxiety, or vigilance of the inner-located mice by protection inside of the defensive aggregation.

Fig. 5 Reduced BLA activation of inner-located mice during defensive aggregation.

(A and B) Frames from movies showing two different types of aggregation, namely, defensive aggregation (A) and huddling (B). Defensive aggregation occurs under threat, and huddling occurs at baseline. (C) Group size during defensive aggregation (red) and huddling (blue). Group size is defined as the total number of mice that contributed to the aggregation. The group sizes were not different depending on aggregation type (P = 0.22, Wilcoxon rank sum test). (D) Ratio of the numbers of outer-located mice to inner-located mice (P = 3.4 × 10−3, Wilcoxon rank sum test). Outer mice were defined as mice located at the boundary of the aggregation, and inner-located mice were defined as mice located inside the aggregation. The outer-located mice confronted the threat, that is, they were directly exposed to the robot. The inner-located mice were protected from the robot by the outer mice. (E) BLA gamma rate of the outer- and inner-located mice in defensive aggregation versus huddling. BLA gamma rate occurred more frequently in the outer mice compared to the huddling mice and the inner-located mice in defensive aggregation [inner located versus outer located: P = 4.0 × 10−4 for defensive aggregation and P = 0.98 for huddling; defensive aggregation versus huddling: P = 5.2 × 10−5 for outer located and P = 1 for inner located; Scheffe test after one-way analysis of variance (ANOVA) test]. (F) Space occupancy map of mice forming defensive aggregation pattern (blue). The positions were moralized by the outermost location of the aggregated mice. Red dots represent BLA gamma. (G) The gamma rates of inner- and outer-located mice plotted with respect to the normalized distance from the corner. The distance from the corner was divided by the distance of the most outer-located mouse in the aggregation. Photo credit: Jisoo Kim, Korea Institute of Science and Technology. a.u., arbitrary units.


Our real-time edge computing and instant reporting through LED lights offer an intuitive way of observing neural activity in a naturally behaving group of mice from a bird’s-eye view, allowing us to correlate particular patterns of brain activity with the execution of behaviors or with changes in social or environmental conditions and to identify brain-behavior links in freely moving groups of mice. In addition, in our first application, the monitoring of gamma activity in the BLA, we were able to observe not only the expected BLA gamma activities at high anxiety levels, as previously reported (19, 20), but also previously unreported patterns in affect-related and group situations. Furthermore, we were able to quantify the effects of dynamic social interactions on brain activities of multiple mice simultaneously, whereas previous research was conducted primarily in pairs of animals (5, 22). Our initial observations in the group context, of initiators, recipients and observers of various behaviors present opportunities for novel findings regarding brain-behavior links that are less influenced by preconceived notions of what might be found. In addition, these types of observations could be complementary to and interactive with the more standard telemetry signals and conventional comparative analyses.

The real-time observation of neural activities in socially engaged mice is advantageous in discovering the brain regions that determine the behaviors of social interactions. A post hoc analysis in essence can lead to the integration of behavior and behaviors, but direct observation without first having to record and analyze data gives the researchers a great degree of freedom in the context of rich, unrestricted behaviors. This instant directness might offer the chance to discover new phenomena, such as when the popping sound of cell firing helped scientists discover neuronal maps, the spatial firing fields discover the neuronal maps, and the spatial firing fields in the hippocampus (30). This approach will be attractive for researchers in many disciplines because of its intuitiveness and the user-friendly readout of brain information and, therefore, is expected to promote interdisciplinary collaboration. For example, understanding the underlying mechanisms of social influences on behavior, formation of social hierarchies, or resource sharing within a group has always been important questions in the behavioral or social sciences. Another possible application would be to study the neurobiological origins of emergent collective behaviors such as migration, group decision-making, and collective intelligence, which do not occur in individuals and emerge only through the interactions of many. Also, the instant feedback of the LED can enable the experimenters to actively engage in the interactions with mice for the study of complex behaviors such as playing a game (31) and to explore the neuronal worlds that go beyond what can be understood in restricted and repeated behaviors. In other practical applications, the unrestricted movement of mice may enable the development of high-throughput assays for testing deficits related to social abnormalities and identifying core symptoms in disease mouse models.

Social interactions have long been emphasized as a crucial component of social structures. Hence, many experiments have focused heavily on identifying the brain regions devoted to social interaction and related cognitive functions. By simultaneously monitoring the brain and behaviors, we show that the adaptability of our system in discovering novel brain activities in relation to spontaneous reactions or social interactions. We therefore believe that our method is likely to be of wide interest and may expand the topics of neurobiology of social behaviors that have been framed in reductionist ways. Most of the available tests are highly standardized, primarily relying on repeatable simple and short interactions, leaving no room for ecological considerations. The examined animals are considered identical entities within a test group, fundamentally opposing their individualization. Many questions in social science face similar challenges and need an approach to study how individuals function in societies and how they interact with each other when encountered with the issues of common interest. In this aspect, individual differences in their brain activities may shed light on unveiling the determinants behind of individual’s choices and roles in the society.

Our proof-of-concept experiments suggest experiments that can expand upon the findings of BLA gamma oscillations described here. Recently, there has been some evidence for the significant roles of BLA gamma. In the low band (30 to 50 Hz), gamma oscillation is enhanced during an appetitive learning task (19, 32) or during foraging under explicit threats (20), but which specific function of BLA gamma exerts is not fully answered. Our observations confirmed that BLA gamma is a brain state–dependent phenomenon and does not represent particular behaviors. For example, BLA gamma occurred more frequently in the moments of freezing or escape during the robot attack, but not vice versa. With respect to the proximity to the threat, our robot experiments showed that not only direct exposure to the robot but also the situations resulting from the interactions of the robot and other mice determine BLA gamma activation, suggesting a relationship to perception of the imminence of the threat, which is not as well described in animals as in humans in terms of spatial proximity (33). Multiple network mechanisms seem to underlie BLA gamma oscillations, necessitating further investigation of the gamma subbands. Gamma oscillations in the BLA are known to synchronize at different frequencies; hence, neuroreporting for the gamma subbands will reduce heterogeneity in the observations. For example, BLA-rhinal cortex interactions facilitate gamma oscillations, but its peak frequency is different for the peri- versus entorhinal cortex and across different learning phases (19). The expansion to additional bands will elucidate the amygdala circuits in a more comprehensive way [e.g., high gamma for BLA-hippocampus interactions (34) or a frequency of 4 Hz for the BLA–prefrontal cortex network (35)]. Our full-spectrum LEDs or use of an extra LED for labeling different frequencies of gamma can be readily applied to produce colorful neuroreporting and, thus, will play a key role in identifying divergent amygdala circuits orchestrating emotional responses.

The method described here opens up a new avenue for investigating how different environments or social relationships influence neural activity during social interactions. Although our proof-of-concept experiments focused on BLA gamma oscillations, the flexibility and scalability of MEC and the potential use of multiple LEDs will allow the visualization of other types of neural event. For instance, the current processor can run computational algorithms for feature extraction, functional connectivity, and firing rate. In the recent past, MEC has been successfully implemented in mobile internet-of-things systems by deep learning algorithms (14, 15), raising the possibility of reporting categorical neural state representations in our platform using deep learning algorithms. Other operations, such as a closed-loop brain stimulation within an individual mouse or between mice, are also possible in our on-the-brain analysis scheme with an addition of electrode stimulation. In summary, this system provides an opportunity for the instant analysis and instant display of brain activity on the heads of mice that can freely move in their environment, thus providing an observational tool that allows the users to explore the brain of animals while they engage in various behavioral repertoires under the experimental settings that more closely resemble a natural life.


CBRAIN headstage

The completed 2.6-g-weighted headstage consisted of the following components: an amplifier, telemetry, a microprocessor, a power supply, and an LED display. We designed a four-layer printed integrated circuit board using a software package (Board Station EN2004, Mento Graphics Co., USA). One headstage was designed on systems-on-chips (SoC) and systems-on-module architectures to avoid interference between the components and to operate it on a hierarchical basis for a compact form factor. The headstage is divided into recording, edge computing, LED neuroreporting, and telemetry units. The power was supplied by a 2.0-g-weighted rechargeable battery (3.7 V, 40 mA, lithium polymer, Taiwoo Battery Co. Ltd., Shenzhen, China).

Recording unit. A digital, low-power, 16-channel differential amplifier (RHD2216, 16-bit, INTAN Technologies LLC, Los Angeles, CA, USA) was embedded on the board. The output was sent to the Bluetooth SoC (nRF52832, Nordic Semiconductor) via a serial peripheral interface at 8 Mbit/s after band-pass filter was applied (cutoff frequencies of 1 Hz and 4 kHz).

Edge computing unit. MEC was processed in the ARM cortex-M4 (64-MHz clock, Arm Limited, Cambridge, UK, embedded in the Bluetooth SoC), which provides a single-cycle multiply and accumulate unit. Here, a gamma-detection algorithm was built in firmware and processed in the interrupt service routine, invoked by an interrupt handler every 976.5 μs (i.e., 1024 Hz) based on 32.768-kHz crystal oscillator clock. The size of an edge data for computation was 256 data points (i.e., 250 ms), and its power was calculated by a fast Fourier transform function in CMSIS-DSP library ( after being smoothed by using a Hamming window. The arithmetic of each process was performed in the single-precision floating-point unit to reduce the execution time. The MEC execution time per edge data was 568 μs, which was faster than one sample collection time, i.e., 976.5 μs (fig. S1B). The result was updated every 10 data points (i.e., 97.65 μs), and pending the detection of gamma burst, a trigger signal was sent to an LED driver.

LED neuroreporting unit. For LED neurolabeling, the individual CBRAIN headstage was equipped with four red-green-blue LEDs (LTRB R37G, OSRAM, Regensburg, Germany). For simplicity in this study, two LEDs were used: one LED emitting blue that remained illuminated for tracking and another in red that was turned on and off depending on the presence of amygdala gamma band oscillations. The LEDs were toggled via the general purpose input/output pins in nRF52832. The update rate for the red LED switch was identical to the result update, which was 97.65 μs. The latency of LED toggling after MEC execution was 25 ns. Light intensities of blue and red LEDs were 0.32 ± 0.02 W/cm2 and 0.4 ± 0.05 W/cm2, respectively, at a distance of 1 cm from the LED center measured by a photo-power sensor (PM100D, Thorlabs Inc., Newton, NJ, USA).

Telemetry unit. The Bluetooth Enhanced ShockBurst broadcasting scheme was used in CBRAIN. The maximum data payload was 224 bytes with a wireless data bandwidth of 2 Mbit/s at a 2.4-GHz carrier frequency. The current communication system, enterprise service bus can accommodate 128 separate pairs without interference among multiple devices at the transmission rate of 2 Mbit/s. In this study, 16 bits of the electrophysiological signal was transmitted at 1024 Hz. To allow a post hoc time alignment, we sent a counter signal, whose value was incremented by 1 at every sample update. The synchrony between multiple devices was achieved with a TTL signal before applying them to the mice.

Data acquisition

LFP recording was accomplished through the use of custom software, CBRAIN Studio, which is a graphical user interface (GUI) program built in MATLAB 2020a (MATLAB Inc. Natick, MA, USA). CBRAIN Studio includes GUIs for device-dongle pairing, defining parameters for data acquisition, logging and displaying incoming data, and saving data. The parameters to be defined are the pairing frequency, channels to be recorded, and input variables for MEC (e.g., frequency of interests and thresholds for deviance detection). The sampling rate is settable between 256 Hz to 16 kHz. The recording time is dependent on the sampling frequency and the environments surrounding the headstage. In the current setup (sampling rate of 1024 Hz, on the head of freely moving mouse), the recording time lasts approximately 2 hours.


All animals were kept at the Animal Facility in the Korea Institute of Science and Technology on a 12-hour light/dark cycle in a temperature-controlled colony and given unrestricted access to food and water. All experiments were approved by the Korea Institute of Science and Technology Animal Care and Use Committee (permit number: 2019-095) and complied with the National Institutes of Health Guidelines for minimizing the pain and discomfort of animals. Thy1-ChR2-YFP, line 18, mice were obtained from the Jackson laboratory [B6.Cg-Tg(Thy1-COP4/EYFP)18Gfng/J, stock number 007612]. Healthy 8-week-old male mice weighing more than 25 g were selected for the surgery and participated in the experiments 1 to 8 weeks after the surgery.

Intraoperative stimulation test

To guarantee that the LED light represents the BLA activities, we performed an intraoperative stimulation test during the electrode implantation surgeries. The whole procedure is depicted in fig. S3. To avoid stimulation-induced artifacts, we used optogenetic stimulation in the Thy1-ChR2-YFP mice, the BLA of which is known to have its selective expression of ChR2. First, the mice were anesthetized with a ketamine-xylazine cocktail (120 and 6 mg/kg, respectively) and placed in a stereotaxic instrument (Model 900, David Kopf Instruments, Tujunga, CA, USA). A custom-made optrode consisting of a tungsten electrode (575400, A-M Systems, Calsborg, WA, USA) and a fiber optic cannula (FOC-C-1.25-200-7-0.37, Newdoom, China) was inserted on top of the BLA (anteroposterior, −1.6 mm; mediolateral, 3.12 mm). A stimulation test was conducted from a depth of 4-mm dorsoventral from the bregma with a pulse train of 12.5-ms stimulation with a 3-s interstimulus interval repeated 20 times with 0.5-mW-powered blue light (wavelength = 470 nm, MBL-FN-473 model, Thorlabs Inc. NJ, USA). The LFP was concurrently recorded using the Intan data acquisition system (RHD2000 series, Intan Technologies LLC, USA) at 30 kHz and instantly analyzed for the evoked potential. Using a custom-made real-time analysis tool written in MATLAB (MathWorks Inc., Natick, MA, USA), the averaged evoked potential and peak amplitude were returned immediately after the stimulation. From 4.2 to 4.9 mm, the stimulation test was performed with 0.1-mm interval, and the final depth was fixed at the depth where maximum voltage was yielded. Then, the ground and reference electrodes were implanted into the cerebellar skull, and all electrodes were fixed with dental cement (Vertex Self-Curing, Vertex Dental, Zeist, The Netherlands). After the whole experiment, we histologically checked the optrode position for double confirmation.

Experimental setup and camera configuration

The customized arena, with a floor area of 60 cm by 60 cm, was made in the machine shop at (erased for double-blind review), and the insider walls were covered with black textile to avoid light reflection. To separate the colors from the LED, a high-speed, complementary metal-oxide semiconductor–based camera (Lt225, Teledyne Lumenera, Ottawa, ON, Canada) was installed at the top of the arena at a distance of 1.6 m. This top-view camera was placed to record the entire arena and was aligned perpendicular to the bottom of the arena. Because mice are nocturnal animals, animal behaviors were recorded under a dim light, and the room temperature was maintained from 22° to 24°C. We configured the camera in such a way as to minimize the color saturation and afterimage. Frames from the spectral video camera were recorded by StremPix 7 (Norpix Inc., Montreal, Quebec, Canada) at 30 fps with a resolution of 1000 × 1000 pixels.

A robot-based escape experiment

After testing several types of robots, we used a spider robot (Model 18143A, Academy Plastic Model Co. Ltd., South Korea) because all tested mice displayed a strong reaction even after repeated exposure to it. Before the main experiments, each mouse had experienced a CBRAIN recording in multiple exploratory environments and had been acquainted with each other through 3 hours of group housing performed over five successive days. The arena was divided into two zones by a wall with a manually retractable door, and the size of the door would allow only one mouse to pass through at a time (Fig. 3, A and B). The door allowed only one mouse to pass through, and the two sides were assigned to be either a safety or a threat zone. Initially, each mouse was placed in the threat zone with a closed door either alone or in a group. After observing them to be comfortable with the zone, we started the experiments. Typical signs of being comfortable were ceasing of explorative behaviors, a reduction in red LED lights, huddling, etc. The experiment paradigm consists of four stages: In stage 1, the mice were placed in the safe zone. After 2 min, a spider robot was placed in the same zone, and its motion was controlled manually with wired controller to simulate a predator in a threatening way (e.g., approaching to the mice, raising the legs high when the robot near mice, etc.) (stage 2). After 1 min, the door opened, and recording was performed for 1 min (stage 3), followed by the removal of the robot from the arena (stage 4). The experiment was performed with a mouse alone and then in a group and repeated eight times in total (fig. S5).

Mouse tracking

The moue tracking detects mouse position by precisely locating the position of the blue LED corresponding to a specific mouse. The procedures are illustrated in fig. S8C and the tracking program was custom built in Python 3.7 using openCV version 3.4.5. The fundamental principle of mouse tracking is a detection of particles that travels in space conducted by the following steps: (i) Preprocessing: To reduce noise and selectively enhance blue LEDs, the image was converted into a binary image of 0 and 1 using a higher threshold for blue at 220 and a lower threshold for red and green at 235 on a scale of 0 to 255. (ii) Point extraction: To identify individual LEDs, sets of connected white pixels were detected, and the images with putatively identified LEDs were extracted by combining dilation and connected component algorithms using built-in openCV functions, dilate() and connectedComponent(), respectively. The former increase in the white region of pixels belongs to a cluster of connected pixels and the later finds the connected components for follow-up labeling. The point for individual object was extracted by calculating the center of mass of the image. (iii) Eliminating erroneous object: Depending on the lighting and experimental conditions, false-positive detection of the blue object occurs. As most of the false detections are due to the reflection of LED lights from the acrylic walls or from the surface of the spider robot, we eliminated any fixed points or points inside the robot bounding area in each frame. (iv) Identity tracking: Starting from the manually validated frame, we traced individual mouse by connecting the nearest point in the subsequent frame. Even though connecting the two points automated identity tracking in substantial amount of videos, the nature of mouse movements challenged automated multimouse tracking. One of the challenges was an occlusion of two or more mice. We handled the occlusion periods through frame-by-frame visual validation to avoid any identity swapping. The other challenge was missing the point, mostly due to weakened LED illumination while the mouse moves its head. In this case, we manually identify the next frame having the point and then interpolate two points for missed trajectory. All trajectories were validated manually in the original video with mouse labeling (movie S6).

Robot tracking

The position of spider robot was extracted using a convolutional neural network, which takes a grayscale image frame (448 × 448) as an input and produces a probability map (448 × 448) of the spider robot as an output (fig. S8D). At first, raw video files were parsed into single grayscale frames and converted into 448 × 448 resolution. Then, 1000 frames were randomly sampled from the whole dataset to form a training set. Corresponding 1000 binary masks (spider robot area coded in 1, otherwise 0) were generated manually. The network architecture followed the U-Net ( motif, which is known to perform well in image segmentation tasks (36), and this network was implemented in Keras with Python 3.7 (dropout = 0.2, number of filters = 16, activation function = ReLU, number of output class = 1, output activation function = sigmoid, number of convolution/deconvolution blocks = 4, optimizer type = Adam, and loss function = binary cross-entropy). The position of a spider robot was estimated by taking the center of mass of the probability map and rescaling it in the centimeter unit to match the mouse tracking data.

Calibration for LED

Annotating a specific neuronal event based on the light illumination assumes that the LEDs from all mice represent the same neuronal event. To guarantee this, a calibration process is needed to normalize the individual differences particularly exhibited in low-frequency regions. After testing different methods of normalization, we used 4σ as the threshold for detecting the transient gamma, where σ is the SD of the baseline gamma during 10 min of LFP recording in a Faraday-shielded calibration box. The gamma power values were estimated to be between 24 and 56 Hz across a 0.25-s epoch period. During our observation time, the intramouse variability did not exceed 1% across different days, but it is recommended to repeat the calibration on a daily basis.

LFP signal analysis

LFP signals from multiple mice were simultaneously collected in the CBRAIN system at a 1024-Hz sampling rate. The impedance of each electrode was kept below 300 kilohms. Using counter signals from CBRAIN, the periods of communication error were identified and reconstructed using the cubic spline interpolation. The percentages of data loss were below 1%, normally being as low as 0.1%. A power spectrogram was obtained by applying a fast Fourier transform with a sliding Hanning window (256 ms) to the LFP with a 10-ms moving window, fulfilling 10-ms time resolution and 128-ms maximal delay in the event detection. The frequency band of gamma oscillations in this study was 24 to 56 Hz. For the z-score analysis, the ensemble average of the power for all trials and all mice (eight trials × eight mice) under the single and group conditions were calculated. The z score was calculated by dividing the deviation from the baseline mean by the baseline SD and used to draw the spectrogram. The baseline data were obtained from the initial 10 s of the baseline.

MEC judgment value analysis

MEC computes the power spectral density and reports the gamma oscillation as a judgment value (LED signal). On the basis of the threshold (4σ) obtained from the baseline data in the calibration box, we saved the detected value of the gamma oscillation. The judgment value obtained from MEC has two values: 0 and 1. In a given time domain (256 data points, 0.25 s) of filtered data, a value of 1 represents a time point exhibiting gamma oscillations, while 0 indicates that a time point does not contain gamma oscillations. We smoothed the data by averaging the data with a 1-s time domain and a 10-s moving window. The gamma occurrence rate (N) was obtained from the smoothed data and defined as the number of occurrences per second of one mouse. The gamma occurrence rate at the baseline (NB) was calculated from the average of the baseline stage (0 to 60 s). The difference between the gamma occurrence rate of each stage (N) and the baseline (NB) was calculated by subtracting NB from NN = N − ⟨NB⟩).

Generalized linear model

The GLM was used to determine the influential factors for BLA gamma. The binary nature of neurolabeling makes logistic regression suitable for modeling BLA gamma. A logistic function was defined aslogit(γBLA)=β0+i=17βiXi+βi+1G,where logit() is logit function, γBLA is the binary coded occurrence of BLA gamma, and Xi is a binary variable as a result of behavior classification. G is 0 or 1 for single or group condition, respectively. The regression coefficients βi were obtained via using the fitglm function in MATLAB 2020a (MathWorks, Inc. Natick, MA, USA). The signs of βi were tested using null hypothesis (α = 0.05) to determine whether the parameter is consistently increasing or decreasing the probability of BLA gamma.

Statistical tests

BLA gamma rate of bystander between two conditions (without aggression versus chasing and without aggression versus fighting) was compared by paired t test (Fig. 2, C and F, and fig. S4, D and E). The effect of group condition on gamma power and gamma rate was tested by Wilcoxon singed-rank test (Fig. 3, G to J, and fig. S4, A to C). Gamma power distributions of baseline and threat were compared by two-sample Kolmogorov-Smirnov test (Fig. 3, K and L). The difference of duration per behavior between single and group conditions was tested using paired t test (Fig. 4B) Statistical test for GLM analysis of behavior and BLA gamma in stage 2 was paired t test (Fig. 4C). Group size of defensive aggregation and huddling was compared by Wilcoxon rank sum test (Fig. 5, C and D). The difference of gamma rate between four group types (outer located and inner located in defensive aggregation/outer located and inner located in huddling) was tested with one-way ANOVA, and post hoc tests were performed using Scheffe test (Fig. 5E). The dependent variables (gamma rate and power) were analyzed with the design session type (single/group) × stages (no threat 1/threat/door open/no threat 2) × individuals (eight mice) using three-way ANOVA. When significant, post hoc tests were performed using the Kruskal-Wallis test. The α level for all tests was set at P < 0.05.


Supplementary material for this article is available at

This is an open-access article distributed under the terms of the Creative Commons Attribution-NonCommercial license, which permits use, distribution, and reproduction in any medium, so long as the resultant use is not for commercial advantage and provided the original work is properly cited.


Acknowledgments: We thank B. Kim for advice on the validation of BLA targeting and E. E. Fetz and J. M. Park for critical reading of the manuscript. Funding: This work was supported by the National Research Council of Science and Technology grant by the Korean government (CPS-18-01-KIST), the National Research Foundation of Korea (grant 2017R1A2B3012659), the KIST Artificial Brain convergence project (2E30762), and the ETRI Development of Core Technologies for implantable devices (19ZB1240). Author contributions: J.H.C. designed the concept of CBRAIN. S.Q.L. designed the CBRAIN hardware system. S.Q.L. and W.Y. developed the CBRAIN hardware. S.Q.L. developed the CBRAIN studio. J.K., C.K., S.Q.L., and J.H.C. validated the CBRAIN system. J.K. performed animal surgeries and designed the experimental protocol. J.K. and C.K. performed the experiments. C.J.C. and H.-B.H. developed the tracking algorithms. J.K., H.-B.H., and C.J.C. analyzed the data. J.H.C. supervised the study. J.H.C. wrote the manuscript. All authors discussed the results and contributed to the revision of the manuscript. Competing interests: The authors declare that they have no financial or other competing interests. Data and materials availability: All data needed to evaluate the conclusions in the paper are present in the paper and/or the Supplementary Materials. The data and CBRAIN systems are available from the correspondent authors upon reasonable request.

Stay Connected to Science Advances

Navigate This Article