Colorectal cancer (CRC) is globally the third most common type of cancer. Colonoscopy is considered the gold standard in colorectal cancer screening and allows for the removal of polyps before they become cancerous. Computer-aided detection systems (CADs) have been developed to detect polyps. Unfortunately, these systems have limited sensitivity and specificity. In contrast, deep learning architectures provide better detection by extracting the different properties of polyps. However, the desired success has not yet been achieved in real-time polyp detection. Here, we propose a new structure for real-time polyp detection by scaling the YOLOv4 algorithm to overcome these obstacles. For this, we first replace the whole structure with Cross Stage Partial Networks (CSPNet), then substitute the Mish activation function for the Leaky ReLu activation function and also substituted the Distance Intersection over Union (DIoU) loss for the Complete Intersection over Union (CIoU) loss. We improved performance of YOLOv3 and YOLOv4 architectures using different structures such as ResNet, VGG, DarkNet53, and Transformers. To increase success of the proposed method, we utilized a variety of data augmentation approaches for preprocessing, an ensemble learning model, and NVIDIA TensorRT for post processing. In order to compare our study with other studies more objectively, we only employed public data sets and followed MICCAI Sub-Challenge on Automatic Polyp Detection in Colonoscopy. The proposed method differs from other methods with its real-time performance and state-of-the-art detection accuracy. The proposed method (without ensemble learning) achieved higher results than those found in the literature, precision: 91.62%, recall: 82.55%, F1-score: 86.85% on public ETIS-LARIB data set and precision: 96.04%, recall: 96.68%, F1-score: 96.36% on public CVC-ColonDB data set, respectively.