The new method is proposed for the numerical solution of a class of shape inverse problems. The size and the location of a small opening in the domain of integration of an elliptic equation is identified on the basis of a observation. The observation includes the finite number of shape functionals. The approximation of the shape functionals by using the so-called topological derivatives is used to perform the learning process of an artificial neural network. The results of computations for 2D examples show that the method allows to determine an approximation of the global solution to the inverse problem, sufficiently closed to the exact solution. The proposed method can be extended to the problems with an opening of general shape and to the identification problems of small inclusions