Cracks have hidden safety hazards to public facilities, so crack detection is essential for the maintenance of public facilities. Due to the interference of noise, light, shadow, and other factors in the crack images, the neural network is easily affected during the training process, which causes deviations in the prediction results and reduces the prediction effect. To suppress these disturbances, a parallel attention mechanism is designed and then the parallel attention based UNet(PA-UNet) is proposed by embedding this attention mechanism into UNet. The parallel attention mechanism increases the weights of crack features from the two dimensions of channel and space to suppress interference, then fuses the features generated by these two dimensions to obtain more complementary crack features. To verify the effectiveness of the proposed method, we have conducted experiments on four data sets. Experimental results show that our method outperforms the existing popular methods. Meanwhile, to demonstrate the effectiveness of the parallel attention mechanism, we conduct a comparative experiment with other four attention mechanisms. The results show that the parallel attention mechanism performs better than others.