To address the problem that the direction of pipe cracks is difficult to detect, a crack direction recognition method based on prototype learning is proposed with a prototype network as a framework. First, through the convolutional layer of the prototype network, shallow features of crack directions are extracted to improve the generalization ability of the model on the data set of this paper. then, by improving the High-Resolution Network and introducing a location self-attention mechanism, and combined with a migration training method for the data set of this paper, a category that can accurately reflect the crack directions is constructed prototype learning mechanism. Finally, pattern recognition is performed by the metric classification methods, the effective classification of crack direction under small sample condition is achieved. The experimental results show that the recognition accuracy of the crack direction recognition method based on prototype learning can reach 99.2% with the sample parameters unchanged.