In order to realize the digital inheritance and development of ancient village buildings, this paper considers the application of artificial intelligence algorithms to ancient village buildings. Taking the ancient village buildings in Henan Province as an example, deep learning methods such as U²-Net and YOLO, convolutional neural network, etc. are used to identify the overall recognition and color recognition of the ancient village buildings in the place, so as to realize the extraction of the genes of the ancient village buildings in Henan Province. On the basis of the results of building recognition, the factors such as façade styles, roof shapes, decorative patterns, color matching, and building materials of the ancient village buildings are analyzed. Through quantitative analysis of the statistical results, the architectural genealogy of ancient villages in Henan Province was constructed. The genes of façade style, roof shape, decorative pattern, color matching, and building materials of ancient villages in Henan Province are closely related to each typical building, and the characteristics of ancient villages with different buildings are different. The architectural layout of the ancient villages in Henan Province is dominated by 6 rooms with broad faces. 6-room a zigzag with three bright, two dark and two dumping sleeves plan layout is the architectural prototype, and the number of two-story attic variants is 1.5 times of the prototype.