Unidirectional brain-computer interface: Artificial neural network
  encoding natural images to fMRI response in the visual cortex
While significant advancements in artificial intelligence (AI) have catalyzed
progress across various domains, its full potential in understanding visual
perception remains underexplored. We propose an artificial neural network
dubbed VISION, an acronym for "Visual Interface System for Imaging Output of
Neural activity," to mimic the human brain and show how it can foster
neuroscientific inquiries. Using visual and contextual inputs, this multimodal
model predicts the brain's functional magnetic resonance imaging (fMRI) scan
response to natural images. VISION successfully predicts human hemodynamic
responses as fMRI voxel values to visual inputs with an accuracy exceeding
state-of-the-art performance by 45%. We further probe the trained networks to
reveal representational biases in different visual areas, generate
experimentally testable hypotheses, and formulate an interpretable metric to
associate these hypotheses with cortical functions. With both a model and
evaluation metric, the cost and time burdens associated with designing and
implementing functional analysis on the visual cortex could be reduced. Our
work suggests that the evolution of computational models may shed light on our
fundamental understanding of the visual cortex and provide a viable approach
toward reliable brain-machine interfaces.
Ruixing Liang, Xiangyu Zhang, Qiong Li, Lai Wei, Hexin Liu, Avisha Kumar, Kelley M. Kempski Leadingham, Joshua Punnoose, Leibny Paola Garcia, Amir Manbachi
Unidirectional Brain-Computer Interface: Artificial Neural Network Encoding Natural Images to fMRI Response in the Visual Cortex

###### Abstract

While significant advancements in artificial intelligence (AI) have catalyzed progress across various domains, its full potential in understanding visual perception remains underexplored. We propose an artificial neural network dubbed VISION, an acronym for "Visual Interface System for Imaging Output of Neural activity," to mimic the human brain and show how it can foster neuroscientific inquiries. Using visual and contextual inputs, this multimodal model predicts the brain's functional magnetic resonance imaging (fMRI) scan response to natural images. VISION successfully predicts human hemodynamic responses as fMRI voxel values to visual inputs with an accuracy exceeding state-of-the-art performance by 45%. We further probe the trained networks to reveal representational biases in different visual areas, generate experimentally testable hypotheses, and formulate an interpretable metric to associate these hypotheses with cortical functions. With both a model and evaluation metric, the cost and time burdens associated with designing and implementing functional analysis on the visual cortex could be reduced. Our work suggests that the evolution of computational models may shed light on our fundamental understanding of the visual cortex and provide a viable approach toward reliable brain-machine interfaces. The source code can be found 1.

Ruixing Liang,\({}^{1,2}\) Xiangyu Zhang,\({}^{1}\) Qiong Li,\({}^{3}\) Lai Wei,\({}^{1,2}\) Hexin Liu, \({}^{1}\) Avisha Kumar \({}^{1,2}\)

Kelley M. Kempski Leadingham, \({}^{1,2}\) Joshua Punnoose, \({}^{1,2}\) Leibny Paola Garcia,\({}^{1}\) Amir Manbachi\({}^{1,2}\)

Footnote 1: Our open accessed repository can be found via [https://github.com/Rxliang/VISION](https://github.com/Rxliang/VISION)

\({}^{1}\)Johns Hopkins University, \({}^{2}\)Johns Hopkins Medicine, \({}^{3}\)Pennsylvan State University

## 1 Introduction

A fundamental pursuit in neuroscience is to uncover the neural basis of perceptions. Translating 1-dimensional auditory cues, which primarily captures amplitude changes over time into neural activity, is relatively well understood [1]. On the other hand, visual stimuli's multifaceted 2D nature, encompassing attributes like color, texture, and depth, makes encoding more intricate [2]. Researchers frequently utilize functional magnetic resonance imaging (fMRI) to explore neural reactions triggered by visual stimuli. By measuring hemodynamic changes elicited by neural activity, fMRI illuminates the brain's approach to interpreting visual signals, serving as a potent modality in developing a brain-computer interface (BCI) aimed at modifying visual perception [3]. Consequently, there has been an increased emphasis on analyzing vision-related fMRI responses as subjects encounter various natural scenarios [4, 5]. Current standard continuous fMRI sessions, with a duration of 3-11 minutes and 3 mm resolution, come at a hefty cost of around $1325 per session [6]. To gather ample data, multiple fMRI sessions spread over a year are essential. The significant expenses have impeded obtaining high-quality data efficiently [7]. As a result, optimizing the use of existing datasets with minimal presuppositions to develop computational BCI models of human visual perception is paramount. By doing so, actionable hypotheses that guide subsequent research in a more focused and evidence-based direction could be generated, ensuring the efficient utilization of resources.

Over the past few decades, deep learning (DL) has significantly transformed a myriad of scientific disciplines and industries. This transformation is largely attributed to the expanding scale of training datasets and the advancements in artificial neural networks (ANNs). Interestingly, given ANN's inherent parallel with human brain neural pathways and its performance, the study of artificial and biological intelligence is increasingly converging [8, 9, 10]. Recognizing the potential of DL's nonlinearity and its robustness to noise, re

Figure 1: Overview of VISION, an Artificial Neural Network estimating functional Magnetic Resonance Imaging (fMRI) of the visual cortex response to visual stimuli. VISION acts as a neural encoder that parallels the human visual cortex.
searchers have begun to leverage it in neuroscience [2]. By treating neural responses, specifically fMRI data, as model inputs, several studies have employed generative ANN models to reconstruct visual stimuli, encompassing both static images and dynamic video streams [7, 11]. These DL models, often called "neural decoders" or "mind readers," provide a compelling avenue to decode brain activity. Conversely, there are DL models that predict neural responses based on visual stimuli, essentially acting as encoders. They offer valuable insights into the mechanism within cascading neural circuits in the human brain, revealing the intricacies of neural computation. Crucially, by integrating these two methodologies--decoding and encoding--a holistic loop for brain-computer interfaces can be established [3].

However, a significant limitation lies in these encoding models' scalability and interpretability. DL frameworks are often described as black boxes, leading them to be perceived as agnostic computational models with limited transparency [12, 13, 14]. To address these limitations, we introduce a novel multimodal (i.e., text and images) ANN model, VISION, with a scaled structure for predicting voxel-by-voxel fMRI responses. VISION's accuracy has been evaluated for varying anatomical regions relevant to human visual processing and was found to align with hypotheses found in the neuroscience community [15, 16]. Additionally, we introduce a new approach for clear and quantifiable visual cortex functional analysis using class activation map (CAM)-based visualization and our purpose-built dataset [17]. This dataset is tailored to measure the model's attention across varied visual cues.

## 2 Methodology

### Multimodal Neural Encoding Model

As illustrated in Figure 2, VISION consists of two fundamental building blocks: a multimodal feature extractor and a dense-channel encoding interface network.

**Feature Extractor**: Inspired by recent work demonstrating that the visual cortex processes semantic contextual information in addition to visual input [15], the state-of-the-art pre-training model has been adopted, BLIP [18], as a feature extractor. The BLIP model consists of a vision transformer model [19] and three transformer-based models with a similar structure to the BERT model [20]. Instead of using image-text pairs as inputs to the BLIP model, only images have been used to reduce computational complexity. The output of the BLIP feature is a high-dimensional feature containing textual information from the pre-training.

**Encoding Interface Network**: Given that the Multilayer Perceptron (MLP) draws inspiration from the structure of brain neurons, encoding interface network's design was grounded on the MLP model. MLP-Mixer has demonstrated meritorious performance across various computer vision tasks [21]. Each MLP model consists of two fully-connected layers and one GELU activation function [22]. For the MLP model to better understand the features from BLIP, we performed a series of processing steps on the BLIP features. First, the BLIP features are converted into a 32*24 two-dimensional matrix, calling it a query. The reconstruction is intended to replicate the complex, layered organization of the cerebral cortex. 197 queries are produced due to the properties of the BLIP feature, followed by processing in an MLP model for each query and combined as shown in Figure 2.

### Feature Space Visualization through Dimension Reduction

Dimension reduction plays a crucial role in visualization and as a preprocessing tool in deep learning due to the inherent challenges of high dimensionality [23]. Specifically, Uniform Manifold Approximation and Projection for Dimension Reduction (UMAP) has been employed to transform high-dimensional data into a compact representation, maintaining both local and global structures [24]. We extracted condensed features from the encoding interface network for visualization and paired each feature with augmented supercategories, enabling unsupervised visualization and evaluation of the model feature space.

### Neuroscientific Hypotheses Testing and Generation via CAM Visualization

In this study, we employed ScoreCAM to elucidate the pixel-wise contribution from the visual image input towards each single voxel prediction, which can intuitively be interpreted as the model's attention map as illustrated in Figure 3[17].

We hypothesize that the attention map of a visual cortex subregion from the VISION model reflects the input image region that its biological counterpart would process. By evaluating the similarities and distinctions across regions in the visual cortex (Figure 3), we not only verify established neuroscientific hypotheses but also pave the way for formulating new hypotheses for regions whose focus is not known. Our primary emphasis has been testing hypotheses related to

Figure 2: Overview of VISION model structure consisting of a feature extractor network and an encoding interface network
the higher visual centers, particularly those concerning object comprehension [2]. First, a group of images with one main object were selected. Following, Segment Anything (SAM) was used to segment and extract the main object from the image (e.g., a cat or dog in the center) [25]. Then, we overlapped the attention maps (from ScoreCAM) with the segmented objects to compute the dissimilarity of the overlapping regions between the different visual cortex regions, further quantified by Kullback-Leibler divergence. These attention maps can also be used to predict the role of varying visual cortex regions in object comprehension by dividing the attention score of the primary object by the total attention score, as described in Equation 1:

\[P_{f}=\frac{1}{n}\sum\frac{\mu_{AF}}{\mu_{OF}+\mu_{AF}}, \tag{1}\]

where \(P_{f}\) is the probability of visual cortex groups belonging to a particular function \(f\), \(\mu_{AF}\) is the mean of attention distribution in some particular regions normalized with a particular area matching a function (e.g., object, edge), and \(\mu_{OF}\) is mean of the attention out of the particular function. Using this process, the relationship between region characteristics of the visual image and neuronal activation can be mapped. It may spark new hypotheses on the role of varying visual cortex regions in visual processing. As this paper primarily focuses on visual comprehension, our analysis was limited to regions associated with the higher-order visual centers that control scene comprehension and object recognition[2].

## 3 Experiments

### Dataset

Our dataset comprised fMRI recordings from 8 participants as they viewed between 9,000 and 10,000 natural scenes [4]. We have integrated the Common Objects in Context (COCO) dataset source of the visual stimulus to augment this dataset by adding text descriptions. This produced image-fMRI pairs and image-caption-fMRI triads. Given the original human captions' verbosity, we devised an automatic labeling and cross-validation pipeline inspired by the OpenCLIP library, preparing our model's multimodal input [26].

Unlike existing studies that focus solely on the five major visual cortical regions of interest (ROIs) [2], we encompass the entirety of the visual cortex's anatomical structure for a total of 27 regions. Moreover, we have preprocessd resting state fMRI scans using the dataset's atlas, delivering robust functional connectivity analysis suitable for heuristic hypothesis input and cross-validation. Lastly, 100 images have been labeled semi-automatically, based on the current understanding of the visual cortex functions, to design our metric for functional analysis on different regions of the visual cortex [25].

### Experimental Settings and Neural Architecture Search

80% of the dataset from each participant has been allocated for training, and the remaining 20% has been reserved for evaluation and testing. This approach was implemented to ensure model generalization across individuals. Each model was tasked with predicting a hemisphere in a participant's brain.

To evaluate prediction accuracy, noise-normalized accuracy is adopted. This entails the noise ceiling [27], using Equation 2:

\[\mathrm{NC}=100\times\frac{\sigma_{\text{signal}}^{2}}{\sigma_{\text{signal} }^{2}+\sigma_{\text{noise}}^{2}}. \tag{2}\]

NC is the noise-ceiling value associated with each voxel, defined as the maximum percentage of variance in the voxel's responses contributed by signal (\(\sigma_{\text{signal}}\)) given the presence of estimated noise (\(\sigma_{\text{noise}}\)) provided by the dataset. Then accuracy is calculated according to Equation 3 and Equation 4 [12].

\[R_{v} =\mathrm{corr}\left(G_{v},P_{v}\right)\] \[=\frac{\sum_{t}\left(G_{v,t}-\bar{G}_{v}\right)\left(P_{v,t}- \bar{P}_{v}\right)}{\sqrt{\sum_{t}\left(G_{v,t}-\bar{G}_{v}\right)^{2}\sum_{ t}\left(P_{v,t}-\bar{P}_{v}\right)^{2}}}, \tag{3}\] \[\text{Accuracy }=\text{Median }\left\{\frac{R_{1}^{2}}{NC_{1}}, \ldots,\frac{R_{v}^{2}}{NC_{v}}\right\}\times 100, \tag{4}\]

where \(G_{v}\) and \(P_{v}\) represent the ground truth and predicted fMRI values of a voxel and its corresponding visual stimuli indexed, respectively, by \(v\) and \(t\).

Hyperparameter tuning and Neural Architecture Search (NAS) have been executed parallel to finetune each model. Both have followed the Tree-structured Parzen Estimator (TPE) paradigm [28]. We adopted Adam Optimizer with a finetuned initial learning rate for each model. The training environment was based on Pytorch distributed in an RTX3090 machine and an A100 machine randomly.

### Results

#### 3.3.1 Benchmark

We have compared both the quantitative and qualitative outcomes of VISION models against two established baselines

Figure 3: Illustration of ScoreCAM visualization to get the model’s attention map of a specific region of interest in the visual cortex(i.e., hV4, V3v, and V1v)
(i.e., vanilla and baseline model) [4, 2, 12]. Furthermore, our models exhibit superior performance when benchmarking against even unpublished research in some regions[29]. A summary of the quantitative comparisons can be found in Figure 4. Pair-wise t-tests have been used to assess the significance of observed differences. Overall, for all vertex accuracy, VISION models significantly exceed baseline models. It is worth noting that improvements in the early visual cortex are minimal (i.e., V1, V2, V3). This observation aligns with our initial hypothesis: these regions do not process semantic information. Additionally, the accuracy improvements on the peripheral regions are more significant, aligning with the neuroscientific understanding that semantic information is processed on the periphery [15]. This evidence demonstrates the alignment of VISION with recent visual cortex discoveries, warranting further investigation into the ability of this model to capture biological functionalities.

#### 3.3.2 Feature Space

As illustrated in Figure 5, response patterns within all participants' VISION models tend to group semantically. Typically, such distinct clustering, where identical categories are close-knit while being separated from dissimilar ones, emerges in networks that have been specifically trained and regularized to differentiate between these categories. Moreover, when compared with previous works, this clustering performance is better [4]. For the "other" category, its broader nature results in a broader distribution. The overlap labeled "both" signifies the presence of a person and an animal within a single image, and its placement within the respective person and animal clusters follows expectations.

#### 3.3.3 Hypotheses Testing on Functional Connectivity

Following the traditional use of ScoreCam on BLIP'S vision encoder's last normalization layer, we have selected hV4, V3v, and V1v as testing regions. According to KL divergence, results show that the similarity of hV4 and V3v is 3.72 times more similar than hV4 and V1v, which could also be visually inferred in Figure 3. This is consistent with functional connectivity analysis derived from resting state fMRI and current findings [16]. This high similarity demonstrates a new way of deciphering the brain by first validating existing neuroscientific hypotheses with attention and then calculating the probability of the region's possible function using the attention ratio (Equation 1). We test the object comprehension function of the hV4 region. Our results show that hV4 has a 59.5% probability of being used for object comprehension. This further shows VISION model resemblance with the biological visual cortex.

## 4 Conclusion

This paper introduces a transformer-based ANN model, termed VISION, designed to predict fMRI responses from visual stimuli. Utilizing a multimodal feature extractor, VISION processes visual cues and leverages pre-trained semantic information. This data then feeds into a dense-channel encoding interface network, significantly exceeding state-of-the-art accuracy. Evaluation of VISION demonstrates the model's performance and interpretability and suggests its generalizability to traditional computer vision tasks. We further analyze the model's attention map, using quantifiable metrics to test existing theories. This approach illuminates the potential benefits of integrating large-scale ANN models in neuroscience. This synergy promises progress in BCIs and presents an exciting pathway to advance our fundamental understanding of the visual cortex.

Figure 4: Prediction accuracy comparison with vanilla model by Allen et al. [4] and baseline model by Gifford et al. [12]. ns: no significance; *\(p<0.05\); **\(p<10^{-3}\); ***\(p<10^{-4}\); ***\(p<10^{-5}\)

Figure 5: Feature map visualization with the global and local link bundling overlay (black lines) for varying image features (i.e., other, animal, person, and both [animal + person]). Sample images are displayed accordingly on the right.
## 5 Acknowledgements

The authors declare that there is no conflict of interest. A.M., K.K.L, A.K., and R.L. acknowledge funding support from the Defense Advanced Research Projects Agency (DARPA) Award (N660012024075). Q.L. acknowledges funding support from the National Institutes of Health (NIH) Award (R01NS085200). J.P. acknowledges funding support from NIH Research Training Award (5T32AR67708-8).
