A transient two-dimensional heat transfer model is built and solved using the finite element method for the study of the temperature distribution rules of a pipeline with an irregular inner boundary when heated by the hot circulating fluid, and, at the same time, based on a conjugate gradient method, an algorithm is presented for the identification of the irregular inner boundary by thermographic temperature measurements of the outer pipeline surface. Numerical experiments are conducted in order to verify the effectiveness of the algorithm and also to investigate the influence of the test piece property, temperature measurement error, etc on the identification results. It is concluded that the algorithm can efficiently solve this boundary identification problem, the effect of the initial boundary guess is negligible, and the algorithm based on curves of the maximum temperature difference (MTD) can significantly reduce the effect of the measurement error.