To measure the centrality in heavy ion reactions in the future experiments CBM@FAIR, BM@N, NA61/SHINE@SPS and MPD@NICA the forward hadron calorimeters with transverse and longitudinal segmentations will be used. All these calorimeters have the beam hole in the center. This feature leads to uncertainty in determining the centrality, since in this case the total energy deposition in the calorimeter depends non-monotonically on the impact parameter. New approach using machine learning methods was developed to solve the problem of centrality determination by the calorimeters with the beam hole. This approach uses information about the spatial energy distribution of spectators in calorimeter. Details of this new approach for centrality determination and first results of applying the approach to the simulation data will be shown. This work was supported by the Russian Foundation of Basic Research (RFBR) Grants №18-02-40081 and №18-02-40065.