AbstractWith the popularization and application of artificial intelligence and medical image big data in the field of medical image, the universality of modes and the rapid development of deep learning have endowed multi-mode fusion technology with great development potential. Technologies of 5G and artificial intelligence have rapidly promoted the innovation of online hospitals. To assist doctors in the remote diagnosis of cancer lesions, this article proposes a cancer localization and recognition model based on magnetic resonance images. We combine a convolution neural network with Transformer to achieve local features and global context information, which can suppress the interference of noise and background regions in magnetic resonance imaging. We design a module combining convolutional neural networks and Transformer architecture, which interactively fuses the extracted features to increase the cancer localization accuracy of magnetic resonance imaging (MRI) images. We extract tumor regions and perform feature fusion to further improve the interactive ability of features and achieve cancer recognition. Our model can achieve an accuracy of 88.65%, which means our model can locate cancer regions in MRI images and effectively identify them. Furthermore, our model can be embedded into the online hospital system by 5G technology to provide technical support for the construction of network hospitals.