As a practical and challenging task, deep learning-based methods have achieved effective results for fabric defect detection, however, most of them mainly target detection accuracy at the expense of detection speed. Therefore, we propose a fabric defect detection method called PEI-YOLOv5. First, Particle Depthwise Convolution (PDConv) is proposed to extract spatial features more efficiently while reducing redundant computations and memory access, reducing model computation and improving detection speed. Second, Enhance-BiFPN(EB) is proposed based on the structure of BiFPN to enhance the attention of spatial and channel feature maps and the fusion of information at different scales. Third, we improve the loss function and propose IN loss, which improves the problem that the original IOU loss is weak in detecting small targets while speeding up the convergence of the model. Finally, five more common types of defects were selected for training in the GuangDong TianChi fabric defect dataset, and using our proposed PEI-YOLOv5 with only 0.2 Giga Floating Point Operations (GFLOPs) increase, the mAP improved by 3.61%, reaching 87.89%. To demonstrate the versatility of PEI-YOLOv5, we additionally evaluated this in the NEU surface defect database, with the mAP of 79.37%. The performance of PEI-YOLOv 5 in these two datasets surpasses the most advanced fabric defect detection methods at present. We deployed the model to the NVIDIA Jetson TX2 embedded development board, and the detection speed reached 31 frames per second (Fps), which can fully meet the speed requirements of real-time detection.