Method, system, equipment and medium for identifying types of traditional Chinese dwellings

Through a method based on deep neural networks, combined with authoritative literature and expert opinions, we constructed standards for 23 types of traditional dwellings, and used the YOLOv8x model for identification. This solved the accuracy and coverage issues in identifying traditional dwelling types, and achieved rapid and accurate identification and protection across the country.

CN119810567BActive Publication Date: 2025-09-26SOUTH CHINA UNIV OF TECH +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202510056935.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-09-26
Estimated Expiration
2045-01-14

AI Technical Summary

Technical Problem

Existing technologies lack a rapid and accurate method for identifying the types of traditional dwellings across the country, and rely on remote sensing images and expert experience, making it difficult to fully understand the distribution characteristics and unclear type classification of traditional Chinese dwellings.

Method used

Based on the deep neural network method, combined with the "Complete Collection of Traditional Chinese Dwelling Types" and expert opinions, we constructed 23 standards for traditional dwelling types. We used the YOLOv8x pre-trained weight model to train the recognition model, and used ground image features for identification to establish a nationwide traditional dwelling type detection model.

Benefits of technology

It has achieved rapid and accurate identification of traditional residential types across the country, improved identification accuracy, reduced manpower and material costs, and supported the digital protection and restoration of traditional residential buildings.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119810567B_ABST
    Figure CN119810567B_ABST
Patent Text Reader

Abstract

This invention discloses a method, system, electronic device, and storage medium for identifying traditional Chinese dwelling types based on a deep neural network. The method includes the following steps: Based on literature and image features of building types, nine major categories and 23 subcategories of traditional Chinese dwelling types are summarized; training and validation sets are created containing images of the 23 distinct types of traditional residential buildings; using these training and validation sets, an optimized traditional dwelling type recognition model is trained based on the pre-weighted YOLOv8x model; and the model is fed with a set of images to be predicted that contain geographic semantic information to identify traditional dwelling types in different county-level administrative units across China. This method can be used to quickly and accurately detect traditional dwelling types across China, and the recognition results can serve as evidence for research on the distribution of traditional residential building types.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of image-based building detection, and specifically relates to a method, system, electronic device and storable medium for identifying the types of traditional Chinese dwellings based on a deep neural network. Background Art

[0002] my country currently possesses a vast number of traditional dwelling samples from various historical periods. These samples are so numerous and widely distributed across rural areas that professional surveys lack comprehensive statistical data. This requires significant human, financial, and time-consuming efforts, making it difficult to quickly capture the distribution characteristics of traditional dwelling types through field surveys. Existing research often focuses on the types and morphologies of traditional dwellings in a specific region, with few systematic studies covering traditional dwellings nationwide. This lacks a comprehensive understanding of existing traditional dwelling types in China. Furthermore, the rich variety of traditional dwelling types, with different architectural styles sharing commonalities as well as distinct characteristics, leads to unclear standards for classifying traditional dwelling types, further complicating the nationwide identification of traditional dwelling types in China. Therefore, it is necessary to establish a detection model that can quickly and easily identify traditional dwelling types in China.

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

[0004] (1) No detection method for traditional residential building types has been proposed. Existing technologies focus on the identification of buildings, bridges, roads, green spaces, etc. in remote sensing images, as well as the detection of urban construction and municipal pipeline safety. There is a lack of identification and detection of traditional residential building types in rural areas.

[0005] (2) No requirements were put forward for the traditional dwelling image dataset. Existing dwelling classification methods are mainly based on expert knowledge and personal experience, and lack the technology to detect the type of traditional dwellings using images.

[0006] (3) No method for detecting traditional dwelling types across China has been proposed. Existing research methods for the distribution of dwelling types are mainly based on small-scale, case-specific areas, and lack detection technology for traditional dwelling type data across the country.

[0007] (4) No residential detection method based on ground photos has been proposed. Existing detection methods are mainly based on remote sensing images as basic data sets, which are difficult and time-consuming to obtain. Summary of the Invention

[0008] The main purpose of the present invention is to overcome the shortcomings and deficiencies of the existing technology and provide a method, system, electronic device and storable medium for identifying the types of traditional Chinese residential buildings based on deep neural networks. The identification method first classifies traditional Chinese residential buildings based on the "Complete Collection of Traditional Chinese Residence Types" and combines it with expert opinions to formulate a classification standard for traditional Chinese residential types. Secondly, by controlling the parameters of the traditional residential types in the training set and the validation set, an optimized traditional Chinese residential type recognition model is obtained based on the YOLOv8x pre-trained weight model training, and the traditional residential image to be detected is input into the traditional Chinese residential type recognition model to obtain the recognition result. This method can be used for the rapid and accurate detection of various types of traditional residential buildings throughout China, and the recognition results can serve as a demonstration support for the study of the distribution of traditional residential building types.

[0009] In order to achieve the above object, the present invention adopts the following technical solutions:

[0010] In a first aspect, the present invention provides a method for identifying types of traditional Chinese dwellings based on a deep neural network. This method, based on ground image features of traditional dwelling types, targets traditional dwelling types and enables the identification and recognition of traditional dwelling types across China. The method comprises the following steps:

[0011] S1. Constructing the standard for Chinese traditional dwelling types: Based on the Complete Collection of Chinese Traditional Dwelling Types published by China Architecture & Building Press in 2014 and public literature data, we compiled and obtained the types of Chinese traditional dwellings. According to the standard, we defined 23 types of Chinese traditional dwellings.

[0012] S2. Obtaining images of various types of traditional Chinese dwellings: Obtain images of various types of traditional Chinese dwellings from a public image data website to form a dwelling type image set A;

[0013] S3. Create a training set and a validation set: In the residential type image set A, annotate images of traditional residential buildings containing 23 target residential types and divide them into a training set T and a validation set Y in a ratio of 9:1. Both the training set T and the validation set Y contain 23 residential types.

[0014] S4. Train the recognition model: Use the training set T created in the previous step to train the model based on the YOLOv8x pre-trained weight model and verify it on the validation set Y to obtain the Chinese traditional residential type recognition model build_reco_best.pt;

[0015] S5. Obtain images of traditional Chinese dwellings: Obtain images of traditional Chinese dwellings across China from a public image data website or collect images of traditional Chinese dwellings across China in real time to form an image set B to be identified;

[0016] S6. Identify the types of traditional Chinese dwellings: Input the dwelling images in the to-be-identified image set B into the traditional Chinese dwelling type identification model for identification, and obtain the type identification results of the images in the to-be-identified image set B through calculation.

[0017] Furthermore, in step S1, this method, through reviewing existing historical data and literature, discovered that the classification of building types is closely related to factors such as the building's roof, structure, materials, and decoration. However, existing research has mostly based its classification on a specific factor, lacking a type recognition method that focuses on the building's overall appearance. Therefore, this method integrates building facade image features with previous classification research results to form 9 major categories totaling 23 types of traditional Chinese dwellings. This method, based on previous research, forms 9 major categories of dwelling types and 23 subcategories based on the building's appearance, ultimately forming 23 target types. This method can achieve coverage of major dwelling types across China and enrich the research object.

[0018] Specifically, the characteristics of the 9 major categories and 23 minor categories of residential types are as follows:

[0019] (1) Single-family residential buildings

[0020] The first major residential type is single-family dwellings. These are characterized by relatively simple architectural forms but varying building materials, typically existing as a single unit, denoted as DDL. Single-family dwellings are further divided into three subcategories based on architectural image features: thatched-roof dwellings, stone-framed dwellings, and wooden-framed dwellings. Thatched-roof dwellings are characterized by roofs made of grass materials such as seaweed and thatch. Imaged roofs are primarily brown or tan, exhibiting a grassy texture like straw. The roof outline is clear and occupies a large proportion of the imaged area. Stone-framed dwellings are characterized by facades featuring freely stacked or evenly aligned stones. The building shapes are mostly rectangular, with colors primarily reflecting the natural colors of the various stones. Roofs are predominantly sloping. Wooden-framed dwellings are characterized by load-bearing walls made of horizontally stacked logs or square timber, interlocking at the corners. Roofs are pure wooden structures with gabled, double-sloped, or gabled roofs. Images primarily depict the color of logs. The facades often display a texture created by stacking wood. The roofs are also sloping and made of wood. They are denoted as DDL_CDMJ, DDL_SGMJ, and DDL_MGMJ respectively;

[0021] (2) Courtyard-style houses

[0022] The second largest type of residential type is courtyard-style residential buildings. Its characteristics are: it consists of rooms arranged in a linear layout, forming various forms of courtyards, denoted as HYS. According to the characteristics of the architectural form image, the courtyard-style residential buildings are divided into two subcategories, namely courtyard-style residential buildings and hall-style residential buildings. Among them, the characteristics of the courtyard-style residential buildings are: the buildings are mostly single houses forming square or rectangular courtyards, usually with gray or brick-red exterior walls, more flexible layouts, larger courtyards, and mostly sloping roofs. The characteristics of hall-style residential buildings are: the buildings usually have a simple, geometric appearance, central axis symmetry, most of the architectural images have gray or khaki facades, the building shapes are mostly rectangular, and the roofs are sloping roofs. They are denoted as TYS_HYSMJ and TYS_THSMJ respectively;

[0023] (3) Fort-style dwellings

[0024] The third major type of dwelling is the fortress-style dwelling. Its characteristics are that the building typically consists of an outer enclosure and an inner core, providing strong defensive functions and featuring tall exterior walls, denoted as WBS. Based on the architectural image characteristics, the fortress-style dwelling is further divided into two subcategories: earth buildings and walled buildings. Tulou dwellings are characterized by large-scale residential structures built primarily from raw earth, a combination of raw earth and wood, and varying degrees of stone. Images are often khaki in color, relatively monolithic, with arrays of windows on the facades. The exterior shapes are simple, often arc-shaped or square, and the roofs are sloping. Walled buildings are characterized by tall walls and enclosures surrounding the buildings, often surrounded by deep trenches and high walls, with towers and watchtowers at the corners and in the center. These are important folk defensive architectural complexes. Images are often grayish-white or grayish-brown, with regular brick and stone textures on the facades, and no distinct internal spatial divisions. The buildings are tall, often rectangular in shape, with some corner towers protruding, and the roofs are often sloping. They are denoted as WB_TL and WB_WL respectively;

[0025] (4) Diaofang-style dwellings

[0026] The fourth type of residential building is the Diaofang-style dwelling. Its characteristics are: the exterior structure of the building is built with stone walls or earth walls, mostly with flat roofs, narrow windows, and excellent defensive capabilities, denoted as DFS. Based on the architectural image characteristics, the Diaofang-style dwellings are further divided into two subcategories: Diaofang and Diaolou. The characteristics of Diaolou dwellings are: the image is mostly grayish white or grayish brown, the building facade is mostly brick and stone texture, there are many small holes, the main body of the building has a large height-to-width ratio, the building usually has a simple, geometric appearance, clear lines, and a flat roof. The main difference from the Diaofang dwelling is that the building has higher storeys. The characteristics of Diaofang dwellings are: they are built with rubble stones or earth, the image is relatively colorful, and basically use the natural colors of the materials: khaki of the soil, beige, green, and dark red of the stones, and the wood is painted dark red. The building facade is mostly brick and stone texture, the main body of the building is relatively flat, the building shape is simple, the lines are clear, and the roof is flat. They are denoted as DF_DL and DF_DF respectively.

[0027] (5) Cave-style dwellings

[0028] The fifth major type of dwelling is cave dwelling. Its characteristics are: the main structure is constructed by excavating horizontally or underground into the loess cliff, supported by an arched structure, and the primary building materials are mud, bricks, and stone. (YDS) Cave dwellings are further divided into three subcategories based on their architectural morphological features: cliff caves, pit courtyards, and cave caves. Among them, the characteristics of the cliff kiln are: it is built by digging a horizontal hole in the natural earth wall, the image color is mainly khaki, a few have brick and stone door frames, the door openings are mostly curved and arranged in an array, and the back is against the mountain; the characteristics of the pit courtyard dwellings are: it is built by digging a rectangular or square earth pit on the flat land, the image is usually khaki, the shape of the building courtyard is mostly rectangular, the door openings are curved and arranged in an array, with clear outlines, the main body of the building is below the ground, and the roof of the building is on the ground; the characteristics of the gutter kiln are: it is built on the ground, the image is usually gray or khaki, the facade is brick and stone texture, the main body of the building is mostly strip-shaped, the door openings are curved and arranged in an array, and the roof is flat. They are denoted as YDS_KYY, YDS_DKY, and YDS_GY respectively;

[0029] (6) Felt tent-style dwellings

[0030] The sixth major type of dwelling is the yurt-style dwelling. Its characteristics are: it is a type of detachable and movable residential structure commonly used by Chinese nomadic peoples. It includes yurt-style dwellings and tent-style dwellings, distinguished by their roof covering and form, and denoted as ZZS. Yurt-style dwellings are further divided into four subcategories based on architectural morphological features: tent-style dwellings, yak tents, slanted pillar dwellings, and felt-bag dwellings. Among them, the characteristics of the account-style dwellings are: they are mostly made of white cotton cloth, with colorful pile embroidery patterns on the surface. The architectural image is mainly white, with auxiliary blue and red decorations. The building outline is clear, and the roof is a pointed roof that is integrated with the building facade. The characteristics of the yak tent are: it is a form of housing for plateau herders who migrate with their cattle and sheep and live wherever there is grass. The image is mainly black, the architectural outline is clear, and the roof is a pointed roof that is integrated with the building facade. The characteristics of the oblique pillar dwellings are: they use wooden strips as the frame and are covered with bark or animal skins. The image is mainly white and brown. The buildings are mostly independent and have an overall conical shape. The characteristics of the felt dwellings are: the lower part of the dwelling is cylindrical and the upper part is dome-shaped. The image is mainly white. They are mostly independent and have clear outlines. The roof is a sloping roof that is integrated with the building facade. They are denoted as ZZS_ZFSMJ, ZZS_MNZP, ZZS_XRZ, and ZZS_ZBSMJ respectively.

[0031] (7) Stilt houses

[0032] The seventh type of dwellings is stilt dwellings. Its characteristics are: the ground floor is elevated for moisture-proofing and ventilation, the building materials are mostly wood, bamboo, and mud, and most of them have sloping roofs, denoted as GLS. Since the image features of stilt dwellings of various ethnic groups and regions are similar, the stilt dwellings of various ethnic groups are collectively referred to as stilt dwellings. Its characteristics are: the dwellings are made of upright wooden or bamboo piles to form a base frame above the ground, on which the houses are built with bamboo, wood, thatch, etc. The image is usually wood color or brown, the facade is usually wood texture, the main body of the building is relatively flexible, and the roof form is a sloping roof. It is denoted as GLSMJ;

[0033] (8) Outer-style houses

[0034] The eighth major type of dwelling is the Kuo-style dwelling. Its characteristics are: primarily loess, flat roofs, and few, small doors and windows. This type is designated KS. Kuo-style dwellings are further divided into three subcategories based on their architectural imagery: Ayiwang-style dwellings, Tuzhang-style dwellings, and Zhuangkuo-style dwellings. Ayiwang-style dwellings are characterized by both a completely enclosed interior space and a large courtyard with a skylight. Their imagery is primarily yellow and reddish-brown. Their facades are primarily rammed earth or brick. They are mostly rectangular in shape, often with a balcony, and have flat roofs. Tuzhang-style dwellings are mostly rectangular in shape, with straight, clear outlines, and facades often composed of multiple units arranged in a series. Their roofs are flat, and their imagery is primarily khaki. Zhuangkuo-style dwellings are characterized by tall, thick loess walls, a mostly rectangular shape with clear outlines, an interior courtyard, and a mostly flat roof. Their imagery is primarily khaki or brown. They are denoted as KSMJ_AYWSMJ, KSMJ_TZF, and KSMJ_ZK respectively;

[0035] (9) Special residential buildings

[0036] The ninth major residential type is special residential buildings. These buildings are often created for specific reasons, such as land conservation, abundant local forest resources, or disaster preparedness. These buildings have inconsistent appearance and structure, designated as TSL. These special residential buildings are further divided into three subcategories based on architectural form and image features: waterfront residences, Western-style buildings, and modern townhouses. Among them, waterside dwellings are characterized by being located near water bodies, floating on or near them, with flexible architectural forms, predominantly pitched roofs, and images depicting white, blue, and cyan. Western-style architecture broadly refers to Chinese residential buildings with predominantly Western characteristics. These buildings feature rich and varied colors, a preponderance of Western architectural elements, Western-style door and window designs, and decorative ornamentation, along with abundant vegetation. Roofs vary, including both flat and pitched roofs. Modern townhouses are characterized by facades that are typically a vernacular variation of the Nanyang style, with images primarily featuring off-white and brick red. Buildings often appear continuous along streets, arranged in arrays, and feature a mix of Chinese and Western patterns and geometric designs. Roofs are predominantly flat. These are denoted as TSL_LSMJ, TSL_XSFGJZ, and TSL_XDLPMJ, respectively.

[0037] Furthermore, the requirements for the images of traditional Chinese residential buildings in the residential building type image set A and the image set B to be identified in step S2 are as follows:

[0038] (1) YOLOv8 is a target detection algorithm that analyzes and processes input images to identify target objects and their location information. The default image size in the model algorithm is set to 640 pixels. If the image pixels used for training recognition are lower than this precision, the accuracy of the model recognition will be affected. In addition, to ensure accurate identification of traditional building types, architectural photos should clearly show the roof form, color, material, and other information of each residential type. Therefore, when constructing dataset A, the image size is selected to be no less than 640*640, and the image format is jpg.

[0039] (2) Since the recognition method of the present invention is a method for identifying building types, the identification subject is traditional Chinese residential buildings. However, since each ground-shot picture is taken at a different distance from the building and the equipment used is different, the position and scaling of the traditional residential buildings on the image will be different. In order to avoid the difficulty in identifying the characteristics of the building facade due to the small pixel area of ​​the image during training, it is necessary to ensure that the collected image content should contain relatively complete one or more building facades.

[0040] Furthermore, in step S3, since there is currently no publicly available dataset of traditional Chinese dwelling types for use in the present invention, the present invention collects and produces a relevant training set T and validation set Y of traditional Chinese dwelling types. The image collection process is as follows: analyzing the color, style, material, and roof features of different dwellings to determine dwelling type image examples (Figure 2), inputting dwelling type keywords into a public image data platform, and comparing them with the dwelling type image examples to obtain images of each traditional Chinese dwelling type. Based on the type images, the present invention then collects Chinese traditional dwelling image data through an online search platform as the basis for subsequent model training.

[0041] Furthermore, in step S3, the images of traditional dwellings corresponding to each type of dwelling are annotated using the Labelimg image annotation tool. LabelImg is an open-source graphical user interface (GUI) tool primarily used for image annotation, particularly for preparing training data for machine learning and computer vision projects. It allows users to label objects in an image by drawing bounding boxes and assigning a category label to each bounding box. This annotation information can be exported as an XML file (following the Pascal VOC format), a TXT file (suitable for YOLO format), or other supported formats, containing the coordinates and category information of each annotated object for use in training deep learning models.

[0042] Specifically, all main building parts appearing in each image are annotated. Since the final detection is based on the target detection function of the YOLO series, the complete range of residential buildings should be included in the annotation box when annotating the 23 target types. There should be no gaps between the annotation box and the annotated object to avoid interference from parts outside the main building. Every object in the image should be annotated without omission. Omitted parts will cause the main building to be identified as background during model training, resulting in reduced recognition accuracy. The box coordinates should be ensured not to be on the image boundary to prevent out-of-bounds errors during data loading or data expansion.

[0043] Furthermore, the YOLOv8x pre-trained weight model selected in step S4 is a publicly published target detection model, which was publicly released by the Ulitralytics web platform in November 2023. Among the many YOLOv8 pre-trained weight models, the YOLOv8x pre-trained weight model performs best in terms of accuracy, detection precision, and performance, and is suitable for scenarios requiring high-precision target detection. The application scenario of the present invention is the recognition of traditional Chinese residential types. The image scene is complex, and the use of the YOLOv8x pre-trained weight model can improve the precision and accuracy of residential type recognition. How to obtain the YOLOv8x pre-trained weight model: Download the YOLOv8 network data configuration file from the official website of the code and software development platform GitHub.

[0044] Specifically, the network structure of the YOLOv8 model includes the input end, the backbone network, the neck network, and the head output end connected in sequence. The process of inputting the training set T and the verification set Y into the YOLOv8 network model for model training is as follows:

[0045] (1) Image preprocessing: The labeled training set and validation set are fed into the input of the model, which then preprocesses the images in the training set. This preprocessing includes Mosaic data enhancement and adaptive anchor box calculation.

[0046] (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;

[0047] (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 fused using the FPN+PAN method, so that the model can obtain feature maps of three scales.

[0048] (4) Prediction output: The feature map obtained in the previous step is input to the head output end to obtain the position, category and confidence of the predicted box; in the training stage, the predicted 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 stage, the prediction box is screened by weighted non-maximum suppression, and the model parameters are continuously optimized by calculating the accuracy and average precision.

[0049] Furthermore, the transfer learning training process of training and obtaining the Chinese traditional dwelling type recognition model build_reco_best.pt in step S4 is as follows:

[0050] (1) Custom configuration file: Customize the YOLOv8 network model data configuration file coco128.yaml, modify the dataset root directory path, training set image path train, validation set image path val, test set image path test, category number nc, and recognition category name names, and rename the file to build_reco.yaml.

[0051] (2) Tuning parameters and training model: Import the set build_reco.yaml file into the computer with the configured environment; load the yolov8x.pt pre-trained weight model to obtain better 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 300 generations, the initial learning rate to 0.01, the weight decay rate to 0.005, the batch size to 16 and start training; repeat the training process to make YOLOv8 gradually converge, and continuously adjust the data set through the test of the validation set to make it have generalization ability and improve accuracy.

[0052] (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 build_reco_best.pt is saved and recorded as the Chinese traditional dwelling type recognition model.

[0053] 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, which determines the initial convergence speed of the model during training; the batch size determines the number of samples used each time the model weight is updated, affecting the model's memory usage, training speed, and training stability; 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 follows:

[0054]

[0055] in, L total is the total loss function; L It is the original loss function 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; i Is an index variable used to traverse all weight parameters in the model. w i represents the i-th weight parameter in the model, is the sum of the squares of all model weights, Represents the regularization term, which is used to control the complexity of the YOLOv8x pre-trained weight model. Increasing the weight decay rate to 0.005 increases the proportion of the regularization term in the loss function, reduces the model weight, reduces the model complexity, and improves the model generalization performance.

[0056] Specifically, the traditional dwelling type training set used in the present invention covers different traditional dwelling types across the country. The data is extensive and large in scale. When processing images of dwelling 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 residential building images in different regions.

[0057] Furthermore, in step S5, the image set B to be identified consists of images of traditional dwellings from various county-level administrative units in China. These images are collected from a public image data website. A search is performed by entering the keywords "name of a county-level unit in China" + "traditional dwellings." Images of traditional dwellings from these county-level administrative units are verified and retrieved, and then named after the county-level unit to create the image set B with geographic semantic information. The use of county-level administrative units is primarily motivated by the following considerations: First, the purpose of this invention is to identify various types of traditional dwellings in China, and the images must contain the semantics of national geographic spatial information. By dividing the image set into county-level units, the names of each geographic unit are unique, reducing errors caused by image confusion due to duplicate names and improving recognition accuracy. Furthermore, at the county level, the appearance characteristics of traditional dwellings vary less, making them more representative. At larger administrative units, such as cities and provinces, the variety of traditional dwelling types is greater, potentially leading to omissions during image collection. At smaller administrative units, such as townships and villages, the appearance characteristics of traditional dwellings vary less, increasing dataset duplication and reducing work efficiency.

[0058] Furthermore, in step S6, the images in the to-be-recognized image set B are input into the model build_reco_best.pt for calculation. The confidence threshold conf-thres is set to 0.80, the intersection-over-union ratio iou-thres is set to 0.6, and the result saving function is enabled. The image recognition results and the result in the txt file are obtained for each traditional dwelling. The image recognition results include the category, detection box, and confidence score, with each detection box corresponding to a category and confidence score. The txt file results include the category and the location of the detection box. The detection box defines the rectangular boundary of the residential area, and the confidence level indicates the probability of the material within the detection box and the degree of certainty that the residential building belongs to a certain category. The txt file results include the category and the location of the detection box.

[0059] 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; wherein, each txt document contains one or more recognition result records, and a recognition result record corresponds to the category recognition result and the location information of the detection frame of a detection frame in the image recognition result.

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

[0061] ①Category. 0, corresponding to DDL_CDMJ; 1, corresponding to DDL_SGMJ; 2, corresponding to DDL_MGMJ; 3, corresponding to TYS_HYSMJ; 4, corresponding to TYS_THSMJ; 5, corresponding to WB_TL; 6, corresponding to WB_WL; 7, corresponding to DFS_DL; 8, corresponding to DFS_DF; 9, corresponding to YDS_KYY; 10, corresponding to YDS_DKY; 11, corresponding to YDS_GY; 12, corresponding to ZZS_ZFSMJ; 13, corresponding to ZZS_MNZP; 14, corresponding to ZZS_XRZ; 15, corresponding to ZZS_ZBSMJ; 16, corresponding to GLSMJ; 17, corresponding to KSMJ_AYWSMJ; 18, corresponding to KSMJ_TZF; 19, corresponding to KSMJ_ZK; 20, corresponding to TSL_LSMJ; 21, corresponding to TSL_XSFGJZ; 22, corresponding to TSL_XDLPMJ;

[0062] ② Detection frame coordinate points. These record the specific location of residential buildings within the image and can be used to extract their geometric features, further supporting traditional residential architecture research and image processing tasks. These coordinate points allow users to accurately determine the results of the txt document containing these coordinate points. This enriches the recognition results of traditional residential types and serves as an important basis for subsequent practical applications and research.

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

[0064] The normalized 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_center;

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

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

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

[0068] The position of the detection box can be recorded as (x_center, y_center, w_center, h_center).

[0069] In a second aspect, the present invention provides a lightweight traditional residential building type identification system for executing the above-mentioned traditional residential building type identification method, wherein the traditional residential building type identification system comprises:

[0070] The building type standard construction module is used to summarize and summarize the architectural types of traditional Chinese residential buildings based on public literature and residential image features, and divide traditional Chinese residential buildings into 9 categories with a total of 23 types;

[0071] The Chinese Traditional Dwelling Type Standard Construction Module is used to compile and obtain Chinese traditional dwelling types based on the "Complete Collection of Chinese Traditional Dwelling Types" published by China Architecture & Building Press in 2014 and public literature data. According to the Chinese Traditional Dwelling Type Standard, 23 Chinese traditional dwelling types are classified into 9 categories;

[0072] Various types of traditional Chinese residential image acquisition modules are used to acquire images of various types of traditional Chinese residential buildings from public image data websites to form a residential building type image set A;

[0073] A training set and validation set creation module is used to annotate traditional residential images containing 23 residential types in the residential type image set A, and form a training set T and a validation set Y in a 9:1 ratio, wherein both the training set T and the validation set Y contain 23 residential types;

[0074] The recognition model training module is used to train the YOLOv8x pre-trained weight model using the training set T created in the previous step and verify it on the validation set Y to obtain a recognition model for traditional Chinese residential types.

[0075] The module for acquiring images of traditional Chinese residential buildings to be detected is used to acquire images of traditional Chinese residential buildings across China from a public image data website or to collect images of traditional Chinese residential buildings across China in real time to form an image set B to be identified;

[0076] The residential building image recognition module is used to input an image containing a traditional Chinese residential building to be tested into a traditional residential building material type recognition model for recognition, and obtain the building material type recognition result in the image through calculation.

[0077] In a third aspect, the present invention provides an electronic device comprising a processor and a memory for storing a program executable by the processor, wherein when the processor executes the program stored in the memory, the above-mentioned method for identifying the type of traditional residential buildings is implemented.

[0078] In a fourth aspect, the present invention provides a storage medium storing a program, which, when executed by a processor, implements the above-mentioned method for identifying the type of traditional residential buildings.

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

[0080] (1) The method of the present invention realizes high-precision and high-efficiency identification of residential types. It uses the YOLOv8x pre-trained model and makes detailed adjustments to the model hyperparameters on this basis. A custom configuration file is used to adapt to the identification requirements of traditional Chinese residential types. On this basis, combined with the residential building image dataset collected independently, an innovative model specifically for the rapid identification and detection of traditional residential types is proposed. During the model optimization process, the weight decay rate is adjusted to enhance the generalization ability of the model. This improvement enables the model to show higher recognition accuracy in the process of identifying different types of traditional residential buildings. Through this optimization, we can more accurately identify the types of traditional residential buildings, which not only improves the accuracy of detection but also expands the scope of application of the model. This method fills the current gap in the field of traditional residential type image recognition, provides technical support for the efficient and accurate identification of various traditional residential types, avoids the errors caused by relying on manual experience in traditional methods, and will greatly promote the digital protection and restoration of traditional residential buildings.

[0081] (2) The technology of the present invention can be used for rapid identification and detection of traditional dwelling types across the country. The method of the present invention comprehensively applies the classification theories of multiple disciplines such as architecture, typology, botany, and materials science to carry out a fine subdivision of the types of traditional Chinese dwellings. Based on the authoritative document "Complete Collection of Traditional Chinese Dwelling Types" and combined with expert opinions, a comprehensive classification of traditional dwelling types was established, 23 major traditional dwelling types were identified, and a corresponding image database was established. The dwelling image data in this database covers traditional dwelling types in different regions, different architectural styles, and usage scenarios. It has strong representativeness and wide adaptability, ensuring that the trained model can adapt to the diversity of dwelling types in different regions, significantly enhancing the generalization performance of the model, and enabling it to maintain high accuracy and stability even when facing unseen dwelling images. Through training with these data, the present invention achieves accurate identification of traditional dwelling types across the country, ensuring that all types of traditional dwellings can be effectively identified and classified, and achieving full coverage of the identification of traditional dwelling types across the country.

[0082] (3) The technology of this invention can be used for the rapid identification and detection of traditional dwelling types across the country. By using the detection model formed by this technology and the image data with geographic information semantics that can be obtained from public image data websites, the spatial distribution of different traditional dwelling types across the country can be effectively studied. This greatly reduces the human and material costs required for related research. Ultimately, the research results will help to apply traditional dwelling types with regional characteristics in the protection and restoration of traditional dwellings across the country. BRIEF DESCRIPTION OF THE DRAWINGS

[0083] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

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

[0085] Figure 2a This is an example diagram of some of the 23 types of residential houses disclosed in this invention. Figure 2b This is an example diagram of another part of the 23 types of residential houses disclosed in this invention. Figure 2c This is an example diagram of another part of the 23 types of residential houses disclosed in the present invention;

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

[0087] Figure 4 : is a confusion matrix diagram of the optimal model obtained after multiple experiments in Example 1 of the present invention;

[0088] Figure 5 This is a schematic diagram of partial image recognition results of the input recognition model of the image set B to be recognized in Example 1 of the present invention;

[0089] Figure 6a is a schematic diagram comparing some recognition results of the models in Examples 1 and 2 of the present invention. Figure 6b is a schematic diagram comparing another part of the recognition results of the models in Examples 1 and 2 of the present invention;

[0090] Figure 7a is a schematic diagram comparing some recognition results of the models in Examples 1 and 3 of the present invention. Figure 7b is a schematic diagram comparing another part of the recognition results of the models in Examples 1 and 3 of the present invention;

[0091] Figure 8 This is a structural block diagram of a system for identifying the architectural type of traditional Chinese residential buildings in Example 4 of the present invention;

[0092] Figure 9 This is a structural diagram of an electronic device in Example 5 of the present invention. DETAILED DESCRIPTION

[0093] In order to enable those skilled in the art to better understand the present invention, the technical solutions 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 only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0094] References to "embodiments" in this application mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described in this application may be combined with other embodiments.

[0095] Example 1

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

[0097] S1. Constructing the standard for Chinese traditional dwelling types: Based on the Complete Collection of Chinese Traditional Dwelling Types published by China Architecture & Building Press in 2014 and public literature data, we compiled the types of Chinese traditional dwellings and classified them into 9 categories, totaling 23 types.

[0098] In step S1 of this embodiment, because traditional Chinese dwelling types evolved through mutual influence and share certain common characteristics, this method, based on a review of authoritative literature and expert opinion, has developed nine major categories of traditional dwelling types distributed across China. Because different traditional dwelling types can vary significantly in form, materials, appearance, color, and other factors, and these differences are reflected in the morphological characteristics of the images, this can affect the accuracy of traditional dwelling type identification. Therefore, the present invention comprehensively considers the morphological characteristics of the buildings and subdivides the nine major categories of dwelling types. Ultimately, the 23 dwelling types described above are obtained, as shown in Table 1.

[0099] Table 1. Information on types of traditional Chinese dwellings

[0100]

[0101] S2. Obtaining images of various types of traditional Chinese dwellings: Obtaining images of various types of traditional dwellings from public image data websites to form a dwelling type image set A;

[0102] In step S2 of this example, the residential type image set A is downloaded from public websites such as Bing, Google, and Baidu. Based on the names of traditional Chinese residential buildings obtained in the previous step, the relevant residential type names are input as keywords. Images of each type of traditional residential building are verified and acquired, and named according to the type name to create the residential type image set A for model training and validation. To avoid the difficulty in distinguishing the types of traditional residential buildings due to the lack of pixels due to small-scale architectural features after convolution, the residential type image set in step S2 must ensure that the residential building images can distinguish the traditional residential type. The image format is jpg. In this example, a total of 7,689 images of traditional Chinese residential buildings are obtained.

[0103] S3. Create a training set and a validation set: In the residential type image set A, use the Labelimg image annotation tool to annotate images of traditional residential buildings containing 23 residential types. The images are divided into a training set T and a validation set Y in a 9:1 ratio. Both the training set T and the validation set Y contain 23 residential types. In this embodiment, the training set T contains 6921 sample images of the 23 traditional residential types, and the training set Y contains 768 sample images of the 23 traditional residential types.

[0104] S4. Train the recognition model: Use the training set T created in the previous step to train the model based on the YOLOv8x pre-trained weight model and verify it on the validation set Y to obtain a model for recognizing the types of traditional Chinese dwellings.

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

[0106] S401. Custom configuration file: Customize the YOLOv8 network model data configuration file coco128.yaml and rename the file to build_reco.yaml. Modify the dataset root directory path, the training set image path train, the validation set image path val, the test set image path test, the number of categories nc to 23, and the identification category name names to the corresponding annotation label name.

[0107] S402. Tune the parameters and train the model: import the set build_reco.yaml file into the computer with the configured environment; load the yolov8x.pt pre-trained weight model to 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 300 generations, the initial learning rate to 0.01, the weight decay rate to 0.005, the batch size to 16 and start training; repeat the training process to make YOLOv8 gradually converge, and continuously adjust the data set through the validation set test to make it have generalization ability and improve accuracy.

[0108] S403. Model Acquisition: During training, observe the validation data on the validation set Y in real time. After training, save the optimal model (build_reco_best.pt) and record it as the Chinese Traditional Folk House Type Recognition Model. The training data on the validation set for the Chinese Traditional Folk House Type Recognition Model shows a Precision of 0.74, a Recall of 0.71, and a mAP@50 of 0.77. After training, save the optimal model (build_reco_best.pt). Precision represents the precision, Recall represents the recall, and mAP@50 represents the average precision.

[0109] Figure 3The training curves for the three loss metrics associated with "train / " show a decreasing trend, indicating that the training effect is gradually improving and the loss values ​​are decreasing. Specifically, the train / box_loss curve shows a decreasing trend during training, especially after the first 100 epochs, where it stabilizes, indicating that the model performs well in optimizing the detection box positions. The train / cls_loss curve converges after approximately 150 epochs, indicating that the model has achieved a good level of classification for traditional dwelling types under the current dataset and optimization conditions. The train / dfl_loss curve also converges after 150 epochs, indicating that the training effectively captures the key features of various traditional dwelling types. These three metrics demonstrate the scientific validity and effectiveness of this method in classifying traditional Chinese dwelling types. The training curves for the three loss metrics associated with "val / " also show a decreasing trend. Specifically, the val / box_loss curve shows that the detection box loss function on the validation set decreases significantly within the first 100 epochs and stabilizes after 150 epochs, indicating that the model can effectively optimize the detection box positions even on unseen data. The val / cls_loss curve shows that the classification loss function on the validation set decreases rapidly after approximately 50 epochs and converges after 100 epochs, indicating that the model's classification ability on the validation set has also been greatly improved. The val / dfl_loss curve shows that the feature point loss on the validation set converges after approximately 100 epochs, indicating that the model can also effectively capture feature points on the validation set. Figure 3 The accuracy metrics associated with "metrics / " in the figure show that the current model's detection box precision and recall rate increase rapidly in the early stages of training and stabilize after approximately 100 epochs, achieving high detection precision and good recall. The metrics / mAP50(B) and metrics / mAP50-95(B) curves show that the model's mean average precision (mAP) is high at an IoU threshold of 0.5, indicating that the model has good localization capabilities at standard thresholds. mAP50-95 also shows a positive upward trend with increasing IoU thresholds, but decreases slightly at high thresholds, indicating that the model still has room for improvement in boundary and detail prediction.

[0110] Overall, Figure 3 The indicators demonstrate the correctness of the object detection model used in this study and the scientific and effective nature of this method for identifying traditional Chinese dwelling types. The model trained under the current data and optimized conditions achieves good recognition results and is capable of general recognition and detection tasks.

[0111] Figure 4This is a confusion matrix plot of the optimal model obtained after multiple trials in Example 1 of the present invention. It shows the relationship between the model's predictions and the actual labels. The horizontal axis "True" represents the true value, and the vertical axis "Predicted" represents the predicted value. The numerical value represents the proportion of correct or incorrect classifications for that category, which can indicate the overall performance and confusion of the model. Specifically, the diagonal values ​​(i.e., the proportion of correct classifications) are high for most categories, indicating that the model performs well in recognizing most traditional dwelling types, with particularly strong performance in some categories, such as single-family dwellings. However, there is slight confusion within courtyard dwellings, and there is considerable confusion between sub-categories of pavilion-style dwellings, especially earthen houses. The recognition performance of the background category is relatively poor, with low diagonal values ​​and significant confusion with other categories. This is due to insufficiently distinct features in the background category or data imbalance. Future work should increase the number of background category samples and use data augmentation techniques to improve the model's recognition ability for this category. Overall, the model performs well in recognizing traditional Chinese dwelling types, achieving particularly high accuracy in some categories.

[0112] S5. Obtain images of traditional Chinese dwellings: Obtain images of traditional Chinese dwellings across China from a public image data website or collect images of traditional Chinese dwellings across China in real time to form an image set B to be identified;

[0113] In step S5 of this embodiment, the image set B to be identified consists of images of traditional dwellings from various county-level administrative units in China. First, images of traditional Chinese dwellings are downloaded from public websites such as Bing, Google, and Baidu. A search is performed using the keywords "name of Chinese county-level unit" + "traditional dwellings." Images of traditional dwellings from these county-level administrative units are verified and retrieved, and named after the county-level unit to create the image set B with geographic semantic information. To avoid missing images due to a lack of pixel count for small-scale traditional Chinese residential buildings after convolution, the image set in step S3 must ensure that the main body of the traditional residential buildings accounts for at least 50% of the image pixels. The images are in jpg format. In this embodiment, a total of 22,748 images of traditional dwellings from various county-level administrative units in China are obtained.

[0114] S6. Identify the types of traditional Chinese dwellings: Input the images in the to-be-identified image set B into the traditional dwelling type identification model for identification, and obtain the dwelling type identification results in each image through calculation.

[0115] In step S6 of this embodiment, the images in the to-be-recognized image set B are input into the Chinese Traditional Dwelling Type Recognition Model for calculation. The result is saved as a txt file, resulting in image recognition results and txt file results for each traditional dwelling. The image recognition results include a category, a detection box, and a confidence score, with each detection box corresponding to a category and confidence score. The txt file results include the category and the location of the detection box. The detection box defines the rectangular boundary of the material type, and the confidence score indicates the probability of a residential building within the detection box and the degree of certainty that the existing residential building belongs to a certain category. The txt file results include the category and the location of the detection box.

[0116] 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; among them, each txt document contains one or more records, and a record corresponds to the category recognition result and location information of the object in a detection frame in the image recognition result.

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

[0118] ①Category. 0, corresponding to DDL_CDMJ; 1, corresponding to DDL_SGMJ; 2, corresponding to DDL_MGMJ; 3, corresponding to TYS_HYSMJ; 4, corresponding to TYS_THSMJ; 5, corresponding to WB_TL; 6, corresponding to WB_WL; 7, corresponding to DFS_DL; 8, corresponding to DFS_DF; 9, corresponding to YDS_KYY; 10, corresponding to YDS_DKY; 11, corresponding to YDS_GY; 12, corresponding to ZZS_ZFSMJ; 13, corresponding to ZZS_MNZP; 14, corresponding to ZZS_XRZ; 15, corresponding to ZZS_ZBSMJ; 16, corresponding to GLSMJ; 17, corresponding to KSMJ_AYWSMJ; 18, corresponding to KSMJ_TZF; 19, corresponding to KSMJ_ZK; 20, corresponding to TSL_LSMJ; 21, corresponding to TSL_XSFGJZ; 22, corresponding to TSL_XDLPMJ;

[0119] ② Detection frame coordinate points. These record the specific location of residential buildings within the image and can be used to extract their geometric features, further supporting traditional residential architecture research and image processing tasks. These coordinate points allow users to accurately determine the results of the txt document containing these coordinate points. This enriches the recognition results of traditional residential types and serves as an important basis for subsequent practical applications and research.

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

[0121] The normalized 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_center;

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

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

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

[0125] The position of the detection box can be recorded as (x_center, y_center, w_center, h_center).

[0126] Example 2

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

[0128]

[0129] in, L total is the total loss function; L It is the original loss function 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; i Is an index variable used to traverse all weight parameters in the model. w i Indicates the first i weight parameters, is the sum of the squares of all model weights, Represents a regularization term, which is used to control the complexity of the YOLOv8x pre-trained weight model and reduce the weight decay rate to 0.001.

[0130] 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 Example 1. The training set T is input into the YOLOv8 network model for model training and verified by the validation set Y. The obtained optimal model is saved as build_reco_best2.pt. The comparison with the model evaluation data of Example 1 is shown in Table 2:

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

[0132]

[0133] 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@.5:0.95 value represents the average precision value at different intersection-over-union ratio thresholds.

[0134] In Example 2, the weight decay rate in the model parameters was reduced, causing the model to maintain relatively large weights during training. This practice increased the model's reliance on specific training samples and reduced the model's generalization ability. Consequently, the trained model exhibited poor recognition performance when trained on images of residential buildings in different regions. When tested on the validation set Y, both precision and recall declined. In terms of image recognition results, the model memorized too much training data, resulting in unstable detection box confidence. The model was highly sensitive to unseen data or subtle changes (such as shooting angle and lighting conditions), easily leading to misclassification or uncertain predictions, resulting in decreased detection box confidence (as shown in Table 2).

[0135] like Figure 6a As shown, Figure 6a The recognition test results of Build_reco_best.pt (weight-decay=0.005) and Build_reco_best2.pt (weight-decay=0.001) are shown in the figure on the left. The image recognition result of a certain image in the image set B to be recognized in Example 1 is shown. Three traditional residential entities are recognized with confidence levels of 0.92, 0.86 and 0.56 respectively. The image on the right is the image recognition result of the same image in Example 2. Two traditional residential entities are recognized. The recognition confidence levels of the same residential building entities as in Example 1 are 0.90 and 0.84. On the one hand, it shows that reducing the weight decay rate reduces the generalization ability of the model and fails to recognize the traditional residential building entities recognized by the model in Example 1. On the other hand, it also shows that reducing the weight decay rate will reduce the confidence score of the originally recognized residential type. In general, the recognition ability is reduced. Similarly, Figure 6b This also shows that the recognition ability of Example 2 has declined, and it fails to correctly identify the two types of traditional dwellings identified in Example 1. Figure 6bIn the figure, the recognition test results of Build_reco_best.pt (weight-decay=0.005) and Build_reco_best2.pt (weight-decay=0.001) are shown. The left picture shows the image recognition result of an image in the image set B to be recognized in Example 1, which identifies two types of residential buildings with two main buildings. The right picture shows the image recognition result of the same image in Example 2, which identifies the two types of residential buildings as the same category.

[0136] Input some images from the image set B to be identified, and statistically analyze the results of the model predictions in Examples 1 and 2. Calculate the false negative rate and false positive rate of each category respectively. The average of the false negative rate and false positive rate of each category is used as the comprehensive missed detection rate and false alarm rate of the Chinese traditional residential building type recognition model, which can be used as an indicator for evaluating the model performance. The relevant calculation formula is:

[0137] False Negative Rate (FNR) =

[0138] False Positive Rate (FPR) =

[0139] Mean FNR of residential type recognition model =

[0140] False positive rate of residential type recognition model (Mean FPR) =

[0141] Among them, FN (true positive) means that the model correctly identifies a certain type of residential building, FP (false positive) means that the model mistakenly identifies another type of residential building as a certain type of residential building, TN (true negative) means that the model correctly identifies that a certain type of residential building does not exist, FN (false negative) means that the model mistakenly identifies that a certain type of residential building does not exist, i represents the type of residential building of type i, represents the false negative rate of the residential building of type i, and represents the false positive rate of the residential building of type i.

[0142] The comparison of the model prediction results of Example 1 and Example 2 is shown in Table 3:

[0143] Table 3. Comparison of model prediction results between Example 1 and Example 2

[0144]

[0145] In Example 2, the weight decay rate in the model parameters was reduced, which increased the model's memory of the training data and enabled it to capture more details, thereby reducing the missed detection rate. However, due to the tendency to overfit, the model learned some unnecessary noise, resulting in an increased false positive rate and affecting the overall reliability of the model (as shown in Table 3).

[0146] Example 3

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

[0148]

[0149] in, L total is the total loss function; L It is the original loss function 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; i Is an index variable used to traverse all weight parameters in the model. w i Indicates the first i weight parameters, is the sum of the squares of all model weights, Represents a regularization term, which is used to control the complexity of the YOLOv8x pre-trained weight model and increase the weight decay rate to 0.01.

[0150] 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 Example 1. The training set T is input into the YOLOv8 network model for model training and verified by the validation set Y. The obtained optimal model is saved as build_reco_best3.pt. The comparison with the model evaluation data of Example 1 is shown in Table 4:

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

[0152]

[0153] 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@.5:0.95 value represents the average precision value at different intersection-over-union ratio thresholds.

[0154] In Example 3, the weight decay rate was added to the model parameters, resulting in a stronger penalty for weight values ​​during model training. This approach reduced the model's reliance on large weights, improved its generalization, and reduced the risk of overfitting. However, it resulted in the model tending to learn simpler feature representations, ignoring complex patterns and details in residential image data and failing to fully capture the useful information in the training data. As a result, the trained model exhibited poor recognition performance when trained on residential images from different regions. When tested on the validation set Y, both precision and recall decreased. In terms of image recognition performance, the model was better able to handle unseen data and was less susceptible to irrelevant variations (such as lighting and camera angle). However, the model also became more conservative, preferring fewer but more reliable predictions to avoid misidentification. For some traditional residential buildings with unique decorative or structural details, the model oversimplified its learned feature representations and failed to correctly recognize these nuances, thus missing some real examples (as shown in Table 4).

[0155] like Figure 7a As shown, Figure 7a The recognition test results of Build_reco_best.pt (weight-decay=0.005) and Build_reco_best3.pt (weight-decay=0.01) are shown in the figure. The left picture shows the image recognition result of a certain image in the image set B to be identified in Example 1, which identified 3 traditional residential entities with confidence levels of 0.91, 0.81 and 0.85 respectively; the right picture shows the image recognition result of the same image in Example 3, which identified 4 traditional residential entities. The material recognition confidence levels of the same parts as those in Example 1 are 0.94, 0.92 and 0.75, and the confidence level of 2 more traditional residential entities is 0.56. On the one hand, it shows that increasing the weight decay rate enhances the generalization ability of the model, and can identify the traditional residential building entities identified by the model in Example 1. On the other hand, it also shows that increasing the weight decay rate will make the confidence score of the originally identified residential type low and unstable. At the same time, if Figure 7b As shown, Figure 7bThe image on the left shows the recognition test results for Build_reco_best.pt (weight-decay=0.005) and Build_reco_best3.pt (weight-decay=0.01). The image on the left shows the image recognition results for a cave dwelling image from the to-be-recognized image set B in Example 1. Two traditional dwellings, one leaning against a cliff, were identified with confidence levels of 0.86 and 0.80, respectively. The image on the right shows the image recognition results for the same image in Example 3. Two traditional dwellings, one leaning against a cliff and one imprisoned, were identified with confidence levels of 0.48 and 0.69, respectively. This demonstrates the reduced recognition capability of Example 3. For classification scenarios that rely on complex features, it is unable to accurately capture these subtle differences, leading to misclassifications or missed detections.

[0156] Input some images from the image set B to be identified, and statistically analyze the results of the model predictions in Examples 1 and 3. Calculate the false negative rate and false positive rate of each category respectively. The average of the false negative rate and false positive rate of each category is used as the comprehensive missed detection rate and false alarm rate of the Chinese traditional residential building type recognition model. The comparison with the prediction results of the model in Example 1 is shown in Table 5:

[0157] Table 5. Comparison of model prediction results between Example 1 and Example 3

[0158]

[0159] Example 3 increases the weight decay rate in the model parameters. While this improves the model's generalization and reduces the false positive rate, it comes at the expense of an increased missed detection rate, particularly when processing complex features. The model becomes more conservative, tending to avoid false positives, but this may result in some true positive samples being overlooked (as shown in Table 5).

[0160] Example 4

[0161] Reference Figure 8 The present invention provides a lightweight Chinese traditional dwelling type recognition system for executing the above-mentioned traditional dwelling type recognition method. The traditional dwelling type recognition system comprises: a Chinese traditional dwelling type standard construction module 801, a Chinese traditional dwelling image acquisition module 802, a training set and verification set preparation module 803, a recognition model training module 804, a Chinese residential image acquisition module 805 to be detected, and a residential building image recognition module 806, which are connected in sequence.

[0162] The Chinese traditional dwelling type standard construction module 801 is used to obtain Chinese traditional dwelling types based on the "Complete Collection of Chinese Traditional Dwelling Types" published by China Architecture & Building Press in 2014 and public literature data, and to classify Chinese traditional dwelling types into 9 categories and a total of 23 types according to the Chinese traditional dwelling type standards;

[0163] Various types of traditional Chinese dwelling images acquisition module 802, used to acquire images of various types of traditional Chinese dwellings from a public image data website to form a dwelling type image set A;

[0164] The training set and validation set preparation module 803 is configured to annotate traditional residential images containing 23 residential types in the residential type image set A, and form a training set T and a validation set Y in a 9:1 ratio, wherein both the training set T and the validation set Y contain 23 residential types;

[0165] The recognition model training module 804 is used to use the training set T created in the previous step to train based on the YOLOv8x pre-trained weight model and verify it on the validation set Y to obtain a Chinese traditional dwelling type recognition model;

[0166] The module 805 for acquiring images of traditional Chinese dwellings to be detected is used to acquire images of traditional Chinese dwellings from a public image data website or to collect images of traditional Chinese dwellings in real time to form an image set B to be identified.

[0167] The residential building image recognition module 806 inputs the residential building images in the image set B to be recognized into the Chinese traditional residential type recognition model for recognition, and obtains the type recognition results of the images in the image set B to be recognized through calculation.

[0168] Example 5

[0169] This embodiment provides an electronic device, which may be a computer, such as Figure 9 As shown, a processor 902, a memory, an input device 903, a display 904, and a network interface 905 are connected via a system bus 901. The processor is used to provide computing and control capabilities. The memory includes a non-volatile storage medium 906 and an internal memory 907. The non-volatile storage medium 906 stores an operating system, a computer program, and a database. The internal memory 907 provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. When the processor 902 executes the computer program stored in the memory, a lightweight Chinese traditional dwelling type identification method proposed in the above-mentioned embodiment 1 is implemented. The traditional dwelling type identification method includes the following steps:

[0170] S1. Constructing the standard for Chinese traditional dwelling types: Based on the Complete Collection of Chinese Traditional Dwelling Types published by China Architecture & Building Press in 2014 and public literature data, we compiled the types of Chinese traditional dwellings and classified them into 9 categories, totaling 23 types.

[0171] S2. Obtaining images of various types of traditional Chinese dwellings: Obtain images of various types of traditional Chinese dwellings from a public image data website to form a dwelling type image set A;

[0172] S3. Create a training set and a validation set: In the residential type image set A, annotate images of traditional residential buildings containing 23 target residential types and divide them into a training set T and a validation set Y in a ratio of 9:1. Both the training set T and the validation set Y contain 23 residential types.

[0173] S4. Train the recognition model: Use the training set T created in the previous step to train the model based on the YOLOv8x pre-trained weight model and verify it on the validation set Y to obtain a model for recognizing the types of traditional Chinese dwellings.

[0174] S5. Obtain images of traditional Chinese dwellings: Obtain images of traditional Chinese dwellings across China from a public image data website or collect images of traditional Chinese dwellings across China in real time to form an image set B to be identified;

[0175] S6. Identify the types of traditional Chinese dwellings: Input the dwelling images in the to-be-identified image set B into the traditional Chinese dwelling type identification model for identification, and obtain the type identification results of the images in the to-be-identified image set B through calculation.

[0176] Example 6

[0177] This embodiment provides a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, the method for identifying the types of traditional Chinese dwellings proposed in the first embodiment is implemented. The method includes the following steps:

[0178] S1. Constructing the standard for Chinese traditional dwelling types: Based on the Complete Collection of Chinese Traditional Dwelling Types published by China Architecture & Building Press in 2014 and public literature data, we compiled the types of Chinese traditional dwellings and classified them into 9 categories, totaling 23 types.

[0179] S2. Obtaining images of various types of traditional Chinese dwellings: Obtain images of various types of traditional Chinese dwellings from a public image data website to form a dwelling type image set A;

[0180] S3. Create a training set and a validation set: In the residential type image set A, annotate images of traditional residential buildings containing 23 target residential types and divide them into a training set T and a validation set Y in a ratio of 9:1. Both the training set T and the validation set Y contain 23 residential types.

[0181] S4. Train the recognition model: Use the training set T created in the previous step to train the model based on the YOLOv8x pre-trained weight model and verify it on the validation set Y to obtain a model for recognizing the types of traditional Chinese dwellings.

[0182] S5. Obtain images of traditional Chinese dwellings: Obtain images of traditional Chinese dwellings across China from a public image data website or collect images of traditional Chinese dwellings across China in real time to form an image set B to be identified;

[0183] S6. Identify the types of traditional Chinese dwellings: Input the dwelling images in the to-be-identified image set B into the traditional Chinese dwelling type identification model for identification, and obtain the type identification results of the images in the to-be-identified image set B through calculation.

[0184] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0185] 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 considered as equivalent replacement methods and are included in the scope of protection of the present invention.

Claims

1. A method for identifying the types of traditional Chinese dwellings based on deep neural networks, characterized in that: The method for identifying the type of traditional Chinese residential buildings is targeted at identifying traditional Chinese residential buildings and includes the following steps: S1. Constructing the standard for Chinese traditional dwelling types: Based on the Complete Collection of Chinese Traditional Dwelling Types and public literature data, the types of Chinese traditional dwellings were sorted out. According to the standard for Chinese traditional dwelling types, 23 types of Chinese traditional dwellings in 9 categories were defined; S2. Obtaining images of various types of traditional Chinese dwellings: Obtain images of various types of traditional Chinese dwellings from a public image data website to form a dwelling type image set A; S3. Create a training set and a validation set: In the residential type image set A, annotate images of traditional residential buildings containing 23 target residential types and divide them into a training set T and a validation set Y in a ratio of 9:

1. Both the training set T and the validation set Y contain 23 residential types. S4. Training the recognition model: using the training set T prepared in the previous step, training is performed on the basis of the YOLOv8x pre-trained weight model, and verification is performed on the verification set Y to obtain a Chinese traditional folk house type recognition model; the process of training and obtaining the Chinese traditional folk house type recognition model build_reco_best.pt in step S4 includes: loading the YOLOv8x pre-trained model, setting the number of training iterations to 300 generations, the initial learning rate to 0.01, the weight decay rate to 0.005, and the batch size to 16, and testing the trained model on the verification set Y to verify the model and finally obtain the Chinese traditional folk house type recognition model build_reco_best.pt; The YOLOv8x pre-trained weight model hyperparameters are set, and the formula for the total loss function is: in, L total is the total loss function; L It is the original loss function 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; i is the index variable used to traverse all weight parameters in the model, w i represents the i-th weight parameter in the model, is the sum of the squares of all model weights, Represents the regularization term, which is used to control the complexity of the YOLOv8x pre-trained weight model; S5. Obtain images of traditional Chinese dwellings: Obtain images of traditional Chinese dwellings across China from a public image data website or collect images of traditional Chinese dwellings across China in real time to form an image set B to be identified; S6, identify the type of traditional Chinese dwellings: input the dwelling pictures in the image set B to be identified into the Chinese traditional dwelling type identification model for identification, and obtain the type identification results of the images in the image set B to be identified by calculation; in the step S6, input the pictures in the image set B to be identified into the model build_reco_best.pt for calculation, set the confidence threshold conf-thres to 0.80, set the interaction ratio threshold iou-thres to 0.60, set to save the txt document results, and obtain the image recognition results and txt document results of each traditional dwelling; image recognition The identification results include category, detection frame, and confidence score. One detection frame corresponds to one category and confidence score. The txt document results include category and detection frame location information. The confidence score indicates the probability that the Chinese traditional residential type recognition model believes that there is a residential type in the detection frame and the degree of certainty that the existing residential building 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 a residential target of a certain category exists in the detection frame. A confidence score close to 0 indicates that the model is doubtful about the residential target in the detection frame, or believes that there is no residential target in the detection frame. The image recognition results of each traditional dwelling are written into a separate txt file. The txt file name is consistent with the source image. Each txt file contains one or more recognition result records. A recognition result record corresponds to the category recognition result and location information of the object in a detection frame in the image recognition result.

2. The method for identifying the types of traditional Chinese dwellings according to claim 1, characterized in that: The traditional Chinese residential type standard selects images of traditional Chinese residential buildings from the ground angle as the target object and defines 9 categories with a total of 23 types of traditional Chinese residential buildings, namely: The first type of residential type is single-family residential type, denoted as DDL, which can be subdivided into thatched-roof residential type, stone-structured residential type and wooden-structured residential type, denoted as DDL_CDMJ, DDL_SGMJ and DDL_MGMJ respectively; the second type of residential type is courtyard-style residential type, denoted as TYS, which can be subdivided into courtyard-style residential type and hall-style residential type, denoted as TYS_HYSMJ and TYS_THSMJ respectively; the third type of residential type is walled-fort residential type, denoted as WB, which can be subdivided into earth building and walled building, denoted as WB_TL and WB_WL respectively; the fourth type of residential type is watchtower-style residential type, denoted as DF, which can be subdivided into watchtower and watchtower-style residential type, denoted as DF_DL and DF_DF respectively; the fifth type of residential type is cave-dwelling residential type, denoted as YDS, which can be subdivided into cliff-side cave, pit courtyard and cave cave, denoted as YDS_KYY and YDS_KYY respectively. _DKY, YDS_GY; the sixth type of residential type is felt-tent-style residential type, denoted by ZZS, which can be further divided into account-style residential type, yak tent-style residential type, slanted pillar-style residential type and felt-style residential type, denoted by ZZS_ZFSMJ, ZZS_MNZP, ZZS_XRZ, ZZS_ZBSMJ respectively; the seventh type of residential type is stilt-style residential type, denoted by GLSMJ; the eighth type of residential type is gallery-style residential type, denoted by KSMJ, which can be further divided into Ayiwangshi residential type, Tuzhang residential type and Zhuangkuo residential type, denoted by KSMJ_AYWSMJ, KSMJ_TZF, KSMJ_ZK respectively; the ninth type of residential type is special type residential type, denoted by TSL, which can be further divided into waterside residential type, Western-style building and modern townhouse, denoted by TSL_LSMJ, TSL_XSFGJZ, TSL_XDLPMJ respectively.

3. The method for identifying the types of traditional Chinese dwellings according to claim 1, characterized in that: The residential type image set A is an image of traditional residential buildings of various types in China. The image data is collected from a public image data website based on the constructed Chinese traditional residential type standard. The residential type name is input, and images of various types of traditional residential buildings are verified and obtained. The images are named with the type name to produce the residential type image set A for training and verifying the traditional residential type recognition model. The residential type is judged based on the main body of the traditional residential image building in the residential type image set A. The image format is jpg.

4. The method for identifying the types of traditional Chinese dwellings according to claim 1, characterized in that: In step S3, the labeling method of the type of dwellings in the images of traditional dwellings is implemented by the Labelimg image labeling tool; in step S5, the image set B to be identified is the images of traditional dwellings in 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 in the county-level administrative unit are verified and obtained, and named after the county-level unit to produce the image set B to be identified with geographic semantic information.

5. A lightweight Chinese traditional dwelling type identification system, used to implement the traditional dwelling type identification method according to any one of claims 1 to 4, characterized in that: The Chinese traditional dwelling type identification system includes: The Chinese Traditional Dwelling Type Standard Construction Module is used to compile and obtain Chinese traditional dwelling types based on the "Complete Collection of Chinese Traditional Dwelling Types" published by China Architecture & Building Press in 2014 and public literature data. According to the Chinese Traditional Dwelling Type Standard, 23 Chinese traditional dwelling types are classified into 9 categories; Various types of traditional Chinese residential image acquisition modules are used to acquire images of various types of traditional Chinese residential buildings from public image data websites to form a residential building type image set A; A training set and validation set creation module is used to annotate traditional residential images containing 23 residential types in the residential type image set A, and form a training set T and a validation set Y in a 9:1 ratio, wherein both the training set T and the validation set Y contain 23 residential types; The recognition model training module is used to train the YOLOv8x pre-trained weight model using the training set T created in the previous step and verify it on the validation set Y to obtain a recognition model for traditional Chinese residential types. The module for acquiring images of traditional Chinese residential buildings to be detected is used to acquire images of traditional Chinese residential buildings across China from a public image data website or to collect images of traditional Chinese residential buildings across China in real time to form an image set B to be identified; The residential building image recognition module is used to input an image containing a traditional Chinese residential building to be tested into a traditional residential building material type recognition model for recognition, and obtain the building material type recognition result in the image through calculation.

6. An electronic device comprising a processor and a memory for storing a program executable by the processor, characterized in that: When the processor executes the program stored in the memory, it implements the method for identifying the type of traditional Chinese dwellings as described in any one of claims 1 to 4.

7. A storage medium storing a program, characterized in that: When the program is executed by a processor, the method for identifying the type of traditional Chinese dwellings according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Building traditional feature recognition and evaluation method and system

    CN114331031A