The research deals with the development of an algorithm for detecting pathological formation in cystic fibrosis using the PSPNet model with focal loss. The model allows data sets to be entered in accordance to their similarities based on their pathological diagnostic signs. The simple and effective algorithm structure groups annotated images, processes them in a multi-scale CNN, and localizes areas of cystic fibrosis in the lungs with high accuracy.