Solving segmentation tasks with topological priors proved to make fewer errors in fine-scale structures. In this work, we use topological priors before and during the deep neural network training procedure. We compared the results of the two approaches on a simple segmentation task using various accuracy metrics and the Betti number error metric, which is directly related to topological correctness. It was found that incorporating topological information into the classical U - Net model performed significantly better. We conducted experiments on the ISBI EM segmentation dataset to confirm the effectiveness of the proposed approaches.