The battle against thoracic illnesses has been a major focus in the fields of machine learning and computer vision. Radiology has made significant advancements in the early detection of thoracic disorders. Chest X-rays have become a commonly employed procedure for identifying and categorizing such diseases. However, the shortage of qualified radiologists presents a challenge to accurate diagnosis. Recently, there has been growing interest in the utilization of convolutional neural network (CNN) models for classifying thoracic diseases. Nevertheless, CNNs have limitations in handling translation and rotation in input data, primarily due to the need for extensive training datasets. To address these limitations, capsule networks (CapsNN) have emerged as a novel architecture for automatic learning. CapsNNs are particularly well-suited for managing complex translation and rotation tasks. In this study, a thoracic-cap modelling framework based on CapsNNs was proposed as an alternative approach capable of working with small datasets. Experimental results utilizing a collection of X-ray images demonstrate that the proposed thoracic-caps model outperforms previous CNN-based models, achieving an accuracy of 96.46%. A total of 3043 images of healthy individuals and patients with various thoracic problems were utilized. These findings underscore the effectiveness of CapsNN, a deep fusion neural network, in identifying different thoracic diseases using chest X-ray radiography.