The protection of historical buildings is limited by low-quality style imitation and large-scale demolition and reconstruction, and the work process requires a high investment of human and material resources, which restricts the inheritance and development of this material cultural heritage. How to achieve precise monitoring and protection of historical building style is a key issue that needs to be urgently solved. The gene of historical architecture is the basic unit that controls the style of historical architecture. Identifying the gene of historical architecture is to identify the decisive factor that controls the style of historical architecture, which is of great significance for precise monitoring and protection of the style of historical architecture. At present, there are subjective qualitative, difficult to quantify, poor recognition accuracy, and low efficiency in reasoning and recognition in research on genetic identification of historical buildings. Therefore, this article takes the Chinese Baroque architecture in Harbin, China as an example, drawing on the principles of biological gene recognition, referring to the methods of architectural gene recognition in cultural geography and architecture, and using improved U-net models, traditional U-net models, FCN models, and Efficient Net models that incorporate channel attention mechanisms to intelligently identify historical building genes, obtaining the optimal intelligent recognition method for historical building genes based on deep learning. Research has shown that the accuracy of the improved U-net model incorporating channel attention mechanism is 0.69, which is 0.04, 0.07, and 0.01 higher than traditional U-net (0.65), FCN (0.62), and Efficient net (0.68), respectively. Therefore, the improved U-net model is the optimal method for intelligent identification of historical building genes. Research can provide new tools and methods for the intelligent identification of historical building genes.