  The accurate estimation of photometric redshifts plays a crucial role in
accomplishing science objectives of the large survey projects. The
template-fitting and machine learning are the two main types of methods applied
currently. Based on the training set obtained by cross-correlating the DESI
Legacy Imaging Surveys DR9 galaxy catalogue and SDSS DR16 galaxy catalogue, the
two kinds of methods are used and optimized, such as EAZY for template-fitting
approach and CATBOOST for machine learning. Then the created models are tested
by the cross-matched samples of the DESI Legacy Imaging SurveysDR9 galaxy
catalogue with LAMOST DR7, GAMA DR3 and WiggleZ galaxy catalogues. Moreover
three machine learning methods (CATBOOST, Multi-Layer Perceptron and Random
Forest) are compared, CATBOOST shows its superiority for our case. By feature
selection and optimization of model parameters, CATBOOST can obtain higher
accuracy with optical and infrared photometric information, the best
performance ($MSE=0.0032$, $\sigma_{NMAD}=0.0156$ and $O=0.88$ per cent) with
$g \le 24.0$, $r \le 23.4$ and $z \le 22.5$ is achieved. But EAZY can provide
more accurate photometric redshift estimation for high redshift galaxies,
especially beyond the redhisft range of training sample. Finally, we finish the
redshift estimation of all DESI DR9 galaxies with CATBOOST and EAZY, which will
contribute to the further study of galaxies and their properties.
