Ancient space image-based city-mountain space relationship analysis method

By extracting Chengshan text elements and morphological elements from ancient spatial images and forming Chengshan text-morphological elements pairs, the problem of insufficient accuracy and comprehensiveness of urban-shan spatial relationship analysis in the existing technology is solved, and more efficient and accurate analysis results are achieved.

CN119600637AActive Publication Date: 2025-03-11CHONGQING UNIV
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411672777.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-03-11
Estimated Expiration
2044-11-21

Smart Images

  • Figure CN119600637A_ABST
    Figure CN119600637A_ABST
Patent Text Reader

Abstract

The invention discloses a city-mountain space relation analysis method based on an ancient space image. The method comprises the following steps: acquiring the ancient space image of a target area; performing character recognition and extraction on the ancient space image of the target area to obtain cheng and mountain character elements; performing form recognition and extraction on the ancient space image of the target area to obtain urban mountain form elements; associating the urban mountain form elements of the target area with the corresponding urban mountain character elements to form urban mountain character-form element pairs; classifying the city and mountain character-form element pairs into a city element data set and a mountain element data set; and analyzing the spatial relationship between the city and the mountain based on the city element data set and the mountain element data set of the target area. According to the method, the city and mountain character elements and the city and mountain form elements of the ancient space image are extracted, so that the accuracy and comprehensiveness of city and mountain space relation analysis can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of spatial relationship analysis, and in particular to a city-mountain spatial relationship analysis method based on ancient spatial images. Background Art

[0002] In ancient times, spatial images, as an important means of recording history and depicting natural and cultural landscapes, provide us with a valuable window into ancient society, culture and environment. In these images, the relationship between cities and mountains is particularly striking. They not only reflect the ancients' profound understanding and ingenious use of the geographical environment, but also embody the wisdom of urban planning and the integration of ecological concepts. In-depth analysis of the spatial relationship between cities and mountains in ancient spatial images is of great significance for understanding the layout principles, ecological environment, military defense and cultural symbols of cities.

[0003] In ancient spatial images, the relationship between cities and mountains presents a variety of forms. Some cities are built on the mountains, using the natural barriers and resources provided by the mountains to form a solid defense system and a rich ecosystem; some cities are located at the foot of the mountain or in the mountain plains, keeping a certain distance from the mountain, which not only enjoys the nourishment of the mountain, but also avoids the threat of natural disasters such as mountain torrents. In addition, some cities are built directly on the top of the mountain. This unique layout is often based on military defense considerations, using the steep terrain of the mountain to form a natural defense barrier.

[0004] By analyzing the spatial relationship between cities and mountains in ancient spatial images, we can reveal the profound wisdom of ancient urban planning. According to the shape, height, slope and other characteristics of the mountains, the ancients cleverly planned the layout of the city, making the city and the mountains complement each other, which not only met people's living needs, but also embodied the respect for nature and the concept of harmonious coexistence. The relationship between cities and mountains also reflects the ecological environment of ancient cities. As an important part of the city, the mountain provides the city with rich natural resources, such as water, wood, and minerals. At the same time, the mountain also undertakes ecological functions such as regulating climate, purifying air, and maintaining water and soil. By analyzing the spatial relationship between cities and mountains, we can have a deeper understanding of the ecological environment of ancient cities and their impact on human life.

[0005] The spatial relationship between the city and the mountain in ancient urban planning provides us with valuable experience. In urban planning, we can learn from the wisdom of the ancients, fully consider the characteristics and limitations of the natural environment, rationally plan the layout and functional zoning of the city, and achieve harmonious coexistence between man and nature. By analyzing the spatial relationship between the city and the mountain in ancient spatial images, we can better understand and appreciate the value and significance of ancient cultural heritage. This will help us strengthen the protection and inheritance of cultural heritage and allow more people to understand and appreciate the charm of ancient culture. The spatial relationship between the city and the mountain in ancient spatial images involves multiple disciplines such as geography, history, and architecture. Through interdisciplinary research and cooperation, we can more comprehensively understand and analyze the nature and laws of this phenomenon and promote the development and progress of related disciplines.

[0006] Therefore, analyzing the spatial relationship between cities and mountains in ancient spatial images plays an important role in understanding the wisdom of ancient urban planning, the state of the ecological environment, the significance of cultural symbols, and providing reference for modern urban planning. However, there is currently no method for analyzing the spatial relationship between cities and mountains based on ancient spatial images. Summary of the invention

[0007] In view of the deficiencies of the above-mentioned prior art, the technical problem to be solved by the present invention is: how to provide a city-mountain spatial relationship analysis method based on ancient spatial images, respectively extract the city and mountain text elements and city and mountain morphological elements of the ancient spatial images, so as to improve the accuracy and comprehensiveness of the city-mountain spatial relationship analysis; at the same time, the extracted city and mountain text elements and city and mountain morphological elements are divided into data sets, thereby improving the efficiency and convenience of the city-mountain spatial relationship analysis.

[0008] In order to solve the above technical problems, the present invention adopts the following technical solutions:

[0009] A city-mountain spatial relationship analysis method based on ancient spatial images, including:

[0010] S1: Acquire ancient space images of the target area;

[0011] S2: Perform text recognition and extraction on the ancient space image of the target area to obtain Chengshan text elements;

[0012] S3: Perform morphological recognition and extraction on the ancient spatial images of the target area to obtain the city and mountain morphological elements;

[0013] S4: Associating the Chengshan morphological elements of the target area with the corresponding Chengshan text elements to form Chengshan text-morphological element pairs;

[0014] S5: Classify the city and mountain character-morphological element pairs into a city element dataset and a mountain element dataset;

[0015] S6: Analyze the spatial relationship between cities and mountains based on the city feature dataset and mountain feature dataset of the target area.

[0016] Preferably, in step S2, after extracting the Chengshan text element of the ancient space image, the position information of the Chengshan text element in the corresponding ancient space image is located; and the Chengshan text element is bound to its position information in the corresponding ancient space image.

[0017] Preferably, in step S3, after extracting the city-mountain morphological elements of the ancient space image, the position information of the city-mountain morphological elements in the corresponding ancient space image is located;

[0018] In step S4, the Chengshan morphological element is associated with the Chengshan character element corresponding to its position information in the corresponding ancient space image to form a Chengshan character-morphological element pair.

[0019] Preferably, in step S2, the Chengshan character elements of the ancient space image are extracted by the following steps:

[0020] S201: Preprocessing of ancient space images;

[0021] S202: Binarizing the pre-processed ancient space image to obtain a city and mountain binary image;

[0022] S203: performing morphological processing on the city and mountain binary image;

[0023] S204: Identify and mark connected domains in the morphologically processed Chengshan binary image; segment the identified connected domains into independent characters;

[0024] S205: Recognize the corresponding text based on the segmented characters through the OCR recognition model to obtain the Chengshan text element.

[0025] Preferably, in step S3, the city and mountain morphological elements of the ancient space image are extracted through the following steps:

[0026] S301: preprocessing ancient space images;

[0027] S302: inputting the preprocessed ancient space image into the trained shape recognition model, recognizing and marking the target shape in the ancient space image, and outputting the city and mountain space image with the target shape segmentation mask; wherein the shape recognition model is constructed based on a convolutional neural network model;

[0028] S303: Input the city-mountain space image with the target shape segmentation mask into the trained shape segmentation model, segment the target shape from the background of the ancient space image, and output the target shape image as the city-mountain morphological element; wherein the shape segmentation model is constructed based on the SegNet model.

[0029] Preferably, in step S302, the shape recognition model is trained by the following steps:

[0030] S3021: Obtain a Chengshan image sample containing a target shape, annotate the target shape in the Chengshan image sample, and generate an annotated image containing a segmentation mask of the target shape;

[0031] S3022: Divide all the annotated images into a training set, a validation set, and a test set;

[0032] S3023: Constructing shape recognition model based on convolutional neural network;

[0033] S3024: input the training set into the shape recognition model, calculate the model loss through forward propagation, and update the model parameters through back propagation until the shape recognition model achieves satisfactory performance on the validation set;

[0034] S3025: Evaluate the performance of the shape recognition model using validation and test sets, and make necessary adjustments.

[0035] Preferably, in step S303, the shape segmentation model is trained by the following steps:

[0036] S3031: Obtain city-mountain image samples containing the target shape, and generate a corresponding segmentation mask for each city-mountain image sample;

[0037] S3032: Divide all city-mountain image samples and corresponding segmentation masks into a training set, a validation set, and a test set;

[0038] S3033: Build a shape segmentation model based on SegNet;

[0039] S3034: inputting Chengshan image samples and segmentation masks in the training set into the shape segmentation model in batches for training, and updating the model weights through the back propagation algorithm until the shape recognition model achieves satisfactory performance on the validation set;

[0040] S3035: Evaluate the performance of the shape recognition model using validation and test sets, and make necessary adjustments.

[0041] Preferably, in step S5, the Chengshan character-morphological element pairs are classified based on the character names of the Chengshan character elements and the morphological structures of the Chengshan morphological elements in the Chengshan character-morphological element pairs to obtain a Cheng element dataset and a Shan element dataset.

[0042] Preferably, in step S6, the city elements include city walls, city structures and landmark buildings;

[0043] The city feature dataset includes the city wall feature subset, the urban structure feature subset, and the landmark building feature subset.

[0044] Preferably, in step S6:

[0045] Based on the mountain feature dataset and the city wall feature subset in the target area, the macro-scale spatial relationship between the city and the mountains is analyzed;

[0046] Based on the mountain feature dataset and the urban establishment feature subset of the target area, the mesoscale spatial relationship between the city and the mountain is analyzed;

[0047] Based on the mountain feature dataset and landmark building feature subset of the target area, the micro-scale spatial relationship between the city and the mountains is analyzed.

[0048] Compared with the prior art, the city-mountain spatial relationship analysis method based on ancient spatial images in the present invention has the following beneficial effects:

[0049] The present invention extracts the city and mountain text elements and the city and mountain morphological elements of the ancient spatial image respectively and forms a city and mountain text-morphological element pair. First, the text element can reflect the name and related description of the city and the mountain, and the morphological element can reflect the appearance and structure of the city and the mountain. By associating the text element with the morphological element, a more complete information system can be formed. For example, through text recognition, it is known that a certain place is a certain city, and morphological recognition confirms the outline and layout of the city wall at that place. Through the combination of the two, the relationship between the city and the surrounding mountains can be more accurately located and analyzed, thereby improving the accuracy of the spatial relationship analysis between the city and the mountain. Secondly, the text (element) information and morphological information are comprehensively considered to avoid the one-sidedness that may be brought about by a single information source. For example, relying only on text information may not accurately describe the actual layout of the city, and relying only on morphological information may ignore important historical background information, thereby improving the comprehensiveness of the spatial relationship analysis between the city and the mountain. Finally, by constructing the city and mountain text-morphological element pair, basic data is provided for the subsequent spatial relationship analysis. This paired data is convenient for quantitative analysis, spatial modeling and other operations, thereby more deeply revealing the spatial relationship between the city and the mountain.

[0050] The present invention classifies the city-mountain text-morphological element pairs into a city element data set and a mountain element data set, and then analyzes the spatial relationship between the city and the mountain. By dividing the element pairs into a city element data set and a mountain element data set, the information of the city and the mountain can be reflected respectively, which is convenient for targeted analysis and processing of the city and the mountain; and the classified data set can easily extract the required city information and mountain information, which is convenient for targeted analysis of the spatial relationship analysis of the city and the mountain, thereby improving the efficiency and convenience of the spatial relationship analysis of the city and the mountain. At the same time, the city element data set or the mountain element data set can be subdivided later, and then the spatial relationship analysis of different scales can be performed based on the subdivided subsets, thereby improving the flexibility of the spatial relationship analysis of the city and the mountain. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to make the purpose, technical solution and advantages of the invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings, in which:

[0052] Figure 1 It is a logical block diagram of the city-mountain spatial relationship analysis method based on ancient spatial images;

[0053] Figure 2 Flow chart for collecting ancient space images;

[0054] Figure 3 Schematic diagram of text recognition and extraction from ancient space images;

[0055] Figure 4 This is the network structure diagram of the morphology recognition (CNN) model;

[0056] Figure 5 This is the network structure diagram of the morphological segmentation (SegNet) model. DETAILED DESCRIPTION

[0057] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, 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 part of the embodiments of the present invention, not all of the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but only represents selected embodiments of the present invention. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work belong to the scope of protection of the present invention.

[0058] The following is a further detailed description through specific implementation methods:

[0059] Example:

[0060] This embodiment discloses a city-mountain spatial relationship analysis method based on ancient spatial images.

[0061] like Figure 1 As shown in the figure, the city-mountain spatial relationship analysis method based on ancient spatial images includes:

[0062] S1: Obtain ancient space images of the target area (such as a city or region);

[0063] Combination Figure 2As shown in the figure, the types of ancient spatial images are divided into six categories, including: ① Typical illustrations of classics (such as the "Yu Gong Jiuzhou Map" in the "Book of Documents"); ② Local chronicles illustrations: including maps, construction maps, and eight scenes; Figure 3 ③ Other ancient maps (such as maps of local features, maps engraved on stone tablets, maps of lost sources, etc.); ④ Local landscape paintings; ⑤ Han Dynasty brick paintings, rock paintings, and murals; ⑥ Modern urban surveying and mapping maps.

[0064] ① and ② images can be collected on platforms such as "China Basic Ancient Books Database", "China Philosophy Book Electronicization Plan", "China Local Records Database", and "China Digital Local Records Database"; ③ images collect all images from "China Ancient Atlas", "China Historical Atlas" and local map collections; ④ images collect all local verifiable landscape paintings from "Pre-Qin, Han and Tang Dynasty Painting Collection", "Song Dynasty Painting Collection", "Ming Dynasty Painting Collection", and "Qing Dynasty Painting Collection"; ⑤ images collect natural theme paintings from "China Han Dynasty Picture Stone Collection", "China Tomb Murals Collection", and "China Dunhuang Murals Collection"; ⑥ images are collected by massively searching for local modern map images in the network. The six types of images are preliminarily collected and scanned and digitized to form a closed "city-mountain" image data collection library, and a total of 13,141 images have been collected so far. Among them, local chronicles illustrations and other ancient maps are the main data types. At present, more than 9,803 local chronicles illustrations of 141 historical and cultural cities, the clarity improvement of other ancient maps and the pre-processing of image and text digitization have been completed, including 1,259 maps, 282 construction maps, 224 eight-view maps, and 8,038 other ancient maps.

[0065] S2: Perform text recognition and extraction on the ancient space image of the target area to obtain Chengshan text elements;

[0066] S3: Perform morphological recognition and extraction on the ancient spatial images of the target area to obtain the city and mountain morphological elements;

[0067] S4: Associating the Chengshan morphological elements of the target area with the corresponding Chengshan text elements to form Chengshan text-morphological element pairs;

[0068] S5: Classify the city and mountain character-morphological element pairs into a city element dataset and a mountain element dataset;

[0069] S6: Analyze the spatial relationship between cities and mountains based on the city feature dataset and mountain feature dataset of the target area.

[0070] The present invention extracts the city and mountain text elements and the city and mountain morphological elements of the ancient spatial image respectively and forms a city and mountain text-morphological element pair. First, the text element can reflect the name and related description of the city and the mountain, and the morphological element can reflect the appearance and structure of the city and the mountain. By associating the text element with the morphological element, a more complete information system can be formed. For example, through text recognition, it is known that a certain place is a certain city, and morphological recognition confirms the outline and layout of the city wall at that place. Through the combination of the two, the relationship between the city and the surrounding mountains can be more accurately located and analyzed, thereby improving the accuracy of the spatial relationship analysis between the city and the mountain. Secondly, the text (element) information and morphological information are comprehensively considered to avoid the one-sidedness that may be brought about by a single information source. For example, relying only on text information may not accurately describe the actual layout of the city, and relying only on morphological information may ignore important historical background information, thereby improving the comprehensiveness of the spatial relationship analysis between the city and the mountain. Finally, by constructing the city and mountain text-morphological element pair, basic data is provided for the subsequent spatial relationship analysis. This paired data is convenient for quantitative analysis, spatial modeling and other operations, thereby more deeply revealing the spatial relationship between the city and the mountain.

[0071] The present invention classifies the city-mountain text-morphological element pairs into a city element data set and a mountain element data set, and then analyzes the spatial relationship between the city and the mountain. By dividing the element pairs into a city element data set and a mountain element data set, the information of the city and the mountain can be reflected respectively, which is convenient for targeted analysis and processing of the city and the mountain; and the classified data set can easily extract the required city information and mountain information, which is convenient for targeted analysis of the spatial relationship analysis of the city and the mountain, thereby improving the efficiency and convenience of the spatial relationship analysis of the city and the mountain. At the same time, the city element data set or the mountain element data set can be subdivided later, and then the spatial relationship analysis of different scales can be performed based on the subdivided subsets, thereby improving the flexibility of the spatial relationship analysis of the city and the mountain.

[0072] In the specific implementation process, after the Chengshan text element of the ancient space image is extracted, the position information of the Chengshan text element in the corresponding ancient space image is located; and the Chengshan text element is bound to its position information in the corresponding ancient space image.

[0073] In this embodiment, the ancient space image may be gridded, and then the lower left corner of the ancient space image is used as the origin to calculate the position coordinates of the Chengshan text element in the ancient space image as the position information.

[0074] In the specific implementation process, after extracting the city-mountain morphological elements of the ancient space image, the position information of the city-mountain morphological elements in the corresponding ancient space image is located;

[0075] In step S4, the Chengshan morphological element is associated with the Chengshan character element corresponding to its position information in the corresponding ancient space image to form a Chengshan character-morphological element pair.

[0076] After extracting the city and mountain text elements and the city and mountain morphological elements, the present invention locates the position information of the elements in the ancient space image. When a certain element is subsequently retrieved through the database, the specific position of the element in the space image can be directly located, which is conducive to the accurate extraction of element information. At the same time, by using the position information as a reference for the association between text and morphological elements, the association between the city and mountain text elements and the city and mountain morphological elements can be accurately established, which is conducive to improving the accuracy and comprehensiveness of the subsequent analysis of the spatial relationship between the city and the mountain.

[0077] In the specific implementation process, Figure 3 As shown in the figure, the Chengshan text elements of the ancient space image are extracted through the following steps:

[0078] S201: Preprocessing of ancient space images;

[0079] In this embodiment, the ancient space image may be affected by factors such as time erosion, pollution, fading, etc., causing the text information to become blurred or difficult to recognize. Therefore, it is necessary to enhance the image, such as denoising, sharpening, color correction, etc., to improve the clarity of the text in the image.

[0080] S202: Binarizing the pre-processed ancient space image to obtain a city and mountain binary image;

[0081] In this embodiment, binarization can be achieved by a global threshold method or an adaptive threshold method. The global threshold method: selects a global threshold, sets pixels with grayscale values ​​higher than the threshold as foreground (white), and the rest as background (black), which is suitable for the case where the background brightness is uniform. The adaptive threshold method (such as the Otsu method): automatically calculates the optimal threshold according to the grayscale histogram of the image, which is suitable for the case where the background brightness is uneven.

[0082] S203: performing morphological processing on the Chengshan binary image, including corrosion, expansion, opening operation or closing operation;

[0083] In this embodiment, erosion refers to removing small pixels at the edge of the image, which helps to remove noise. Dilation refers to making the white area in the image larger, which helps to fill the holes inside the characters. Opening (erosion followed by dilation) refers to removing small white areas (noise) while keeping the shape of the characters unchanged. Closing (dilation followed by erosion) refers to filling small black areas (holes) while keeping the separation between characters.

[0084] S204: Identify and mark connected domains in the morphologically processed binary image (where each connected domain corresponds to a character or a part of a character); segment the identified connected domains into independent characters;

[0085] In this embodiment, a connected domain analysis algorithm (such as depth-first search or breadth-first search) is used to traverse the Chengshan binary image and mark each connected domain. According to the size, shape and other characteristics of the connected domain, the qualified character area is screened out. For example, the connected domain that is too small or too large can be removed. The contour of the connected domain is extracted using a contour detection algorithm (such as Canny edge detection), and then the characters are segmented according to the shape and position information of the contour.

[0086] S205: Recognize the corresponding characters based on the segmented characters through an OCR (Optical Character Recognition) recognition model to obtain Chengshan character elements.

[0087] In this embodiment, character recognition can be achieved through existing OCR (optical character recognition) recognition models or tools, such as Tesseract model, Baidu OCR model, LightPDF, CamScanner and other mature models or tools.

[0088] The invention can improve the clarity and operability of ancient space images through image preprocessing, binarization processing and morphological processing; at the same time, through the connected domain analysis algorithm and OCR recognition technology, it can accurately extract and recognize the text information in the ancient space images, thereby improving the accuracy of the extraction of city and mountain text elements.

[0089] In the specific implementation process, the city and mountain morphological elements of the ancient space image are extracted through the following steps:

[0090] S301: preprocessing ancient space images;

[0091] In this embodiment, the preprocessing may refer to step S201.

[0092] S302: inputting the preprocessed ancient space image into the trained shape recognition model, recognizing and marking the target shape in the ancient space image, and outputting the city and mountain space image with the target shape segmentation mask; wherein the shape recognition model is constructed based on a convolutional neural network (CNN) model;

[0093] S303: Input the city-mountain space image with the target shape segmentation mask into the trained shape segmentation model, segment the target shape from the background of the ancient space image, and output the target shape image as the city-mountain morphological element; wherein the shape segmentation model is constructed based on the SegNet model.

[0094] Specific, combined Figure 4As shown, the shape recognition model is trained through the following steps:

[0095] S3021: Obtain a Chengshan image sample containing a target shape, annotate the target shape in the Chengshan image sample, and generate an annotated image containing a segmentation mask of the target shape;

[0096] In this embodiment, the target shapes include mountains, city walls, urban structures, landmark buildings, etc. Image annotation tools (such as LabelImg, VIA, etc.) are used to implement the annotation of the target shapes.

[0097] S3022: Divide all the annotated images into a training set, a validation set, and a test set;

[0098] In this embodiment, the annotated image needs to be preprocessed to make it suitable for input into the CNN model. Preprocessing includes image scaling, data enhancement and normalization. Image scaling: adjust all images to the same size to meet the input requirements of the model. Data enhancement: increase the diversity of data and improve the generalization ability of the model through methods such as rotation, flipping, cropping, color transformation, etc. Normalization: normalize the image pixel values ​​to a specific range (such as 0-1) to accelerate the model training process and increase the convergence speed.

[0099] S3023: Constructing shape recognition model based on convolutional neural network;

[0100] In this embodiment, a pre-trained CNN model (such as VGG, ResNet, MobileNet, etc.) can be selected as the basic model; on the basis of the basic model, additional convolutional layers, pooling layers, fully connected layers, etc. are added to extract more complex features and perform classification. According to the task requirements, the output layer of the shape recognition model selects segmentation mask prediction.

[0101] S3024: input the training set into the shape recognition model, calculate the model loss through forward propagation, and update the model parameters through back propagation until the shape recognition model achieves satisfactory performance on the validation set;

[0102] S3025: Evaluate the performance of the shape recognition model using validation and test sets, and make necessary adjustments.

[0103] Specific, combined Figure 5 As shown, the shape segmentation model is trained through the following steps:

[0104] S3031: Obtain city-mountain image samples containing the target shape, and prepare a corresponding segmentation mask for each city-mountain image sample;

[0105] In this embodiment, the target shape includes mountains, city walls, urban structures and landmark buildings, etc. The segmentation mask is a binary image, the target shape is white, and the background is black.

[0106] S3032: Divide all city-mountain image samples and corresponding segmentation masks into a training set, a validation set, and a test set;

[0107] In this embodiment, the Chengshan image samples and segmentation masks need to be preprocessed. The preprocessing includes: image scaling, adjusting the image and mask to the size required for SegNet model input; data enhancement, applying data enhancement techniques such as rotation, flipping, and scaling to increase the diversity of the data set and improve the generalization ability of the model; normalization, normalizing the image pixel values ​​to the range of [0,1] to speed up model training and improve performance.

[0108] S3033: Build a shape segmentation model based on SegNet and randomly initialize the weights of the shape segmentation model;

[0109] In this embodiment, the shape segmentation (SegNet) model is an encoder-decoder architecture. The encoder is used to downsample layer by layer to extract image features. The decoder is used to upsample layer by layer to restore image resolution and generate segmentation masks.

[0110] S3034: inputting Chengshan image samples and segmentation masks in the training set into the shape segmentation model in batches for training, and updating the model weights through the back propagation algorithm until the shape recognition model achieves satisfactory performance on the validation set;

[0111] In this embodiment, a cross entropy loss function is used to calculate the difference between the model output and the true mask, and an optimizer (such as Adam, SGD, etc.) is used to minimize the loss function.

[0112] S3035: Evaluate the performance of the shape recognition model using validation and test sets, and make necessary adjustments.

[0113] In this embodiment, the intersection-over-union ratio between the model output mask and the true mask is calculated to evaluate the segmentation accuracy. The precision and recall rate of the model output mask are calculated to evaluate the model performance.

[0114] The present invention first uses CNN to identify and mark the target shape in the ancient space image to obtain a city-mountain space image with a target shape segmentation mask; then, based on the city-mountain space image with the target shape segmentation mask, the SegNet model is used to segment the target shape from the background of the ancient space image to obtain the city-mountain morphological elements. First, CNN can automatically extract local features in the image through its convolution layer, such as edges, textures, etc. These features are crucial for identifying key elements such as mountains, city walls, and city gates in ancient space images; at the same time, CNN has a certain robustness to image translation, rotation, and scale changes, and can cope with image deformation caused by factors such as shooting angles and lighting conditions in ancient space images. Secondly, the SegNet model adopts an encoder-decoder architecture, which can perform fine-grained classification of the input image at the pixel level, and realize the fine segmentation of the city-mountain morphological elements in the ancient space image; at the same time, SegNet uses a pooled index transfer mechanism to better reconstruct object edges and details during the upsampling process, thereby improving the accuracy of the segmentation boundary. Finally, by combining the CNN and SegNet models, we can achieve efficient and accurate recognition and segmentation of city and mountain morphological elements in ancient spatial images, thereby improving the accuracy and efficiency of subsequent analysis of the spatial relationship between cities and mountains.

[0115] In the specific implementation process, the Chengshan character-morphological element pairs are classified based on the text names of the Chengshan character elements and the morphological structures of the Chengshan morphological elements in the Chengshan character-morphological element pairs to obtain the city element dataset and the mountain element dataset.

[0116] In this embodiment, as shown in Table 1, the mountain feature dataset is mainly classified according to the name of the mountain and the morphological structure of the mountain (quasi-triangle structure or triangle structure combination). The mountain features are richly labeled with text and detailed in morphological description, with dual dependence on text and morphology.

[0117] Table 1 City-mountain spatial image recognition table

[0118]

[0119]

[0120] For the subset of city wall elements, they are mainly classified according to the morphological structure of the city wall (linear, strip enclosure). City wall elements are basically unlabeled and more morphologically dependent.

[0121] For the subset of urban building elements, they are mainly classified according to the specific names of urban buildings (such as government offices, academies, temples, passes, and city gates) and the morphological structure of urban buildings (1. Ordinary abstract buildings (structures are trapezoidal and rectangular combinations), courtyards; 2. City gates: double-story buildings with round arches superimposed on linear and strip enclosures (structures are trapezoidal, rectangular, and arched combinations)). The text labels of urban building elements directly indicate the functions of the buildings, with high text dependence. The architectural descriptions are highly abstract, and the architectural forms are homogeneous, making it difficult to summarize the functional properties of the elements through morphological presentation.

[0122] The subset of landmark building elements is mainly classified according to the specific names of landmark buildings (buildings, pavilions, towers, and pavilions) and the morphological structures of landmark buildings (buildings and pavilions: multi-layer superposition of ordinary abstract buildings; towers: multi-layer superposition of ordinary abstract buildings and isosceles triangles with a structural vertex angle less than 30°; pavilions: a combination of structural triangles and rectangles). The morphological characteristics of landmark building elements are prominent and more morphologically dependent.

[0123] The present invention classifies the Chengshan character-morphological element pairs based on the character names of Chengshan character elements and the morphological structures of Chengshan morphological elements, and can accurately classify the element pairs into a Cheng element data set and a Shan element data set.

[0124] In the specific implementation process, city elements include city walls, urban structures and landmark buildings;

[0125] The city feature dataset includes the city wall feature subset, the urban structure feature subset, and the landmark building feature subset.

[0126] In this embodiment, the elements in the mountain element dataset mainly include mountains. The elements in the city wall element subset mainly include city walls. The elements in the urban structure element subset mainly include government offices, academies, temples, passes, city gates, etc. The elements in the landmark building element subset mainly include towers, pavilions, towers, and pavilions.

[0127] In the specific implementation process, the macro-scale spatial relationship between the city and the mountain is analyzed based on the mountain feature dataset and the city wall feature subset in the target area;

[0128] In this embodiment, macro-scale city-mountain pattern relationship information: the image types that can extract this relationship are mainly local chronicles and local scenic spots. Through the morphological recognition of mountain elements and city wall elements in each image, the elements are superimposed to form macro-spatial relationship information between the city and the mountain, such as: the mountain is inside the city, the mountain is outside the city, the city is on the mountain, etc.

[0129] Based on the mountain feature dataset and the urban establishment feature subset of the target area, the mesoscale spatial relationship between the city and the mountain is analyzed;

[0130] In this embodiment, the spatial relationship information between meso-scale urban construction elements and mountains: the image types that can extract this relationship are mainly local chronicles maps, construction maps, and local scenic spots maps. By superimposing the text recognition of government offices, schools, and temples in each image with the morphological recognition of mountain elements, important buildings such as government offices, schools, and temples, as well as the mountains in the front, back, left, and right directions are marked to form a meso-spatial relationship between important buildings and mountains.

[0131] Based on the mountain feature dataset and landmark building feature subset of the target area, the micro-scale spatial relationship between the city and the mountains is analyzed.

[0132] In this embodiment, the spatial relationship information between micro-scale landscape architecture and mountains: the image types that can extract this relationship are mainly local chronicles, eight sceneries and local scenic spots. Through the morphological recognition of landmark building elements and mountain elements, element superposition is performed to identify the overlapping combination pattern of buildings, pavilions, towers and mountains, and obtain the construction position information of the landscape elements in the mountains.

[0133] In the present invention, the city element dataset is subdivided to obtain a city wall element subset, an urban construction element subset and a landmark building element subset, and spatial relationship analyses of different scales are performed based on these subsets and the mountain element dataset, thereby improving the flexibility of the spatial relationship analysis between cities and mountains.

[0134] First, the macro-scale spatial relationship between the city and the mountain is analyzed based on the mountain feature dataset and the city wall feature subset. First, as an important defense facility of ancient cities, the relationship between the location and shape of the city wall and the mountain directly reflects the strategic considerations of the ancient city site selection. Through the analysis of the city wall feature subset and the mountain feature dataset, the spatial distance, relative height, and line of sight blocking between the city wall and the mountain can be accurately calculated, thereby improving the accuracy of the analysis of the spatial relationship between the city and the mountain. Secondly, the macro-scale analysis helps to reveal the historical pattern of long-term interaction between the city and the mountain, such as whether the city prospers or declines because of the mountain, and the city's utilization and protection strategies for mountain resources in different historical periods. Finally, the spatial relationship analysis based on the macro-scale can provide a historical basis for the formulation of modern urban planning and protection strategies, such as determining the appropriate direction of urban expansion and protecting key areas of mountain ecology.

[0135] Second, the meso-scale spatial relationship between the city and the mountain is analyzed based on the mountain feature dataset and the subset of urban institutional features. First, the relationship between the layout of urban institutional features (such as government offices, academies, temples, passes, city gates, etc.) and the mountain reflects the logic and characteristics of the internal spatial organization of the ancient city. By analyzing the spatial relationship between these elements and the mountain, we can deepen our understanding of the urban spatial layout, functional zoning, and transportation network. Secondly, the meso-scale analysis helps to explore the integrated development path of urban culture and ecology, such as how cities can develop tourism and cultural industries based on mountain resources, and how to integrate the concept of ecological protection into urban construction. Finally, the spatial relationship analysis based on the meso-scale can provide guidance for modern urban renewal and transformation practices, such as determining the priority of urban renewal projects and formulating ecological protection and restoration plans.

[0136] Third, the micro-scale spatial relationship between the city and the mountain is analyzed based on the mountain feature dataset and the landmark building feature subset. First, as an important carrier of urban history and culture, the spatial relationship between landmark buildings and mountains directly reflects the historical features and cultural characteristics of the city. By analyzing the micro-scale spatial relationship between these buildings and mountains, the readability of urban history and culture can be enhanced, providing a new perspective for urban tourism and cultural communication. Secondly, micro-scale analysis helps to discover innovative points in urban landscape design, such as using mountain resources to create a unique urban landscape and incorporating mountain elements into architectural design. These innovative points can provide inspiration and reference for modern urban landscape design. Finally, by optimizing the micro-scale spatial relationship between the city and the mountain, urban construction can be better realized, such as building viewing platforms, trails and other facilities.

[0137] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit the technical solution. Those skilled in the art should understand that those modifications or equivalent substitutions of the technical solution of the present invention that do not depart from the purpose and scope of the technical solution should be included in the scope of the claims of the present invention.

Claims

1. A city-mountain spatial relationship analysis method based on ancient spatial images, characterized in that: include: S1: Acquire ancient space images of the target area; S2: Perform text recognition and extraction on the ancient space image of the target area to obtain Chengshan text elements; S3: Perform morphological recognition and extraction on the ancient spatial images of the target area to obtain the city and mountain morphological elements; S4: Associating the Chengshan morphological elements of the target area with the corresponding Chengshan text elements to form Chengshan text-morphological element pairs; S5: Classify the city and mountain character-morphological element pairs into a city element dataset and a mountain element dataset; S6: Analyze the spatial relationship between cities and mountains based on the city feature dataset and mountain feature dataset of the target area.

2. The city-mountain spatial relationship analysis method based on ancient spatial images as claimed in claim 1, characterized in that: In step S2, after the Chengshan text element of the ancient space image is extracted, the position information of the Chengshan text element in the corresponding ancient space image is located; and the Chengshan text element is bound to its position information in the corresponding ancient space image.

3. The city-mountain spatial relationship analysis method based on ancient spatial images as claimed in claim 2, characterized in that: In step S3, after extracting the city-mountain morphological elements of the ancient space image, the position information of the city-mountain morphological elements in the corresponding ancient space image is located; In step S4, the Chengshan morphological element is associated with the Chengshan character element corresponding to its position information in the corresponding ancient space image to form a Chengshan character-morphological element pair.

4. The city-mountain spatial relationship analysis method based on ancient spatial images as claimed in claim 1, characterized in that: In step S2, the Chengshan character elements of the ancient space image are extracted through the following steps: S201: Preprocessing of ancient space images; S202: Binarizing the pre-processed ancient space image to obtain a city and mountain binary image; S203: performing morphological processing on the city and mountain binary image; S204: Identify and mark connected domains in the morphologically processed Chengshan binary image; segment the identified connected domains into independent characters; S205: Recognize the corresponding text based on the segmented characters through the OCR recognition model to obtain the Chengshan text element.

5. The city-mountain spatial relationship analysis method based on ancient spatial images as claimed in claim 1, characterized in that: In step S3, the city and mountain morphological elements of the ancient space image are extracted through the following steps: S301: preprocessing ancient space images; S302: inputting the preprocessed ancient space image into the trained shape recognition model, recognizing and marking the target shape in the ancient space image, and outputting the city and mountain space image with the target shape segmentation mask; wherein the shape recognition model is constructed based on a convolutional neural network model; S303: Input the city-mountain space image with the target shape segmentation mask into the trained shape segmentation model, segment the target shape from the background of the ancient space image, and output the target shape image as the city-mountain morphological element; wherein the shape segmentation model is constructed based on the SegNet model.

6. The city-mountain spatial relationship analysis method based on ancient spatial images as claimed in claim 5, characterized in that: In step S302, the shape recognition model is trained by the following steps: S3021: Obtain a Chengshan image sample containing a target shape, annotate the target shape in the Chengshan image sample, and generate an annotated image containing a segmentation mask of the target shape; S3022: Divide all the annotated images into a training set, a validation set, and a test set; S3023: Constructing shape recognition model based on convolutional neural network; S3024: input the training set into the shape recognition model, calculate the model loss through forward propagation, and update the model parameters through back propagation until the shape recognition model achieves satisfactory performance on the validation set; S3025: Evaluate the performance of the shape recognition model using validation and test sets, and make necessary adjustments.

7. The city-mountain spatial relationship analysis method based on ancient spatial images as claimed in claim 5, characterized in that: In step S303, the shape segmentation model is trained by the following steps: S3031: Obtain city-mountain image samples containing the target shape, and generate a corresponding segmentation mask for each city-mountain image sample; S3032: Divide all city-mountain image samples and corresponding segmentation masks into a training set, a validation set, and a test set; S3033: Build a shape segmentation model based on SegNet; S3034: inputting Chengshan image samples and segmentation masks in the training set into the shape segmentation model in batches for training, and updating the model weights through the back propagation algorithm until the shape recognition model achieves satisfactory performance on the validation set; S3035: Evaluate the performance of the shape recognition model using validation and test sets, and make necessary adjustments.

8. The city-mountain spatial relationship analysis method based on ancient spatial images as claimed in claim 1, characterized in that: In step S5, the Chengshan character-morphological element pairs are classified based on the character names of the Chengshan character elements and the morphological structures of the Chengshan morphological elements in the Chengshan character-morphological element pairs to obtain a Cheng element dataset and a Shan element dataset.

9. The city-mountain spatial relationship analysis method based on ancient spatial images as claimed in claim 1, characterized in that: In step S6, the city elements include city walls, city structures and landmark buildings; The city feature dataset includes the city wall feature subset, the urban structure feature subset, and the landmark building feature subset.

10. The city-mountain spatial relationship analysis method based on ancient spatial images as claimed in claim 9, characterized in that: In step S6: Based on the mountain feature dataset and the city wall feature subset in the target area, the macro-scale spatial relationship between the city and the mountains is analyzed; Based on the mountain feature dataset and the urban establishment feature subset of the target area, the mesoscale spatial relationship between the city and the mountain is analyzed; Based on the mountain feature dataset and landmark building feature subset of the target area, the micro-scale spatial relationship between the city and the mountains is analyzed.

Citation Information

Patent Citations

  • Rural landscape function area division method and system based on scale self-adaption

    CN114611638A

  • Urban architectural style element extraction method and system based on streetscape pictures

    CN116682006A

  • Method for identifying and extracting morphological feature elements of historical and cultural blocks

    CN116740506A

  • Urban building group form automatic generation method based on artificial intelligence

    CN118115871A

  • Method and system for quickly constructing three-dimensional space model of multi-level building

    CN118172503A