Using different sources of ground truths and transfer learning to improve the generalization of photometric redshift estimation