Context-Aware Image Intelligence Using Hybrid Cnn–Transformer Architectures
DOI:
https://doi.org/10.51483/IJAIML.2835Keywords:
computer vision, context-aware image understanding, CNN, Transformer, attention, hybrid deep learning, CAICD benchmark, image classification.Abstract
Convolutional neural networks (CNNs) are effective for recovery. Local visual features, While transformer- based architectures offer a mechanism for modeling long- range contextual dependencies. This study proposes a context-aware hybrid CNN–Transformer architecture that integrates convolutional feature extraction, visual-token context modeling, and attention-guided feature fusion for image classification. To enable reproducible evaluation under controlled conditions, the proposed approach is assessed on a purpose-built Context-Aware Image Classification Dataset (CAICD), comprising 3,600 balanced 32×32 grayscale images distributed across six shape classes: Circle, Square, Triangle, Cross, Ring, and Checker. The dataset is divided into 2,400 training, 600 validation, and 600 held-out test images, with 100 test images per class, using a fixed random seed of 42. CPU-based PyTorch experiments evaluate a CNN-only baseline and progressively enhanced hybrid configurations trained for eight epochs using the Adam optimizer and cross-entropy loss. The executed results yield 100% test accuracy and macro-F1 for both the CNN-only baseline and the complete hybrid model, while the intermediate CNN+Transformer and attention-fusion configurations achieve macro-F1 scores of 0.9900 and 0.9960, respectively. The complete hybrid architecture contains 99,110 trainable parameters and records a CPU inference latency of 0.336 ms per image in the reported execution. These findings demonstrate reproducible performance on the CAICD benchmark under the specified experimental conditions; they should not be interpreted as evidence of generalization to clinical, industrial, or other real-world image domains





