Unmanned aerial vehicle (UAV) remote sensing plays a crucial role in the rapid assessment of post-earthquake damaged buildings. Existing methods for automatic identification of damaged buildings based on UAV remote sensing imagery primarily focus on assessment accuracy. However, during earthquake emergency response, both speed and accuracy of assessment are equally important. Therefore, we propose a high-precision and real-time damaged building instance segmentation model, DBA-RTMDet, based on the RTMDet framework. Three key modules are designed to enhance the network's feature extraction capability for damaged buildings. First, we develop a Depthwise Separable Atrous Spatial Pyramid Pooling Module to improve the model's ability to detect damaged buildings of varying sizes. Second, an Adjacent Level Feature Enhancement and Fusion Module is introduced to enhance the network's ability to localize the irregular boundaries of collapsed buildings. Finally, to mitigate the interference caused by intact buildings that exhibit features like partially damaged roofs, we incorporated a Cross Atrous Attention Module. We conduct experiments on post-disaster UAV imagery collected during the 2021 Yangbi earthquake with surface wave magnitude scale (Ms) of 6.4 in Yunnan, China. The results demonstrate that our model achieves a segmentation mean Average Precision (mAPseg) of 80.4% and a bounding box mean Average Precision (mAPbox) of 81.2%, significantly outperforming methods such as YOLACT, FCOS, PolarMask, TensorMask, YOLOv5, YOLOX, YOLOv6, and YOLOv8. We observed that, compared to the widely used model YOLOv5, DBA-RTMDet not only improves mAPseg and mAPbox by 10.3% and 9.7%, respectively, but also the Frames Per Second (FPS) is increased significantly by 26. Our approach can quickly and accurately identify damaged buildings, with its high application value verified through the generalization validation experiment. The code and datasets will be available at https://github.com/Kangsan-Y/UAV-based-Damaged-Buildings-Instance-Segmentation-model-DBA-RTMDet.