In recent years, visual automatic non-destructive testing using machine vision algorithms has been widely used in industry. This approach for detecting, classifying, and segmenting defects in building materials and structures can be effectively implemented using convolutional neural networks. Using intelligent systems in the initial stages of manufacturing can eliminate defective building materials, prevent the spread of defective products, and detect the cause of specific damage. In this article, the solution to the problem of building elements flaw detection using the computer vision method was considered. Using the YOLOv5s convolutional neural network for the detection and classification of various defects of the structure, the appearance of finished products of facing bricks that take place at the production stage is shown during technological processing, packaging, transportation, or storage. The algorithm allows for the detection of foreign inclusions, broken corners, cracks, and color unevenness, including the presence of rust spots. To train the detector, our own empirical database of images of facing brick samples was obtained. The set of training data for the neural network algorithm for discovering defects and classifying images was expanded by using our own augmentation algorithm. The results show that the developed YOLOv5s model has a high accuracy in solving the problems of defect detection: mAP0.50 = 87% and mAP0.50:0.95 = 72%. It should be noted that the use of synthetic data obtained by augmentation makes it possible to achieve a good generalizing ability from the algorithm, it has the potential to expand visual variability and practical applicability in various shooting conditions.