Chinese traditional dwelling roof type identification method based on deep neural network

Based on a method based on deep neural networks, build a classification standard for the type of roof type of traditional Chinese residential houses, and use the YOLOV8X pre -training training model training identification model to solve the problem of the lack of national roof type detection methods in the existing technology, and realize the rapid and accurate accurate and accurate accuracy Study and distribution of roof type identification and distribution.

CN119380177APending Publication Date: 2025-01-28SOUTH CHINA UNIV OF TECH +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411217797.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-02
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

The existing technology lacks detection methods for traditional Chinese house roof types, and the research on the distribution of existing roof types is mainly based on small-scale and remote sensing images, making it difficult to achieve fast and accurate identification nationwide.

Method used

Adopting a method based on deep neural networks, by constructing the classification standards of traditional Chinese residential roof types, and using YOLOV8X pre -training training model training optimization models, enter the national traditional residential image image to identify.

Benefits of technology

The rapid and accurate testing of traditional residential building roofs with various types and observation perspectives in China have provided demonstration support for the research of traditional residential roof type distribution research in the field of traditional residential roof types in China, and reduced the cost of manpower and material resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119380177A_ABST
    Figure CN119380177A_ABST
Patent Text Reader

Abstract

The invention discloses a Chinese traditional dwelling roof type identification method based on a deep neural network, and the method comprises the following steps: making a training set and a verification set of Chinese full-type traditional dwelling roof images, including 26 types of traditional dwelling roof type images with feature differences; by using the training set and the verification set, on the basis of the pre-weight model YOLOv8x, training to obtain an optimized traditional dwelling roof type identification model; and inputting a to-be-predicted image set with geographical semantic information into the model to obtain a traditional dwelling roof type identification result of different county-level administrative units in China. The method can be used for rapid and accurate detection of various roof types of traditional dwellings in China, and the identification result can be used as a demonstration support for traditional dwelling roof type distribution research.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of building roof detection, and in particular to a method for identifying the roof types of traditional Chinese dwellings based on a deep neural network. Background Art

[0002] As traditional Chinese dwellings are widely distributed in rural areas across the country, professional surveys lack overall quantitative statistics, which requires a lot of manpower, financial resources, time and energy. It is difficult to quickly obtain the distribution characteristics of traditional dwelling roof types through field surveys. In addition, the types of traditional dwelling roofs are rich and varied, and different roof types have commonalities and their own obvious characteristics, resulting in unclear standards for the classification of traditional dwelling roof types. The identification of traditional Chinese dwelling roof types across the country further increases the difficulty of identification.

[0003] The main problems with the current testing methods for traditional Chinese residential roof types:

[0004] (1) No roof inspection method for traditional residential buildings has been proposed. Existing technologies focus on roof inspection methods for modern buildings, but lack research on roof type inspection in rural areas.

[0005] (2) No detection method for the roof types of traditional residential buildings in China has been proposed. Existing research methods for the distribution of roof types are mainly based on small-scale, case-specific areas, and lack detection technology for the roof types of traditional residential buildings across the country.

[0006] (3) No roof detection method based on ground photos has been proposed. Existing detection methods are mainly based on remote sensing images as basic data sets, which makes data acquisition difficult and time-consuming. Summary of the invention

[0007] The purpose of the present invention is to solve the above-mentioned defects in the prior art and provide a method for identifying the roof types of traditional Chinese residential buildings based on a deep neural network. The method is based on the classification standard of traditional residential roof types, controls the roof type parameters of traditional residential buildings in the training set and the verification set, and obtains an optimized Chinese traditional residential roof type recognition model based on the YOLOv8x pre-trained weight model training. The image of traditional residential buildings across the country is input to obtain the recognition result. The method can be used for the rapid and accurate detection of traditional residential building roofs of various types and two observation perspectives in the whole area of ​​China, and the recognition results can be used as a demonstration support for the research on the distribution of traditional residential roof types in the whole of China.

[0008] The purpose of the present invention can be achieved by adopting the following technical solutions:

[0009] A method for identifying the roof types of traditional Chinese residential buildings based on a deep neural network is proposed. Based on the ground image features of the roof types of traditional residential buildings, the method takes the roof types of traditional residential buildings as the target and realizes the identification and recognition of the roof types of traditional residential buildings in the whole region of China. The method includes the following steps:

[0010] S1. Obtain images of traditional Chinese dwellings: Obtain images of traditional Chinese dwellings from a public image data website to form an image set D to be identified;

[0011] S2. Construct the standard of roof types of traditional Chinese residential buildings: The types of roofs of traditional Chinese residential buildings are obtained by sorting out the public literature data, and the standard of roof types of traditional Chinese residential buildings is defined as 26 roof types and 41 target types;

[0012] S3, preparing training set and verification set: in the image set D to be identified, select and annotate traditional residential images containing 41 target types to form training set T and verification set Y, wherein both the training set T and verification set Y contain 41 target types:

[0013] S4. Training recognition model: Use the training set T produced in the previous step to train on the basis of the YOLOv8x pre-trained weight model, and verify on the verification set Y to obtain a Chinese traditional residential roof type recognition model;

[0014] S5. Identify the roof types of traditional Chinese dwellings: Input the images in the to-be-identified image set D into the traditional dwelling roof type identification model for identification, and obtain the roof type identification result in each image by calculation.

[0015] Further, in step S1, the image set D to be identified is the image of traditional dwellings of various county-level administrative units in China. The image is collected using a public image data website, and the keywords "name of Chinese county-level unit" + "traditional dwelling" are input for searching, and the image of the traditional dwelling of the county-level administrative unit is verified and obtained, and named with the name of the county-level unit to produce the image set D to be identified with geographic semantic information. The use of county-level administrative units mainly has the following considerations: First, the purpose of the present invention is to identify the roof types of various types of traditional dwellings in China, and the image must have the semantics of national geographic spatial information. Divided by county-level administrative units, the name of each geographical unit will not be repeated, which can reduce the error of image confusion caused by the same name and improve the recognition accuracy; on the other hand, the appearance characteristics of the roof of traditional dwellings at the county level have a small change range and are representative; at a larger level of administrative units such as cities and provinces, there are more types of traditional dwelling roofs, which may be omitted in the image collection stage; and at a smaller level of administrative units such as towns and villages, the appearance characteristics of the roof of traditional dwellings change less, which will increase the repeatability of the data set and reduce work efficiency.

[0016] Furthermore, the pixel requirements of the Chinese traditional dwelling images in the image set to be identified in step S1 are as follows:

[0017] The recognizable pixels of the traditional Chinese residential images are determined by the proportion of the image occupied by the building. Traditional Chinese residential buildings are composed of building units, courtyards, corridors and other elements, which are the main factors that distinguish the morphology of traditional Chinese residential buildings from other buildings. However, due to the different distances from the building and the different equipment used for each ground-shot image, the position and scale of the traditional residential buildings on the image will be different. Therefore, the pixel areas occupied by images of traditional residential buildings of different shapes vary greatly. Therefore, it is necessary to ensure that small-scale traditional Chinese residential buildings can be accurately identified. In order to avoid missing detection due to too few characteristic pixels of small-scale traditional Chinese residential buildings after convolution, it is necessary to ensure that the proportion of the image pixels occupied by the main body of the traditional residential buildings in the image is greater than or equal to 50%, and the image format is jpg.

[0018] Furthermore, in step S2, the standard construction of roof types of traditional Chinese dwellings includes 26 roof types, forming 41 target types. This method is based on the combination of authoritative literature combing and expert opinions, and has formed 26 main traditional residential roof types distributed in various regions of China; due to the differences in the features presented by some roof types from the ground perspective and the top view perspective, the roof is observed from the ground perspective mainly based on the features of the eaves, ridges, gables, beams, drips, and tiles, while from the top view perspective, the ridge, eaves, ridges, beasts, and tiles are mainly composed of features, which will affect the accuracy of the model judgment. Therefore, this type of roof type is selected as two target objects, that is, the ground perspective and the top view of the roof style are used as target objects. Finally, the 26 roof types form 41 target types. Specifically, the 26 roof types and 41 target types are:

[0019] The first roof type is the flat-roofed traditional dwelling, denoted as WD_PD_PD, which corresponds to two types of flat-roofed targets at two observation angles, namely the flat-roofed traditional dwelling from the ground perspective and the flat-roofed traditional dwelling from the top-down perspective, denoted as WD_PD_PD_DM and WD_PD_PD_FS, respectively;

[0020] The second roof type is the traditional residence with a single-slope roof, denoted as WD_DPD_DPD, which corresponds to the single-slope roof target types of two observation perspectives, namely the traditional residence with a single-slope roof from the ground perspective and the traditional residence with a single-slope roof from the top perspective, denoted as WD_DPD_DPD_DM and WD_DPD_DPD_FS respectively;

[0021] The third roof type is the traditional residence with hip roof, denoted as WD_RZPD_YSJPD, which corresponds to two types of hip roof targets from different viewing angles, namely the traditional residence with hip roof from the ground perspective and the traditional residence with hip roof from the top-down perspective, denoted as WD_RZPD_YSJPD_DM and WD_RZPD_YSJPD_FS respectively.

[0022] The fourth roof type is the traditional dwelling with a gable roof, denoted as WD_RZPD_YSJD, which corresponds to two types of gable roof target types from different observation angles, namely the traditional dwelling with a gable roof from the ground perspective and the traditional dwelling with a gable roof from the top-down perspective, denoted as WD_RZPD_YSJD_DM and WD_RZPD_YSJD_FS, respectively.

[0023] The fifth roof type is the traditional dwelling with gable roof, denoted as WD_RZPD_XSJD, which corresponds to two types of gable roof target types from different observation angles, namely the traditional dwelling with gable roof from the ground perspective and the traditional dwelling with gable roof from the top-down perspective, denoted as WD_RZPD_XSJD_DM and WD_RZPD_XSJD_FS respectively;

[0024] The sixth roof type is the traditional residence with a gable roof, recorded as WD_RZPD_XSJPD, and corresponds to a target type of gable roof from one viewing angle, which is the traditional residence with a gable roof from the ground viewing angle, recorded as WD_RZPD_XSJPD_DM.

[0025] The seventh roof type is the traditional residence with gable roof, denoted as WD_RZPD_XSPY, which corresponds to two types of target types of gable roof from different observation angles, namely the traditional residence with gable roof from the ground perspective and the traditional residence with gable roof from the top-down perspective, denoted as WD_RZPD_XSPY_DM and WD_RZPD_XSPY_FS respectively.

[0026] The eighth roof type is the traditional residence with gable roof, denoted as WD_RZPD_RZCD, which corresponds to two types of target types with gable roof from different observation angles, namely the traditional residence with gable roof from the ground perspective and the traditional residence with gable roof from the top perspective, denoted as WD_RZPD_RZCD_DM and WD_RZPD_RZCD_FS respectively;

[0027] The ninth roof type is the traditional residence with four-slope ridge roof, denoted as WD_SPD_SPJD, which corresponds to two types of four-slope ridge roof target types at two observation angles, namely the traditional residence with four-slope ridge roof at the ground perspective and the traditional residence with four-slope ridge roof at the top perspective, denoted as WD_SPD_SPJD_DM and WD_SPD_SPJD_FS respectively;

[0028] The tenth roof type is the four-slope grass-roof traditional dwelling, denoted as WD_SPD_SPCD, which corresponds to the four-slope grass-roof target types at two observation angles, namely the four-slope grass-roof traditional dwelling from the ground perspective and the four-slope grass-roof traditional dwelling from the top-down perspective, denoted as WD_SPD_SPCD_DM and WD_SPD_SPCD_FS respectively;

[0029] The 11th roof type is the traditional residence with hipped roof, denoted as WD_WDD_WDD, which corresponds to the hipped roof target types of two observation angles, namely the traditional residence with hipped roof from the ground perspective and the traditional residence with hipped roof from the top-down perspective, denoted as WD_WDD_WDD_DM and WD_WDD_WDD_FS respectively;

[0030] The 12th roof type is the traditional residence with hip roof, recorded as WD_XSD_XSD, which corresponds to two types of hip roof target types from different viewing angles, namely the traditional residence with hip roof from the ground perspective and the traditional residence with hip roof from the top-down perspective, recorded as WD_XSD_XSD_DM and WD_XSD_XSD_FS respectively;

[0031] The 13th roof type is the traditional residence with hip-and-gable roof and cross-ridge roof, denoted as WD_XSD_XSSZJD, which corresponds to the target types of hip-and-gable roof and cross-ridge roof from two observation angles, namely the traditional residence with hip-and-gable roof and cross-ridge roof from the ground perspective and the traditional residence with hip-and-gable roof and cross-ridge roof from the top-down perspective, denoted as WD_XSD_XSSZJD_DM and WD_XSD_XSSZJD_FS respectively;

[0032] The 14th roof type is the traditional residence with hipped roof, recorded as WD_XSD_XSJPD, which corresponds to the target types of hipped roof with hipped roof from two observation perspectives, namely the traditional residence with hipped roof from the ground perspective and the traditional residence with hipped roof from the top perspective, recorded as WD_XSD_XSJPD_DM and WD_XSD_XSJPD_FS respectively;

[0033] The 15th roof type is the traditional residence with a polygonal peak roof, recorded as WD_CJD_DBCJD, which corresponds to two types of polygonal peak roof target types from different observation perspectives, namely the traditional residence with a polygonal peak roof from the ground perspective and the traditional residence with a polygonal peak roof from the top-down perspective, recorded as WD_CJD_DBCJD_DM and WD_CJD_DBCJD_FS respectively;

[0034] The 16th roof type is a traditional residence with a rounded spire, recorded as WD_CJD_YXCJD, corresponding to a target type of rounded spire from a viewing angle, which is a traditional residence with a rounded spire from a ground viewing angle, recorded as WD_CJD_YXCJD_DM;

[0035] The 17th roof type is the traditional dwelling with dense eaves, recorded as WD_MYD_MYD, which corresponds to the target types of dense eaves from two observation perspectives, namely the traditional dwelling with dense eaves from the ground perspective and the traditional dwelling with dense eaves from the top perspective, recorded as WD_MYD_MYD_DM and WD_MYD_MYD_FS respectively;

[0036] The 18th roof type is the helmet-top traditional dwelling, recorded as WD_KD_KD, corresponding to one observation angle of the helmet-top target type, which is the helmet-top traditional dwelling from the ground perspective, recorded as WD_KD_KD_DM;

[0037] The 19th roof type is the traditional folk house with a conical roof, recorded as WD_YZD_YZD, and corresponds to one type of the conical roof target type at one observation angle, which is the traditional folk house with a conical roof at the ground perspective, recorded as WD_YZD_YZD_DM;

[0038] The 20th roof type is the traditional folk house with conical grass roof, recorded as WD_YZD_YZCD, corresponding to one target type of conical grass roof at one observation angle, which is the traditional folk house with conical grass roof at the ground perspective, recorded as WD_YZD_YZCD_DM;

[0039] The 21st roof type is the traditional dwelling with a dome roof, recorded as WD_QLD_QLD, and corresponds to one dome roof target type of observation angle, which is the traditional dwelling with a dome roof from the ground perspective, recorded as WD_QLD_QLD_DM;

[0040] The 22nd roof type is the traditional dwelling with a roof, recorded as WD_TD_TD, corresponding to one type of roof target type at one observation angle, which is the traditional dwelling with a roof from the ground perspective, recorded as WD_TD_TD_DM;

[0041] The 23rd roof type is the traditional dwelling on the cave roof, recorded as WD_DXD_DXD, corresponding to one cave roof target type of observation angle, which is the traditional dwelling on the cave roof from the ground perspective, recorded as WD_DXD_DXD_DM;

[0042] The 24th roof type is a triangular roof traditional dwelling, recorded as WD_SJD_SJD, corresponding to one triangular roof target type of observation angle, which is a triangular roof traditional dwelling from the ground perspective, recorded as WD_SJD_SJD_DM;

[0043] The 25th roof type is a traditional residence with a western-style roof, recorded as WD_XSWD_XSWD, and corresponds to a western-style roof target type with one observation angle, which is a traditional residence with a western-style roof from the ground perspective, recorded as WD_XSWD_XSWD_DM;

[0044] The 26th roof type is the traditional dwelling with a felt tent roof, denoted as WD_ZZD_ZZD, and corresponds to one target type of felt tent roof from a viewing angle, which is the traditional dwelling with a felt tent roof from a ground viewing angle, denoted as WD_ZZD_ZZD_DM.

[0045] Furthermore, since there is no publicly available dataset of traditional Chinese residential roof types for use in the present invention, the present invention collects and creates a training set T and a validation set Y of traditional Chinese residential roof types. The image collection process is as follows: Analyze the color features, style features, and material features of different roofs to determine the roof type image examples ( Figure 2 ), enter the roof type as a keyword in the public image data platform, and obtain the roof type images of various traditional Chinese residential buildings by comparing the roof type image examples. Specifically, the characteristics of each roof type example are as follows:

[0046] The first type of roof is the flat-roofed traditional dwellings. The roof of the flat-roofed traditional dwellings is flat with a small slope, which is quite different from other types of sloping roofs in terms of image morphological characteristics.

[0047] The second type of roof is the single-slope traditional residence. The roof of the single-slope traditional residence has only one slope, but it is very similar to other two-slope traditional residences when viewed from the front. Therefore, when acquiring images of the single-slope traditional residence from the ground perspective, images from different angles should be included.

[0048] The third type of roof is the traditional folk house with a gable roof. The gable roof has four vertical ridges and no main ridge. It belongs to the gable roof type. Its image feature is that the curved surface is made at the connection between the two slopes of the roof.

[0049] The fourth type of roof is the traditional residence with a gable roof. The roof of the traditional residence with a gable roof has a main ridge and four vertical ridges, and the roof is flush with the gable at the top of the gable wall.

[0050] The fifth type of roof is the traditional dwelling with gable roof. Like the traditional dwelling with gable roof, the traditional dwelling with gable roof has a main ridge and four vertical ridges. The difference is that the roof of the gable roof extends beyond the gable.

[0051] The sixth type of roof is the traditional dwelling with a gable roof. The gable roof is composed of four vertical ridges and no main ridge. It is a gable roof. The roof extends beyond the gable, and the connection between the two slopes of the roof is made into an arc-shaped curved surface.

[0052] The seventh roof type is the traditional folk house with a gabled roof and eaves. The gabled roof is composed of a gabled ridge and an eaves on the gable. The lower end of the gabled ridge extends out of the gable and overlaps at the eaves. The eaves divides the gable into two parts, upper and lower, to provide shelter from wind and rain.

[0053] The eighth type of roof is the traditional residence with gable roof. The gable roof is a double-sloped roof, and its outermost surface is covered with straw, thatch, seaweed and other materials. The image characteristics it shows are quite different from those of traditional tile roofs in terms of texture and color.

[0054] The ninth type of roof is the four-slope ridge traditional dwelling. The roof of the four-slope ridge traditional dwelling consists of four slopes and five ridges, and its covering is mostly made of tiles, stones and other materials;

[0055] The tenth roof type is the traditional four-slope thatched roof house, which is similar to the four-slope ridge roof traditional house in terms of roof structure, but is covered with straw, thatch, seaweed and other grass materials;

[0056] The 11th roof type is the traditional residence with a hip roof. The roof of the traditional residence with a hip roof consists of a main ridge and four vertical ridges, and there are slopes on all four sides of the roof.

[0057] The 12th roof type is the traditional residence with a hip roof. The roof of the traditional residence with a hip roof consists of a main ridge, four vertical ridges and four gable ridges. Its most obvious feature is that the main ridge and two vertical ridges at the top form a triangular vertical area, called a pediment.

[0058] The 13th roof type is the traditional residence with a hip roof and a cross ridge. The roof of the traditional residence with a hip roof and a cross ridge is formed by two hip roofs intersecting in a cross shape, with pediments on all four sides.

[0059] The 14th roof type is the hip-and-gable traditional dwelling. The hip-and-gable traditional dwelling has four vertical ridges and four gable ridges, which is a hip-and-gable roof. Its image feature is that the two slopes of the roof are connected by an arc-shaped curved surface.

[0060] The 15th roof type is the traditional dwelling with a polygonal peaked roof. The polygonal peaked roof has no main ridge but only vertical ridges. The number of vertical ridges depends on the actual building plan.

[0061] The 16th roof type is the traditional folk house with a rounded peaked roof. The roof of the traditional folk house with a rounded peaked roof has no ridge and the roof is round in shape when viewed from above.

[0062] The 17th roof type is the traditional dwelling with dense eaves. The roof of the traditional dwelling with dense eaves is formed by multiple identical roofs overlapping on the same building.

[0063] The 18th roof type is the helmet-shaped traditional dwelling. The roof of the helmet-shaped traditional dwelling has no main ridge, and the vertical ridges meet in the middle of the roof. Unlike the pointed roof, the upper part of the slope and vertical ridge of the helmet-shaped roof is convex outward, and the lower part is concave inward. The cross section is like a bow, like a helmet.

[0064] The 19th roof type is the traditional folk house with a conical roof. The conical roof is a type of roof with a conical shape, and bark and stone are the main materials.

[0065] The 20th roof type is the traditional folk house with a conical thatch roof. The conical thatch roof is a conical roof type with grass as the main material.

[0066] The 21st roof type is the traditional residence with a dome roof. The roof of the traditional residence with a dome roof is approximately hemispherical in appearance.

[0067] The 22nd roof type is the traditional dwelling with a tun-top roof. The roof of the traditional dwelling with a tun-top roof is slightly arched and arc-shaped, slightly lower at the front and back and slightly higher in the middle.

[0068] The 23rd roof type is the cave roof traditional dwelling, which is a building form directly excavated into the mountain;

[0069] The 24th roof type is the traditional folk house with a triangular roof. The triangular roof is a double-slope roof. The biggest difference from the double-slope roof mentioned above is that the slope angle of the triangular roof is greater than 45°.

[0070] The 25th roof type is the traditional residence with western-style roof. The traditional residence with western-style roof is a kind of building style influenced by western culture. The facade style is varied and colorful. The roof is usually composed of multiple geometric bodies, with different heights and different densities.

[0071] The 26th roof type is the traditional folk house with a felt tent roof. The roof of the traditional folk house with a felt tent roof is mostly made of leather and cloth, supported by wooden sticks. It is a detachable building form used by nomadic peoples, with black and white as the main colors in the image.

[0072] Not all roof types exist independently and have distinct features. Some roof types evolve through mutual influence and retain some similar features. Therefore, in order to ensure the accuracy of each roof type recognition, the number of sample images of each target type is ≥120, and the total number of samples of a single target type is ≥240;

[0073] Furthermore, in the step S3, the labeling method of the traditional dwelling images including the roof type is implemented by the Labelimg image labeling tool. Specifically, the labeling method of the 41 target types should include the complete roof range into the labeling box, rather than the entire traditional dwelling into the labeling box, because the contour information is very important for model training, and it can distinguish different types of targets. There should be no gap between the labeling box and the labeled object to avoid interference with the recognition caused by similar parts below the building roof; every object in the image should be labeled and should not be omitted, because partial markings will cause the roof to be recognized as the background, reducing the recognition accuracy; it should be ensured that the box coordinates are not on the image boundary to prevent out-of-bounds errors during data loading or data expansion;

[0074] Furthermore, the YOLOv8 pre-trained weight model selected in step S4 is a publicly published object detection and image segmentation model, developed by Joseph Redmon and Ali Farhadi of the University of Washington, and publicly released by the Ulitralytics web platform in November 2023; there are many versions of the YOLOv8 pre-trained weight model, among which the YOLOv8x pre-trained weight model performs best in accuracy, detection accuracy and performance, and is suitable for scenes requiring high-precision target detection. The use scenario of the present invention is the recognition of roof types of traditional Chinese dwellings. The image scenes are complex and the roof styles are rich. The use of YOLOv8x can improve the precision and accuracy of model recognition. How to obtain the YOLOv8 pre-trained weight model: Download the YOLOv8 network data configuration file from the official website of the code and software development platform GitHub.

[0075] Specifically, the network structure of the YOLOv8 model includes an input end, a Backbone network, a Neck network, and a Head output end connected in sequence. The process of inputting the training set T, the verification set Y, and the image set D to be identified into the YOLOv8 network model for model training is as follows:

[0076] (1) Image preprocessing: The labeled training set and validation set are sent to the input of the model, and the input preprocesses the images of the training set. The preprocessing includes mosaic data enhancement and adaptive anchor box calculation.

[0077] (2) Feature extraction: The preprocessed image enters the Backbone network, including the BottleneckCSP module and the Focus module, and three feature maps of different sizes are obtained after one convolution;

[0078] (3) Feature fusion: The three feature maps of different sizes obtained in the previous step are input into the Neck network for feature fusion. The features extracted by the feature extraction module are used by FPN+PAN to enable the model to obtain feature maps of three scales.

[0079] (4) Prediction output: The feature map obtained in the previous step is input into the Head output terminal to obtain the position, category and confidence of the prediction box. In the training phase, the prediction box is matched with the real box to obtain positive and negative samples, and then the weight parameters are adjusted by calculating the loss function. In the verification phase, the prediction box is screened by weighted non-maximum suppression, and the model parameters are continuously optimized by calculating the accuracy and average precision.

[0080] Furthermore, the transfer learning training process of training and acquiring the Chinese traditional residential roof type recognition model in step S4 is as follows:

[0081] (1) Custom configuration file: Customize the YOLOv8 network model data configuration file WDBZ.yaml, including filling in the dataset path, the number of categories nc, and the names of the identified categories names;

[0082] (2) Tuning parameters for training model: Place the set WDBZ.yaml file into a computer with a configured environment; load the YOLOv8x pre-trained weight model in the format of yolov8x.pt, and obtain the network model initialization parameters; load the training set T and the validation set Y, set the YOLOv8x pre-trained weight model hyperparameters, set the number of training iterations to 200 generations, the initial learning rate to 0.01, the weight decay rate to 0.001, the batch size to 150, and start training; repeat the training process to allow the YOLOv8x pre-trained weight model to gradually converge, and continuously adjust the data set through the validation set test to enable it to have generalization ability and improved accuracy.

[0083] (3) Model acquisition: During the training process, the validation set Y verification result data is observed in real time. After the training is completed, the optimal model BEST.pt is saved and recorded as the Chinese traditional residential roof type recognition model.

[0084] Specifically, in step S4, the YOLOv8x pre-trained weight model hyperparameters are set, and the number of training iterations is the number of times the YOLOv8x pre-trained weight model completely traverses the training set T; the initial learning rate is used to control the step size of the model weight update at each iteration, and determines the initial convergence speed of the model in training; the batch size determines the number of samples used each time the model weight is updated, which affects the memory usage, training speed and training stability of the model; the weight decay rate is to apply a regularization term to the model parameters each time the model weight is updated to prevent the model from overfitting, and the expression formula of the total loss function is:

[0085]

[0086] Among them, L total is the total loss function; L is the original loss function, which is used to measure the gap between the model detection results and the actual results; λ is the weight decay rate; is the sum of the squares of all model weights; represents the regularization term, w i Represents the i-th weight parameter in the model, which is used to control the complexity of the model. Increasing the weight decay rate to 0.001 increases the proportion of the regularization term in the loss function, reduces the model weight, reduces the model complexity, and increases the model generalization performance.

[0087] Specifically, the traditional village roof type training set used in the present invention covers different roof types across the country, with extensive data and large scale. When processing images of residential roof types of different styles and structures across the country, increasing the weight decay rate allows the model to maintain a smaller weight value during the training process, thereby reducing dependence on specific training samples, which can improve the generalization ability of the model and ensure that the model still has efficient recognition performance when facing images of residential roofs in different regions.

[0088] Furthermore, in step S5, the images in the image set D to be identified are input into the Chinese traditional residential roof type recognition model for calculation, and the txt document result is set to be saved to obtain the image recognition result and txt document result of each traditional residential building; the image recognition result includes the category, detection frame, and confidence score, and one detection frame corresponds to one category and confidence score; the txt document result includes the category and the location information of the detection frame. Among them, the confidence score indicates the probability that the Chinese traditional residential roof type recognition model believes that there is a roof in the detection frame and the degree of certainty that the existing roof belongs to a certain category. The confidence score is a floating point number between 0 and 1. A confidence score close to 1 indicates that the model is very sure that there is a roof target of a certain category in the detection frame, and a confidence score close to 0 indicates that the model is doubtful about the roof target in the detection frame, or believes that there is no roof target in the detection frame.

[0089] Specifically, the image recognition results of each traditional dwelling are written into a separate txt file, and the txt file name is consistent with the source image; each txt file contains one or more records, and a record corresponds to the category recognition result and location information of the detection frame of an object in a detection frame in the image recognition result. Specifically, each record contains the following information:

[0090] Category: 0, corresponding to WD_PD_PD_DM; 1, corresponding to WD_PD_PD_FS; 2, corresponding to WD_DPD_DPD_DM; 3, corresponding to WD_DPD_DPD_FS; 4, corresponding to WD_RZPD_YSJPD_DM; 5, corresponding to WD_RZPD_YSJPD_FS; 6, corresponding to WD_RZPD_YSJD_DM; 7, corresponding to WD_RZPD_YSJD_FS; 8, corresponding to WD_RZPD_XSJD_DM; 9, corresponding to WD_RZPD_XSJD_FS; 10, corresponding to WD_R ZPD_XSJPD_DM; 11, corresponds to WD_RZPD_XSPY_DM; 12, corresponds to WD_RZPD_XSPY_FS; 13, corresponds to WD_RZPD_RZCD_DM; 14, corresponds to WD_RZPD_RZCD_FS; 15, corresponds to WD_SPD_SPJD_DM; 16, corresponds to WD_SPD_SPJD_FS; 17, corresponds to WD_SPD_SPCD_DM; 18, corresponds to WD_SPD_SPCD_FS; 19, corresponds to WD_WDD_WDD_DM; 20, corresponds to WD _WDD_WDD_FS; 21, corresponds to WD_XSD_XSD_DM; 22, corresponds to WD_XSD_XSD_FS; 23, corresponds to WD_XSD_XSSZJD_DM; 24, corresponds to WD_XSD_XSSZJD_FS; 25, corresponds to WD_XSD_XSJPD_DM; 26, corresponds to WD_XSD_XSJPD_FS; 27, corresponds to WD_CJD_DBCJD_DM; 28, corresponds to WD_CJD_YXCJD_DM; 29, corresponds to WD_MYD_MYD_DM; 30, corresponds to W D_MYD_MYD_FS; 31, corresponds to WD_KD_KD_DM; 32, corresponds to WD_YZD_YZD_DM; 33, corresponds to WD_YZD_YZCD_DM; 34, corresponds to WD_QLD_QLD_DM; 35, corresponds to WD_TD_TD_DM; 36, corresponds to WD_DXD_DXD_DM; 37, corresponds to WD_SJD_SJD_DM; 38, corresponds to WD_XSWD_XSWD_DM; 39, corresponds to WD_CJD_DBCJD_FS; 40, corresponds to WD_ZZD_ZZD_DM.

[0091] The normalized value of the x-axis coordinate of the center point of the detection frame of the recognition result corresponds to the first floating point number, denoted as x;

[0092] The normalized value of the y-axis coordinate of the center point of the detection box of the recognition result corresponds to the second floating point number, recorded as y;

[0093] The normalized value of the width of the detection box of the recognition result corresponds to the third floating point number, denoted as w;

[0094] The normalized value of the height of the detection box of the recognition result corresponds to the fourth floating-point number, denoted as h.

[0095] The position of the detection box (x, y, w, h), through the coordinate points, can enable users to accurately know the specific position of a certain type of roof in the image, which can be used to calculate the spatial features of the roof, such as area, space, shape, and proportion. It can also be used to extract the geometric features of the roof, and further support the research of traditional residential architecture and image processing tasks. The txt document results containing the coordinate points are retained to enrich the recognition results of traditional residential roof types, which is an important basis for subsequent various practical applications and research and analysis.

[0096] Compared with the prior art, the present invention has the following advantages and effects:

[0097] (1) The method of the present invention adopts the YOLOv8x pre-trained model. On the one hand, the training is simple, which avoids complicated and tedious operations and has strong usability. On the other hand, the neural network is trained by a large amount of sample data, so that it can automatically and quickly extract richer and more expressive features of the roof types of traditional Chinese dwellings, avoiding a large number of missed detections.

[0098] (2) In the model training results, the present invention obtains model parameters suitable for the identification of roof types of traditional Chinese dwellings by modifying the hyperparameters of the YOLOv8x pre-trained model, so that the model has both accuracy and generalization ability of the recognition model by modifying the weight decay rate to adapt to the diversity of roof types across the country.

[0099] (3) The method of the present invention subdivides the types of traditional Chinese residential roofs based on image morphology. The dataset contains 26 types of traditional residential roofs and 41 target type images from different perspectives, achieving full coverage of roof type recognition across the country.

[0100] (4) The present invention uses images of traditional dwellings in various regions of China to predict results, so that the recognition results can be directly used for potential research on the distribution characteristics of traditional residential roof types; the nationwide coverage feature enables the model to be directly used for rapid and accurate recognition of traditional residential roofs of various types and forms in a single region, greatly reducing the human and material costs of the research. BRIEF DESCRIPTION OF THE DRAWINGS

[0101] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0102] Figure 1It is a flowchart of the steps of a method for identifying the roof types of traditional Chinese dwellings based on a deep neural network disclosed in the present invention;

[0103] Figure 2 is an example diagram of 26 roof types disclosed in the present invention; among them, Figure 2 (a) is a sample diagram of some roof types. Figure 2 (b) is a sample diagram of some roof types. Figure 2 (c) is another example of roof types;

[0104] Figure 3 This is a schematic diagram of the optimal model obtained after multiple tests in Example 1 of the present invention;

[0105] Figure 4 is a partial image recognition result of the image set D to be recognized input into the recognition model in Embodiment 1 of the present invention;

[0106] Figure 5 is a schematic diagram comparing the partial recognition results of the models in Examples 1 and 2 of the present invention; wherein, Figure 5 (a) is a schematic diagram of the comparison of some recognition results. Figure 5 (b) is a schematic diagram of the comparison of some recognition results. Figure 5 (c) is a schematic diagram showing the comparison of some recognition results. DETAILED DESCRIPTION

[0107] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0108] Example 1

[0109] This embodiment specifically discloses a method for identifying the roof types of traditional Chinese dwellings based on a deep neural network. Figure 1 As shown, the method for identifying the type of roof of traditional Chinese residential buildings includes the following steps:

[0110] S1. Obtain images of traditional Chinese dwellings: Obtain images of traditional Chinese dwellings from a public image data website to form an image set D to be identified;

[0111] In step S1 of this embodiment, the image set D to be identified is the images of traditional dwellings of various county-level administrative units in China. First, images of traditional Chinese dwellings are downloaded from public websites such as Bing, Google, and Baidu. The keywords "name of Chinese county-level unit" + "traditional dwellings" are entered for search, and the images of traditional dwellings of the county-level administrative unit are checked and obtained, and named after the county-level unit to produce the image set D to be identified with geographic semantic information. In order to avoid missing detection due to too few characteristic pixels of small-scale traditional Chinese residential buildings after convolution, the image set to be identified in step S1 needs to ensure that the proportion of traditional residential buildings in the image is greater than or equal to 50% of the image pixels, and the image format is jpg. In this embodiment, a total of 22,748 images of traditional dwellings of various county-level administrative units in China are obtained.

[0112] S2. Construct the standard of roof types of traditional Chinese dwellings: The roof types of traditional Chinese dwellings are obtained by sorting out the public literature data. The standard of roof types of traditional Chinese dwellings defines 26 roof types and 41 target types;

[0113] In step S2 of this embodiment, since the roof types of traditional Chinese dwellings have evolved from mutual influence and have certain common characteristics, this method is based on the combination of authoritative literature sorting and expert opinions, and innovatively forms 26 main traditional dwelling roof types distributed in various regions of China. These 26 roof types are similar to a certain extent, but they also form characteristics with regional characteristics. This difference is reflected in the morphological characteristics of the image, which will affect the accuracy of traditional dwelling roof type recognition. Therefore, it is necessary to consider the shape, material, appearance, color and other factors of the roof type, accurately grasp the characteristics and commonalities of different roof types, and thus propose a more reasonable classification standard. In addition, since some roof types present different features from the ground perspective and the bird’s-eye view, which will affect the accuracy of the model’s judgment, the roofs observed from the ground perspective are mainly composed of the features of the eaves, ridges, gables, beams, drips, and tiles, while those observed from the bird’s-eye view are mainly composed of the features of the ridges, eaves, beasts, and tiles. Therefore, these roof types are divided into two target objects, namely, the ground perspective and the bird’s-eye view of the roof style as the target objects. Finally, 26 roof types formed 41 target types, as shown in Table 1.

[0114] Table 1. Roof type and target type information table

[0115]

[0116]

[0117] S3. Create training set and validation set: In the image set D to be identified, select and annotate traditional residential images containing 41 target types to form training set T and validation set Y. Both training set T and validation set Y contain 41 target types:

[0118] The first roof type is the flat-roofed traditional dwelling, denoted as WD_PD_PD, which corresponds to two types of flat-roofed targets at two observation angles, namely the flat-roofed traditional dwelling from the ground perspective and the flat-roofed traditional dwelling from the top-down perspective, denoted as WD_PD_PD_DM and WD_PD_PD_FS, respectively;

[0119] The second roof type is the traditional residence with a single-slope roof, denoted as WD_DPD_DPD, which corresponds to the single-slope roof target types of two observation perspectives, namely the traditional residence with a single-slope roof from the ground perspective and the traditional residence with a single-slope roof from the top perspective, denoted as WD_DPD_DPD_DM and WD_DPD_DPD_FS respectively;

[0120] The third roof type is the traditional residence with hip roof, denoted as WD_RZPD_YSJPD, which corresponds to two types of hip roof targets from different viewing angles, namely the traditional residence with hip roof from the ground perspective and the traditional residence with hip roof from the top-down perspective, denoted as WD_RZPD_YSJPD_DM and WD_RZPD_YSJPD_FS respectively.

[0121] The fourth roof type is the traditional dwelling with a gable roof, denoted as WD_RZPD_YSJD, which corresponds to two types of gable roof target types from different observation angles, namely the traditional dwelling with a gable roof from the ground perspective and the traditional dwelling with a gable roof from the top-down perspective, denoted as WD_RZPD_YSJD_DM and WD_RZPD_YSJD_FS, respectively.

[0122] The fifth roof type is the traditional dwelling with gable roof, denoted as WD_RZPD_XSJD, which corresponds to two types of gable roof target types from different observation angles, namely the traditional dwelling with gable roof from the ground perspective and the traditional dwelling with gable roof from the top-down perspective, denoted as WD_RZPD_XSJD_DM and WD_RZPD_XSJD_FS respectively;

[0123] The sixth roof type is the traditional residence with a gable roof, recorded as WD_RZPD_XSJPD, and corresponds to a target type of gable roof from one viewing angle, which is the traditional residence with a gable roof from the ground viewing angle, recorded as WD_RZPD_XSJPD_DM.

[0124] The seventh roof type is the traditional residence with gable roof, denoted as WD_RZPD_XSPY, which corresponds to two types of target types of gable roof from different observation angles, namely the traditional residence with gable roof from the ground perspective and the traditional residence with gable roof from the top-down perspective, denoted as WD_RZPD_XSPY_DM and WD_RZPD_XSPY_FS respectively.

[0125] The eighth roof type is the traditional residence with gable roof, denoted as WD_RZPD_RZCD, which corresponds to two types of target types with gable roof from different observation angles, namely the traditional residence with gable roof from the ground perspective and the traditional residence with gable roof from the top perspective, denoted as WD_RZPD_RZCD_DM and WD_RZPD_RZCD_FS respectively;

[0126] The ninth roof type is the traditional residence with four-slope ridge roof, denoted as WD_SPD_SPJD, which corresponds to two types of four-slope ridge roof target types at two observation angles, namely the traditional residence with four-slope ridge roof at the ground perspective and the traditional residence with four-slope ridge roof at the top perspective, denoted as WD_SPD_SPJD_DM and WD_SPD_SPJD_FS respectively;

[0127] The tenth roof type is the four-slope grass-roof traditional dwelling, denoted as WD_SPD_SPCD, which corresponds to the four-slope grass-roof target types at two observation angles, namely the four-slope grass-roof traditional dwelling from the ground perspective and the four-slope grass-roof traditional dwelling from the top-down perspective, denoted as WD_SPD_SPCD_DM and WD_SPD_SPCD_FS respectively;

[0128] The 11th roof type is the traditional residence with hipped roof, denoted as WD_WDD_WDD, which corresponds to the hipped roof target types of two observation angles, namely the traditional residence with hipped roof from the ground perspective and the traditional residence with hipped roof from the top-down perspective, denoted as WD_WDD_WDD_DM and WD_WDD_WDD_FS respectively;

[0129] The 12th roof type is the traditional residence with hip roof, recorded as WD_XSD_XSD, which corresponds to two types of hip roof target types from different viewing angles, namely the traditional residence with hip roof from the ground perspective and the traditional residence with hip roof from the top-down perspective, recorded as WD_XSD_XSD_DM and WD_XSD_XSD_FS respectively;

[0130] The 13th roof type is the traditional residence with hip-and-gable roof and cross-ridge roof, denoted as WD_XSD_XSSZJD, which corresponds to the target types of hip-and-gable roof and cross-ridge roof from two observation angles, namely the traditional residence with hip-and-gable roof and cross-ridge roof from the ground perspective and the traditional residence with hip-and-gable roof and cross-ridge roof from the top-down perspective, denoted as WD_XSD_XSSZJD_DM and WD_XSD_XSSZJD_FS respectively;

[0131] The 14th roof type is the traditional residence with hipped roof, recorded as WD_XSD_XSJPD, which corresponds to the target types of hipped roof with hipped roof from two observation perspectives, namely the traditional residence with hipped roof from the ground perspective and the traditional residence with hipped roof from the top perspective, recorded as WD_XSD_XSJPD_DM and WD_XSD_XSJPD_FS respectively;

[0132] The 15th roof type is the traditional residence with a polygonal peak roof, recorded as WD_CJD_DBCJD, which corresponds to two types of polygonal peak roof target types from different observation perspectives, namely the traditional residence with a polygonal peak roof from the ground perspective and the traditional residence with a polygonal peak roof from the top-down perspective, recorded as WD_CJD_DBCJD_DM and WD_CJD_DBCJD_FS respectively;

[0133] The 16th roof type is a traditional residence with a rounded spire, recorded as WD_CJD_YXCJD, corresponding to a target type of rounded spire from a viewing angle, which is a traditional residence with a rounded spire from a ground viewing angle, recorded as WD_CJD_YXCJD_DM;

[0134] The 17th roof type is the traditional dwelling with dense eaves, recorded as WD_MYD_MYD, which corresponds to the target types of dense eaves from two observation perspectives, namely the traditional dwelling with dense eaves from the ground perspective and the traditional dwelling with dense eaves from the top perspective, recorded as WD_MYD_MYD_DM and WD_MYD_MYD_FS respectively;

[0135] The 18th roof type is the helmet-top traditional dwelling, recorded as WD_KD_KD, corresponding to one observation angle of the helmet-top target type, which is the helmet-top traditional dwelling from the ground perspective, recorded as WD_KD_KD_DM;

[0136] The 19th roof type is the traditional folk house with a conical roof, recorded as WD_YZD_YZD, and corresponds to one type of the conical roof target type at one observation angle, which is the traditional folk house with a conical roof at the ground perspective, recorded as WD_YZD_YZD_DM;

[0137] The 20th roof type is the traditional folk house with conical grass roof, recorded as WD_YZD_YZCD, corresponding to one target type of conical grass roof at one observation angle, which is the traditional folk house with conical grass roof at the ground perspective, recorded as WD_YZD_YZCD_DM;

[0138] The 21st roof type is the traditional dwelling with a dome roof, recorded as WD_QLD_QLD, and corresponds to one dome roof target type of observation angle, which is the traditional dwelling with a dome roof from the ground perspective, recorded as WD_QLD_QLD_DM;

[0139] The 22nd roof type is the traditional dwelling with a roof, recorded as WD_TD_TD, corresponding to one type of roof target type at one observation angle, which is the traditional dwelling with a roof from the ground perspective, recorded as WD_TD_TD_DM;

[0140] The 23rd roof type is the traditional dwelling on the cave roof, recorded as WD_DXD_DXD, corresponding to one cave roof target type of observation angle, which is the traditional dwelling on the cave roof from the ground perspective, recorded as WD_DXD_DXD_DM;

[0141] The 24th roof type is a triangular roof traditional dwelling, recorded as WD_SJD_SJD, corresponding to one triangular roof target type of observation angle, which is a triangular roof traditional dwelling from the ground perspective, recorded as WD_SJD_SJD_DM;

[0142] The 25th roof type is a traditional residence with a western-style roof, recorded as WD_XSWD_XSWD, and corresponds to a western-style roof target type with one observation angle, which is a traditional residence with a western-style roof from the ground perspective, recorded as WD_XSWD_XSWD_DM;

[0143] The 26th roof type is the traditional dwelling with a felt tent roof, denoted as WD_ZZD_ZZD, and corresponds to one target type of felt tent roof from a viewing angle, which is the traditional dwelling with a felt tent roof from a ground viewing angle, denoted as WD_ZZD_ZZD_DM.

[0144] In the training set T of this embodiment, there are 6111 sample images of 41 target types of traditional dwellings, and the total number of samples is 15942. In the training set Y of this embodiment, there are 592 sample images of 41 target types of traditional dwellings, and the total number of samples is 1684.

[0145] In the above step S3, the labeling method of the traditional residential images including the roof type is implemented by the Labelimg image labeling tool. Specifically, the labeling method of the 41 target types should include the complete roof range into the labeling frame, rather than the entire traditional residential building, because the contour information is very important for model training, which can distinguish different types of targets; there should be no gap between the labeling frame and the labeled object to avoid similar parts below the building roof from interfering with the recognition; every object in the image should be labeled and should not be omitted, because some markings cause the roof to be recognized as the background, reducing the recognition accuracy; it should be ensured that the frame coordinates are not on the image boundary to prevent out-of-bounds errors during data loading or data expansion.

[0146] S4. Training recognition model: Use the training set T produced in the previous step to train on the basis of the YOLOv8x pre-trained weight model, and verify on the verification set Y to obtain a Chinese traditional residential roof type recognition model;

[0147] In step S4 of this embodiment, the transfer learning training process of training and obtaining the Chinese traditional residential roof type recognition model is as follows:

[0148] (1) Custom configuration file: Customize the YOLOv8 network model data configuration file WDBZ.yaml, including filling in the dataset path, the number of categories nc is 41, and the identification category names are WD_PD_PD_DM, WD_PD_PD_FS, WD_DPD_DPD_DM, WD_DPD_DPD_FS, WD_RZPD_YSJPD_DM, WD_RZPD_YSJPD_FS, WD_RZPD_YSJD_DM, WD_RZPD_YSJD_FS, WD_RZPD_XSJD_DM, WD_RZPD_XSJD_FS, WD_RZPD_XSJPD_DM, WD_RZPD_XSPY_DM, WD_RZPD_XSPY_FS, WD_RZPD_RZCD_DM, WD_RZPD_RZCD_FS, WD_SPD_SJD_DM, WD_RZPD_SJD_FS, WD_RZPD_SJD_DM, WD_RZPD_SJD_FS. PCD_DM, WD_SPD_SPCD_FS, WD_WDD_WDD_DM, WD_WDD_WDD_FS, WD_XSD_XSD_DM, WD_XSD_XSD_FS, WD_XSD_X SSZJD_DM, WD_XSD_XSSZJD_FS, WD_XSD_XSJPD_DM, WD_XSD_XSJPD_FS, WD_CJD_DBCJD_DM, WD_CJD_YXCJD _DM, WD_MYD_MYD_DM, WD_MYD_MYD_FS, WD_KD_KD_DM, WD_YZD_YZD_DM, WD_YZD_YZCD_DM, WD_QLD_QLD_DM , WD_TD_TD_DM, WD_DXD_DXD_DM, WD_SJD_SJD_DM, WD_XSWD_XSWD_DM, WD_CJD_DBCJD_FS, WD_ZZD_ZZD_DM;

[0149] (2) Tuning parameter training model: Place the set WDBZ.yaml file into a computer with a configured environment; load the YOLOv8x pre-trained weight model, whose format is yolov8x.pt, and obtain the network model initialization parameters; load the training set T and the validation set Y, set the YOLOv8x pre-trained weight model hyperparameters, set the number of training iterations to 200 generations, the initial learning rate to 0.01, the weight decay rate to 0.001, the batch size to 150 and start training; repeat the training process to allow YOLOv8 to gradually converge, and continuously adjust the data set through the validation set test to enable it to have generalization ability and improved accuracy.

[0150] (3) Model acquisition: During the training process, the validation set Y verification result data is observed in real time. After the training is completed, the optimal model BEST.pt is saved and recorded as the Chinese traditional residential roof type recognition model. The training result data of the Chinese traditional residential roof type recognition model in the validation set is Precision 0.85, Recall 0.77, mAP@0.5 0.83, and mAP@0.5:0.95 0.77. After the training is completed, the optimal model BEST.pt is saved; the Precision value represents the precision rate, the Recall value represents the recall rate, the mAP@0.5 value represents the average precision value, and the mAP@0.5:0.95 value represents the average precision value at different intersection-over-union ratio thresholds.

[0151] S5. Identify the roof types of traditional Chinese dwellings: Input the images in the to-be-identified image set D into the traditional dwelling roof type identification model for identification, and obtain the roof type identification result in each image by calculation.

[0152] In step S5 of this embodiment, the images in the image set D to be identified are input into the Chinese traditional residential roof type recognition model for calculation, and the txt document result is set to be saved to obtain the image recognition result and txt document result of each traditional residential building; the image recognition result includes category, detection frame, and confidence score, and one detection frame corresponds to one category and confidence score; the txt document result includes the category and the location information of the detection frame. Among them, the confidence score indicates the probability that the Chinese traditional residential roof type recognition model believes that there is a roof in the detection frame and the degree of certainty that the existing roof belongs to a certain category. The confidence score is a floating point number between 0 and 1. A confidence score close to 1 indicates that the model is very sure that there is a roof target of a certain category in the detection frame, and a confidence score close to 0 indicates that the model is doubtful about the roof target in the detection frame, or believes that there is no roof target in the detection frame.

[0153] Specifically, the image recognition results of each traditional dwelling are written into a separate txt document, and the name of the txt document is consistent with the source image; each txt document contains one or more records, and a record corresponds to the category recognition result of an object in a detection box in the image recognition result and the location information of the detection box.

[0154] Specifically, each record contains the following information:

[0155] Category: 0, corresponding to WD_PD_PD_DM; 1, corresponding to WD_PD_PD_FS; 2, corresponding to WD_DPD_DPD_DM; 3, corresponding to WD_DPD_DPD_FS; 4, corresponding to WD_RZPD_YSJPD_DM; 5, corresponding to WD_RZPD_YSJPD_FS; 6, corresponding to WD_RZPD_YSJD_DM; 7, corresponding to WD_RZPD_YSJD_FS; 8, corresponding to WD_RZPD_XSJD_DM; 9, corresponding to WD_RZPD_XSJD_FS; 10, corresponding to WD_R ZPD_XSJPD_DM; 11, corresponds to WD_RZPD_XSPY_DM; 12, corresponds to WD_RZPD_XSPY_FS; 13, corresponds to WD_RZPD_RZCD_DM; 14, corresponds to WD_RZPD_RZCD_FS; 15, corresponds to WD_SPD_SPJD_DM; 16, corresponds to WD_SPD_SPJD_FS; 17, corresponds to WD_SPD_SPCD_DM; 18, corresponds to WD_SPD_SPCD_FS; 19, corresponds to WD_WDD_WDD_DM; 20, corresponds to WD _WDD_WDD_FS; 21, corresponds to WD_XSD_XSD_DM; 22, corresponds to WD_XSD_XSD_FS; 23, corresponds to WD_XSD_XSSZJD_DM; 24, corresponds to WD_XSD_XSSZJD_FS; 25, corresponds to WD_XSD_XSJPD_DM; 26, corresponds to WD_XSD_XSJPD_FS; 27, corresponds to WD_CJD_DBCJD_DM; 28, corresponds to WD_CJD_YXCJD_DM; 29, corresponds to WD_MYD_MYD_DM; 30, corresponds to W D_MYD_MYD_FS; 31, corresponds to WD_KD_KD_DM; 32, corresponds to WD_YZD_YZD_DM; 33, corresponds to WD_YZD_YZCD_DM; 34, corresponds to WD_QLD_QLD_DM; 35, corresponds to WD_TD_TD_DM; 36, corresponds to WD_DXD_DXD_DM; 37, corresponds to WD_SJD_SJD_DM; 38, corresponds to WD_XSWD_XSWD_DM; 39, corresponds to WD_CJD_DBCJD_FS; 40, corresponds to WD_ZZD_ZZD_DM.

[0156] The normalized value of the x-axis coordinate of the center point of the detection frame of the recognition result corresponds to the first floating point number, denoted as x;

[0157] The normalized value of the y-axis coordinate of the center point of the detection box of the recognition result corresponds to the second floating point number, recorded as y;

[0158] The normalized value of the width of the detection box of the recognition result corresponds to the third floating point number, denoted as w;

[0159] The normalized value of the height of the detection box of the recognition result corresponds to the fourth floating-point number, denoted as h.

[0160] Example 2

[0161] The method of this embodiment is substantially the same as that of the embodiment 1 provided, with the main difference being that in step S4, in the hyperparameter setting of the YOLOv8x pre-trained weight model, the weight decay rate is adjusted to 0.0005. The weight decay rate is a regularization term applied to the model parameters each time the model weight is updated to prevent the model from overfitting. The total loss function is expressed as:

[0162]

[0163] Among them, L total is the total loss function; L is the original loss function, which is used to measure the gap between the model detection results and the actual results; λ is the weight decay rate; is the sum of the squares of all model weights; represents the regularization term, w i Represents the i-th weight parameter in the model, which is used to control the complexity of the model and reduce the weight decay rate to 0.0005.

[0164] The total number of samples and the total number of samples in the original training set T in this embodiment are the same as those in Embodiment 1. The training set T is input into the YOLOv8 network model for model training and verified by the verification set Y. The obtained optimal model is saved as BEST2.pt. The comparison with the model evaluation data of Embodiment 1 is shown in Table 2:

[0165] Table 2. Comparison of model evaluation data between Example 1 and Example 2

[0166] Precision Recall mAP@0.5 mAP@0.5:0.95 BEST.pt 0.802 0.73 0.768 0.62 BEST2.pt 0.739 0.652 0.706 0.571

[0167] Among them, the Precision value represents the precision rate, the Recall value represents the recall rate, the mAP@0.5 value represents the average precision value, and the mAP@0.5:0.95 value represents the average precision value at different intersection-over-union ratio thresholds.

[0168] In Example 2, the weight decay rate in the model parameters is reduced, so that the model maintains a large weight value during the training process. This approach increases the dependence on specific training samples and reduces the generalization ability of the model. Therefore, the trained model has poor recognition performance when facing images of residential roofs in different regions. When verifying the verification set Y, both the precision and recall rates are reduced (as shown in Table 2); in terms of the performance of image recognition results, it will cause the confidence of the detection box to decrease, such as Figure 5As shown in (a), the left picture shows the image recognition result of an image in the prediction set D to be identified in Example 1, and the roof types of two ground observation angles are identified, both of which are gable roofs with eaves, denoted as WD_RZPD_XSPY_DM, with confidence levels of 0.96 and 0.92 respectively; the right picture shows the image recognition result of Example 2 for the same image, and the roof types of two ground observation angles are identified, both of which are gable roofs with eaves, denoted as WD_RZPD_XSPY_DM, with confidence levels of 0.96 and 0.46 respectively, among which the mark box with a confidence level of 0.46 is reduced by 50% compared with Example 1, and the recognition accuracy is reduced. Similarly, Figure 5 (c) It also shows that the recognition accuracy of Example 2 has decreased. The left picture shows the image recognition result of an image in the prediction set D to be recognized in Example 1. The roof types of two ground observation angles are recognized, both of which are hanging ridge tops, denoted as WD_RZPD_XSJD_DM, with confidence levels of 0.88 and 0.98 respectively; the right picture shows the image recognition result of Example 2 for the same image. The roof types of two ground observation angles are recognized, both of which are hanging ridge tops, denoted as WD_RZPD_XSJD_DM, with confidence levels of 0.81 and 0.97 respectively. The confidence levels of the two detection boxes have decreased to varying degrees compared to Example 1, and the recognition accuracy is reduced. In addition, reducing the weight decay rate may also result in the failure to successfully recognize the roof of the building in the image, such as Figure 5 As shown in (b), the left picture shows the image recognition result of a certain image in the prediction set D to be identified in Example 1, and a flat roof type from a ground observation perspective is identified, denoted as WD_PD_PD_DM, with a confidence level of 0.96; the right picture shows the image recognition result of the same image in Example 2, and the results show that the detection box result has not been identified, and the model believes that there is no roof type in this image.

[0169] The above embodiments are preferred implementation modes of the present invention, but the implementation modes of the present invention are not limited to the above embodiments. Any other changes, modifications, substitutions, combinations, and simplifications that do not deviate from the spirit and principles of the present invention should be equivalent replacement methods and are included in the protection scope of the present invention.

Claims

1. A method for identifying the roof types of traditional Chinese dwellings based on deep neural networks, characterized in that: The traditional residential roof type identification method comprises the following steps: S1. Obtain images of traditional Chinese dwellings: Obtain images of traditional Chinese dwellings from a public image data website to form an image set D to be identified; S2. Construct the standard of roof types of traditional Chinese residential buildings: The types of roofs of traditional Chinese residential buildings are obtained by sorting out the public literature data, and the standard of roof types of traditional Chinese residential buildings is defined as 26 roof types and 41 target types; S3, preparing training set and verification set: in the image set D to be identified, select and annotate traditional residential images containing 41 target types to form training set T and verification set Y, wherein both the training set T and verification set Y contain 41 target types: S4. Training recognition model: Use the training set T produced in the previous step to train on the basis of the YOLOv8x pre-trained weight model, and verify on the verification set Y to obtain a Chinese traditional residential roof type recognition model; S5. Identify the roof types of traditional Chinese dwellings: Input the images in the to-be-identified image set D into the traditional dwelling roof type identification model for identification, and obtain the roof type identification result in each image by calculation.

2. According to claim 1, a method for identifying the roof types of traditional Chinese dwellings based on a deep neural network is characterized in that: The image set D to be identified in step S1 is images of traditional dwellings of various county-level administrative units in China. The images are collected from a public image data website, and the keywords "name of China's county-level unit" + "traditional dwellings" are entered for search. The images of traditional dwellings of the county-level administrative unit are verified and obtained, and the images are named after the county-level unit to produce an image set D to be identified with geographic semantic information.

3. According to claim 1, a method for identifying the roof types of traditional Chinese dwellings based on a deep neural network is characterized in that: In the step S1, the proportion of the main body of the traditional residential buildings in the image set D to be identified is greater than or equal to 50% of the image pixels, and the image format is jpg.

4. According to claim 1, a method for identifying the roof types of traditional Chinese dwellings based on a deep neural network is characterized in that: In step S2, the standard construction of roof types of traditional Chinese dwellings includes 26 roof types, and some roof types include target objects under two observation perspectives, wherein one perspective is a ground perspective and the other perspective is a bird's-eye view, ultimately forming a total of 41 target types of roof types including ground perspectives and bird's-eye views.

5. The method for identifying the roof types of traditional Chinese dwellings based on a deep neural network according to claim 4 is characterized in that: The 26 roof types and 41 target types are: The first roof type is the flat-roofed traditional dwelling, denoted as WD_PD_PD, which corresponds to two types of flat-roofed targets at two observation angles, namely the flat-roofed traditional dwelling from the ground perspective and the flat-roofed traditional dwelling from the top-down perspective, denoted as WD_PD_PD_DM and WD_PD_PD_FS, respectively; The second roof type is the traditional residence with a single-slope roof, denoted as WD_DPD_DPD, which corresponds to the single-slope roof target types of two observation perspectives, namely the traditional residence with a single-slope roof from the ground perspective and the traditional residence with a single-slope roof from the top perspective, denoted as WD_DPD_DPD_DM and WD_DPD_DPD_FS respectively; The third roof type is the traditional residence with hip roof, denoted as WD_RZPD_YSJPD, which corresponds to two types of hip roof targets from different viewing angles, namely the traditional residence with hip roof from the ground perspective and the traditional residence with hip roof from the top-down perspective, denoted as WD_RZPD_YSJPD_DM and WD_RZPD_YSJPD_FS respectively. The fourth roof type is the traditional dwelling with a gable roof, denoted as WD_RZPD_YSJD, which corresponds to two types of gable roof target types from different observation angles, namely the traditional dwelling with a gable roof from the ground perspective and the traditional dwelling with a gable roof from the top-down perspective, denoted as WD_RZPD_YSJD_DM and WD_RZPD_YSJD_FS, respectively. The fifth roof type is the traditional dwelling with gable roof, denoted as WD_RZPD_XSJD, which corresponds to two types of gable roof target types from different observation angles, namely the traditional dwelling with gable roof from the ground perspective and the traditional dwelling with gable roof from the top-down perspective, denoted as WD_RZPD_XSJD_DM and WD_RZPD_XSJD_FS respectively; The sixth roof type is the traditional residence with a gable roof, recorded as WD_RZPD_XSJPD, and corresponds to a target type of gable roof from one viewing angle, which is the traditional residence with a gable roof from the ground viewing angle, recorded as WD_RZPD_XSJPD_DM. The seventh roof type is the traditional residence with gable roof, denoted as WD_RZPD_XSPY, which corresponds to two types of target types of gable roof from different observation angles, namely the traditional residence with gable roof from the ground perspective and the traditional residence with gable roof from the top-down perspective, denoted as WD_RZPD_XSPY_DM and WD_RZPD_XSPY_FS respectively. The eighth roof type is the traditional residence with gable roof, denoted as WD_RZPD_RZCD, which corresponds to two types of target types with gable roof from different observation angles, namely the traditional residence with gable roof from the ground perspective and the traditional residence with gable roof from the top perspective, denoted as WD_RZPD_RZCD_DM and WD_RZPD_RZCD_FS respectively; The ninth roof type is the traditional residence with four-slope ridge roof, denoted as WD_SPD_SPJD, which corresponds to two types of four-slope ridge roof target types at two observation angles, namely the traditional residence with four-slope ridge roof at the ground perspective and the traditional residence with four-slope ridge roof at the top perspective, denoted as WD_SPD_SPJD_DM and WD_SPD_SPJD_FS respectively; The tenth roof type is the four-slope grass-roof traditional dwelling, denoted as WD_SPD_SPCD, which corresponds to the four-slope grass-roof target types at two observation angles, namely the four-slope grass-roof traditional dwelling from the ground perspective and the four-slope grass-roof traditional dwelling from the top-down perspective, denoted as WD_SPD_SPCD_DM and WD_SPD_SPCD_FS respectively; The 11th roof type is the traditional residence with hipped roof, denoted as WD_WDD_WDD, which corresponds to the hipped roof target types of two observation angles, namely the traditional residence with hipped roof from the ground perspective and the traditional residence with hipped roof from the top-down perspective, denoted as WD_WDD_WDD_DM and WD_WDD_WDD_FS respectively; The 12th roof type is the traditional residence with hip roof, recorded as WD_XSD_XSD, which corresponds to two types of hip roof target types from different viewing angles, namely the traditional residence with hip roof from the ground perspective and the traditional residence with hip roof from the top-down perspective, recorded as WD_XSD_XSD_DM and WD_XSD_XSD_FS respectively; The 13th roof type is the traditional residence with hip-and-gable roof and cross-ridge roof, denoted as WD_XSD_XSSZJD, which corresponds to the target types of hip-and-gable roof and cross-ridge roof from two observation angles, namely the traditional residence with hip-and-gable roof and cross-ridge roof from the ground perspective and the traditional residence with hip-and-gable roof and cross-ridge roof from the top-down perspective, denoted as WD_XSD_XSSZJD_DM and WD_XSD_XSSZJD_FS respectively; The 14th roof type is the traditional residence with hipped roof, recorded as WD_XSD_XSJPD, which corresponds to the target types of hipped roof with hipped roof from two observation perspectives, namely the traditional residence with hipped roof from the ground perspective and the traditional residence with hipped roof from the top perspective, recorded as WD_XSD_XSJPD_DM and WD_XSD_XSJPD_FS respectively; The 15th roof type is the traditional residence with a polygonal peak roof, recorded as WD_CJD_DBCJD, which corresponds to two types of polygonal peak roof target types from different observation perspectives, namely the traditional residence with a polygonal peak roof from the ground perspective and the traditional residence with a polygonal peak roof from the top-down perspective, recorded as WD_CJD_DBCJD_DM and WD_CJD_DBCJD_FS respectively; The 16th roof type is a traditional residence with a rounded spire, recorded as WD_CJD_YXCJD, corresponding to a target type of rounded spire from a viewing angle, which is a traditional residence with a rounded spire from a ground viewing angle, recorded as WD_CJD_YXCJD_DM; The 17th roof type is the traditional dwelling with dense eaves, recorded as WD_MYD_MYD, which corresponds to the target types of dense eaves from two observation perspectives, namely the traditional dwelling with dense eaves from the ground perspective and the traditional dwelling with dense eaves from the top perspective, recorded as WD_MYD_MYD_DM and WD_MYD_MYD_FS respectively; The 18th roof type is the helmet-top traditional dwelling, recorded as WD_KD_KD, corresponding to one observation angle of the helmet-top target type, which is the helmet-top traditional dwelling from the ground perspective, recorded as WD_KD_KD_DM; The 19th roof type is the traditional folk house with a conical roof, recorded as WD_YZD_YZD, and corresponds to one type of the conical roof target type at one observation angle, which is the traditional folk house with a conical roof at the ground perspective, recorded as WD_YZD_YZD_DM; The 20th roof type is the traditional residence with conical grass roof, recorded as WD_YZD_YZD, corresponding to the target type of conical grass roof with one observation angle, which is the traditional residence with conical grass roof from the ground perspective, recorded as WD_YZD_YZCD_DM; The 21st roof type is the traditional dwelling with a dome roof, recorded as WD_QLD_QLD, and corresponds to one dome roof target type of observation angle, which is the traditional dwelling with a dome roof from the ground perspective, recorded as WD_QLD_QLD_DM; The 22nd roof type is the traditional dwelling with a roof, recorded as WD_TD_TD, corresponding to one type of roof target type at one observation angle, which is the traditional dwelling with a roof from the ground perspective, recorded as WD_TD_TD_DM; The 23rd roof type is the traditional dwelling on the cave roof, recorded as WD_DXD_DXD, corresponding to one cave roof target type of observation angle, which is the traditional dwelling on the cave roof from the ground perspective, recorded as WD_DXD_DXD_DM; The 24th roof type is a triangular roof traditional dwelling, recorded as WD_SJD_SJD, corresponding to one triangular roof target type of observation angle, which is a triangular roof traditional dwelling from the ground perspective, recorded as WD_SJD_SJD_DM; The 25th roof type is a traditional residence with a western-style roof, recorded as WD_XSWD_XSWD, and corresponds to a western-style roof target type with one observation angle, which is a traditional residence with a western-style roof from the ground perspective, recorded as WD_XSWD_XSWD_DM; The 26th roof type is the traditional dwelling with a felt tent roof, denoted as WD_ZZD_ZZD, and corresponds to one target type of felt tent roof from a viewing angle, which is the traditional dwelling with a felt tent roof from a ground viewing angle, denoted as WD_ZZD_ZZD_DM.

6. The method for identifying the roof types of traditional Chinese dwellings based on a deep neural network according to claim 1, characterized in that: In the step S3, the labeling method of the traditional residential images of the roof type is implemented by using the Labelimg image labeling tool.

7. The method for identifying the roof types of traditional Chinese dwellings based on a deep neural network according to claim 1 is characterized in that: The process of training and obtaining the Chinese traditional dwelling roof type recognition model in step S4 includes: setting the initial parameters of the network data configuration file of the YOLOv8x pre-trained weight model and inputting the YOLOv8x pre-trained weight model, using the pre-trained weights of the YOLOv8x pre-trained weight model, setting the YOLOv8x pre-trained weight model hyperparameters, setting the number of training iterations to 200 generations, the initial learning rate to 0.01, the weight decay rate to 0.001, and the batch size to 150, and then starting training, verifying the trained YOLOv8x pre-trained weight model on the verification set Y to verify the effectiveness of the model, and finally obtaining the Chinese traditional dwelling roof type recognition model.

8. The method for identifying the roof types of traditional Chinese dwellings based on a deep neural network according to claim 7, characterized in that: In step S4, the YOLOv8x pre-trained weight model hyperparameters are set, and the expression formula of the total loss function is: Among them, L total is the total loss function; L is the original loss function, which is used to measure the gap between the detection results of the YOLOv8x pre-trained weight model and the actual results; λ is the weight decay rate; is the sum of the squares of all model weights; represents the regularization term, w i Represents the i-th weight parameter in the model, which is used to control the complexity of the YOLOv8x pre-trained weight model.

9. The method for identifying the roof types of traditional Chinese dwellings based on a deep neural network according to claim 5, characterized in that: In the step S5, the images in the image set D to be identified are input into the Chinese traditional dwelling roof type recognition model for calculation, and the setting is turned on to save the txt document results to obtain the image recognition results and txt document results of each traditional dwelling; the image recognition results include categories, detection frames, and confidence scores, and one detection frame corresponds to one category and confidence score; the txt document results include the category and the location information of the detection frame. Among them, the confidence score represents the probability that the Chinese traditional dwelling roof type recognition model believes that there is a roof in the detection frame and the degree of certainty that the existing roof belongs to a certain category. The confidence score is a floating point number between 0 and 1. A confidence score close to 1 means that the model is very sure that there is a roof target of a certain category in the detection frame, and a confidence score close to 0 means that the model is doubtful about the roof target of the detection frame, or believes that there is no roof target in the detection frame. The recognition results of each image of traditional dwellings are written into a separate txt document. The name of the txt document is consistent with the source image. Each txt document contains one or more recognition result records. One recognition result record corresponds to the category recognition result and location information of the detection frame of an object in a detection frame in the image recognition result.