Abstract Otitis media (OM) and its complications can cause immense suffering for patients. However, due to the limited number of experts and their knowledge base, human specialists can only handle a limited number of CT images. Therefore, the auxiliary diagnosis of OM is crucial. Object detection is one of the primary tasks in computer vision. With the development of Transformers and attention mechanisms in recent years, the DETR series detectors have gradually become mainstream. However, these detectors are highly sensitive to the number of decoder layers, and slight deviations in the layers significantly impair model performance. The required number of decoder layers varies across different datasets, with grayscale images such as CT scans likely needing a different number of decoder layers than color images. Considering the stringent requirements for performance in clinical CT diagnostics, this paper analyzes the decline in model effectiveness due to excessive decoder layers. It proposes a new model called 4DO-DETR to address the instability issues of DETR performance. Regarding performance, 4DO-DETR has shown significant improvement over the baseline model (DN-DAB-DETR), surpassing the state-of-the-art (SOTA) algorithms Co-DETR, DINO and RT-DETR in the past two years. Rigorous experimental evaluations on a benchmark medical dataset demonstrate that our method achieves higher scores than other sophisticated network models——our model’s mAP reached 56.8%, higher than DINO’s 54.7%, Co-DETR’s 54.0%, and the baseline’s 45.1%. The datasets employed in this paper are available at https://github.com/promisedong/Four-DO-DETR. Similar content being viewed by others Introduction Otitis media (OM) is a common ear disease worldwide that can lead to hearing loss, ear pain, and, in severe cases, serious complications such as facial paralysis and intracranial infection1. Accurate and timely diagnosis is therefore crucial for effective treatment and prevention of complications. Computed tomography (CT) imaging plays an important role in OM detection, providing high-resolution three-dimensional views of the