# Cognitive Electronic Unit for AI-Guided Real-Time Echocardiographic Imaging
## 2 Materials and Methods
### Neural Network Model and Data Capture  
The CNN models used for cardiac projection classification (presented in Figure 3) and quality classification (presented in Figure 4) were both designed to balance computational complexity and generalization capacity, making them suitable for smaller datasets. The balance between computational complexity and generalization capacity was evaluated as a tradeoff between validation accuracy, inference time, and resource efficiency. The architecture comprises several layers, each of which performs specific operations to extract features and classify images. The original images were in NIfTI format and had different sizes; thus, they were converted into JPG format and resized to a resolution of \(64\times 64\times 3\). This resolution was chosen as a compromise between preserving sufficient spatial information for classification and meeting the computational constraints of the deployment environment by keeping the inference computational cost lower. Each pixel is represented on 8 bits. Figure 2: Examples of 4 CH and 2 CH cardiac views at different quality levels: (**a**) 4 CH good quality, (**b**) 4 CH poor quality, (**c**) 2 CH good quality, and (**d**) 2 CH poor quality. The first CNN model begins with a convolutional layer that applies eight filters of size \(3\times 3\) on each input image (\(64\times 64\times 3\)). This convolutional layer uses a stride of [1,1] and'same' padding in order to maintain output dimensions equal to the input and preserve the spatial dimensions of the feature maps across convolutional layers. Following the convolution, a rectified linear unit (ReLU) activation function [26] introduces nonlinearity into the model, which is essential for learning complex data relationships. To mitigate overfitting, a dropout layer with a 30% dropout rate is applied to randomly deactivate neurons during training. A dropout rate of 30% was selected through an iterative process in which different values were tested empirically. The second stage involves another convolutional layer, this time with 16 filters of size \(3\times 3\), maintaining the same stride and padding settings. The ReLU activation function is used again to ensure nonlinearity. Subsequently, a max pooling layer with a pool size of [2,2] and stride of [2,2] reduces the spatial dimensions of the input while preserving the most significant features. This choice  
Figure 4: CNN architecture for image quality classification. This architecture was configured with a modest number of layers to reduce memory usage and allow for rapid inference while preserving sufficient capacity to reliably differentiate image quality in resource-constrained scenarios. Figure 3: CNN architecture for cardiac projection classification. This architecture was designed with shallow convolutional layers and limited fully connected blocks in order to balance accuracy and computational load while supporting real-time inference on embedded hardware. was based on its ability to highlight the strongest activations within each region, which is particularly effective in compact architectures. In the third stage, the model includes a third convolutional layer with 32 filters of size \(3\times 3\), followed by a max pooling layer with an identical configuration to the previous one. This further reduces the spatial dimensions of the input, ensuring that the model focuses on the most prominent features. The output from the previous layers is then flattened into a one-dimensional vector to prepare it for the fully connected layers. The first fully connected layer consists of 32 units, with a ReLU activation function to introduce further nonlinearity. The final fully connected layer is the output layer. It comprises three units, corresponding to the number of classes in the classification problem. This layer uses a softmax activation function to assign probabilities to each class. The second CNN model is designed for image quality classification.