1 Introduction

As the twenty-first century progresses and cities continue to develop and expand, the Chinese urban architecture style is losing its cultural identity. The reason for this is that the modern architectural design trend has caused the local architectural culture to lose its individuality. Resultantly, the translation of local architectural culture into contemporary architectural design is crucial for the preservation and growth of local architectural culture in modern times.

Traditional Chinese architectural culture places great importance on classical gardens. Taihu stone is a crucial spatial element in classical gardens, a sculptural language in Chinese gardening art, and an aesthetic expression of Eastern philosophical ideas. Traditional Chinese gardens are renowned for the subtlety of “though made by man, just like opening from heaven” making their space ambiguous and undefined. The interior space of Taihu stone is emblematic of this type of space, and its unrepeatable and irreproducible nature renders it extremely valuable. This paper focuses on the transformation of Taihu stone into a design element of architectural space, as it possesses the dual properties of building material and space. However, the translation of Taihu stone into contemporary architectural design is difficult due to the stone’s intricate spatial relationships.

In contemporary architectural design, the transformation of the space occupied by Taihu stone is crucial. On a cultural level, the spatial translation of Taihu stone can contribute to the establishment of contemporary Chinese architectural systems. At the level of contemporary architectural design, the transformation of Taihu stone can contribute more inventive ideas. At the same time, the performance of architecture transformed by the space of Taihu stone can be enhanced. The reason for this is that the building’s internal spaces are connected, which will improve the building’s lighting and ventilation. This method can reduce the energy consumption of a building.

With the rapid advancement of artificial intelligence technology, machine learning has become a popular area of artificial intelligence research. In the field of machine learning, artificial neural networks (ANN) and generative adversarial networks (GAN) are two important subfields. GAN is an unsupervised learning method in which learning is carried out by two neural networks competing against one another. In machine learning and cognitive science, an ANN is a mathematical or computational model that simulates the structure and function of biological neural networks and is used to estimate or approximate functions. Using these two machine learning models, we attempt to extract the logical relations of the complex space of Taihu stone in order to generate a space with the characteristics of the internal space of Taihu stone. And the purpose of the experimental outcomes is to investigate the performance of various machine learning models for three-dimensional space learning.

2 Background

In previous research, traditional gardening techniques and the value of Taihu stones have been emphasized. Ji (1957) described in “The Craft of Gardens” the causes for the formation of Taihu stones and materials, as well as their function in the garden. Li (2011) advocated the appreciation of Taihu stones in terms of “translucency,” “thinness,” and “leakiness” in “The idle feeling is sent occasionally.” Environmental data-driven performance-based topological optimization for morphology evolution of artificial Taihu stone was presented by Feng et al. (2021) in their paper “Environmental Data-Driven Performance-Based Topological Optimisation for Morphology Evolution of Artificial Taihu Stone” These studies have contributed to the evolution of gardening, particularly with regard to the selection of stone strategies for gardening and the production of various spatial effects. However, these works address the quantification of the internal space of Taihu stones and the transformation of spatial design only infrequently.

Machine learning can be used to extract complex spatial logical relations, such as the spatial distribution patterns of Taihu stones. The application of artificial neural networks to design problems has included transforming unstructured triangular meshes into meshes with consistent topology Umetani (2017), classifying design objects Rucco et al. (2019), and quantitatively describing and classifying design processes Huang et al. (2020).

Hao Zheng et al. (2021) used artificial neural networks to extract building features for 3D form generation and generated control point information with ANN models to generate 3D buildings with specific features. Using artificial neural networks, improved the performance of 3D free-form building forms.

Numerous recent studies that have applied GAN models to layout generation have demonstrated that GAN can rapidly comprehend and generate spatially complex layouts. Huang and Zheng (2018) suggested using GAN to recognize and generate apartment floor plans. Newton (2019) used GAN to generate and analyze the floor plans of Le Corbusier’s buildings. Chuang and Chien (2021) used a Naive Bayesian Classifier machine and GAN to assist architects in the pre-design phase of projects in rapidly generating renderings, which will greatly improve the communication between architects and clients.

Wu et al. (2016) achieved excellent performance in the field of 3D machine learning by adopting 3D-GAN to generate high-quality 3D forms and recognize 3D shapes. In the field of medicine, Cirillo et al. (2021) proposed a 3D volume-to-volume generative adversarial network to assist physicians with brain tumor diagnosis. Ren and Zheng (2020) proposed, in the field of architectural design, slicing 3D models into floor plans, then performing style transfer with a given style image, and finally stacking them back into 3D models. Campo et al. (2019) proposed expressing 3D models as 2D depth maps, training them with CNN and style transfer, and then representing the resulting states as 3D models.

However, current research on machine learning focuses primarily on two-dimensional space, while studies on three-dimensional continuous space sequences are scarce. This paper focuses more on the extraction of the internal spatial variation pattern of the research object than previous 3D machine learning studies. In addition, compared to the 3D machine learning model used in previous studies, this thesis employs a 2D machine learning model to improve the experimental effect of 3D machine learning by enhancing the sample labelling method and the before-and-after sample correspondence. For the machine learning of the three-dimensional spatial variation patterns of Taihu stone, this paper tries to propose a new idea to solve it.

3 Methodology

The primary process of the experiment to extract the internal spatial variation pattern of Taihu stone through machine learning is as follows (Fig. 1):

  1. 1)

    Dataset establishment. First, we gathered images of Taihu stone with “transparent” and “leaky” properties from the internet. Run the Rhino and Grasshopper plug-ins to transform the 2D Taihu stone images into 3D Taihu stone models. The section extracted from the 3D model of the Taihu stone is used as the training data.

  2. 2)

    Sample pre-processing. First, the sections of Taihu stone are divided into odd and even groups based on their front-to-back arrangement.

  3. 3)

    Training and testing. Experiments include experiments with artificial neural networks and generative adversarial networks. The artificial neural network experiment includes 9160 training sample sets and 2280 testing sample sets. There are 520 sets of samples in the generative adversarial network experiment, of which 500 sets are used for training and 20 sets are used for testing.

  4. 4)

    Generation of architecture. The trained ANN model and GAN model can generate a series of continuous sections with spatial relationships of the Taihu stone from a single input section. All the sections are then sequentially arranged to create a three-dimensional space with the spatial characteristics of Taihu stone.

  5. 5)

    Experimental analysis and evaluation. The experimental evaluation includes three primary indicators: the continuity of adjacent sections, the trend of the number of void spaces, and the overall spatial effect in three dimensions.

Fig. 1
figure 1

Workflow of research

3.1 Dataset

Taihu stone has the image characteristics of being “thin, wrinkled, leaky and transparent” of which “leaky and transparent” are more applicable to the contemporary architectural space. To improve the spatial effect of the sections generated by the trained model, we chose as the original samples images of Taihu stones with obvious “leaky and transparent” characteristics.

3.1.1 Sample pre-processing

We have collected a total of 12 2D images of Taihu stone as the original samples for this project. The process to convert the 2D image into a 3D model consists of three main steps: the first step is to pinch the entire Taihu stone using Rhino’s subD function, based on the outline of the 2D image. Set the ant colony and food points at the location of the cave entrance of the Taihu stone and the visible cavity location, respectively, and run the ant colony algorithm to generate the internal cavity space. In the final step, a Boolean difference operation is performed between the overall space and the cavity space to obtain a 3D Taihu stone model with the internal space variation pattern of Taihu stone.

Converting the three-dimensional model to two-dimensional profile slices is the final step in sample preparation. The method of sectioning is related to the traditional approach to appreciating Taihu stones and their spatial characteristics. The leakage and transparency of Taihu stone accentuate the distinctive light and shadow effects created by the front and back shading of Taihu stone holes. In order to obtain better experimental results, the three-dimensional model of Taihu stone is transformed into 2D sectional slices from front to back for this experiment. Finally, the 3D models of Taihu stone are transformed into a series of successive 2D sections (Fig. 2). The adjacent sections are used as an initial training sample set.

Fig. 2
figure 2

Preparation of original samples of Taihu stone, left: 3D Taihu stone model, right: Grouped section slices of the Taihu stone model

3.2 Network architecture

3.2.1 Artificial neural network model architecture

In general, an artificial neural network (ANN) consists of three layers: the input layer, the hidden layer, and the output layer. The initial layer is the input layer, the final layer is the output layer, and the layers in between are all hidden layers (Fig. 3). Forward and backward propagation can allow neural networks to “self-learning” Forward propagation is the process of feeding samples into a neural network, passing them through the hidden layers, and then obtaining the output layer’s result. Gradient descent is utilized in back propagation to iteratively optimize the loss function to its minimum value. In this process, weights, bias values, and other parameters are continuously updated, the value of the loss function changes continuously, and the overall trend decreases until a certain value is reached, at which point the learning process concludes.

Fig. 3
figure 3

The network of architecture of ANN

3.2.2 Generative adversarial network model architectures

The conventional GAN consists of two components: the Generator and the Discriminator. The Generator is intended to generate samples, whereas the Discriminator is used to determine the authenticity of a sample generated by the Generator.

During the training process, the objective of Generator is to generate images that are as realistic as possible in order to fool Discriminator, whose objective is to distinguish between images generated by Generator and real images. As the two networks compete against one another, their capabilities increase. The images generated by Generator resemble real images more and more, and Discriminator becomes more capable of determining the images’ authenticity (Fig. 4). This experiment employs a GAN-based Pix2Pix model to implement image-to-image translation. As a result, once the Pix2Pix model has been trained, the generator can produce very realistic images.

Fig. 4
figure 4

The network of architecture of Pix2Pix

4 Training and analysis

4.1 Artificial neural network training

4.1.1 Data processing

The samples for the ANN experiment must be converted from images to vector coordinate points. This experiment first extracts “leaky” spatial contour lines using the rhino and grasshopper plug-ins, and then it extracts 20 control points from the contour lines (Fig. 5). The section’s boundary is then divided into 40 control points, making each sample comprised of a total of 60 control points: 20 control points of the contour lines and 40 control points of the boundary curve.

Fig. 5
figure 5

Extraction of “leaky” space control points, left: Original Image, middle: Image Boundary, right: Control points

These control points are divided into groups of 60 coordinate points, and each group of control points from one section corresponds to the next. It indicates that the input is a set of coordinate information from the previous section and the output is a set of coordinate information from the following section (Fig. 6). In specific instances within the dataset, the number of holes in two adjacent profiles does not match. In the event that the holes disappear in the subsequent profile, the input data remains the coordinates of the 20 control points of the holes in the previous profile, and the output is the same coordinate information (0,0). Thus, a cave profile corresponds to the point (0,0), indicating that the number of cave profiles in the sample has changed. Similarly, the increase in the number of holes corresponds to the point (0,0) on the one hole curve.

Fig. 6
figure 6

Dataset for ANN, left: Control points of the previous section, middle: Control points of the next section, right: Coordinate information of control points

Finally, the coordinates serve as training samples for the ANN model. This experiment includes a total of 9160 sets of training samples and 2280 sets of test samples.

4.1.2 Training process

The purpose of training the ANN model is to enable it to automatically predict 20 control point coordinates of the following section given 20 control point coordinates of the previous section. The subsequent sections are generated based on the predicted coordinate information for control points.

Before the formal experiment begins, the hyperparameters are optimized using an automatic optimization-seeking algorithm in order to achieve the best possible results. In this experiment, there are four hyperparameters that affect the effect of the model: learning _rate, batch_size, hidden_nc, and n_layers. 1000 iterations of hyperparameter search are carried out. From the hyperparameter search experiment, the combination of hyperparameters with the lowest loss function is chosen as the optimal hyperparameters (Fig. 7). Finally, the experiments are conducted with the optimal hyperparameters, and 500 training iterations are performed.

Fig. 7
figure 7

Hyperparameter optimization process: the effect of different hyperparameter combinations on the experimental loss function

4.1.3 Generation of sections

By entering the control point coordinates of one section, the trained ANN model is able to predict the control point information of the following section. The predicted control point information is then used as the next input to obtain the third section’s control point information. 20 sections with the spatial variation pattern of Taihu stone can be obtained in this manner (Fig. 8).

Fig. 8
figure 8

The process of ANN model generation of sections

Based on the section information predicted by the ANN model, a three-dimensional space is produced. In order to better examine experimental results, solid and void space are formed depending on section information (Fig. 9). According to the experimental findings, the created 3D space is consistent with the internal spatial variation pattern of the Taihu stone and the pattern is significantly simpler.

Fig. 9
figure 9

Three-dimensional space with the spatial variation pattern of Taihu stone generated by ANN model

4.2 Generative adversarial networks training

4.2.1 Augmentation

To better comprehend the spatial distribution pattern of Taihu stone using the Pix2Pix model, 104 original sample sets are rotated, mirrored, etc. In the end, 520 sets of samples are collected, including 500 sets for training and 20 sets for testing.

Labelling based on analysis

4.2.2 Labelling based on analysis

By analyzing the spatial elements of the Taihu stone, the section of the Taihu stone is divided into three components: “transparent” space, “leaky” space, and solid space. The “transparent” space is the hole space through which light and view can pass from front to back. The “leaky” space refers to the air and water that can pass through the hole in the Taihu stone, but not the view or light. Solid space generally refers to the space in the profile that is filled with stone.

In the sample processing of this study, these three spatial elements are marked with distinct colors (Fig. 10). The adjacent labeled sections are used as a set of training samples (Fig. 11).

Fig. 10
figure 10

Labeling based on spatial analysis, left: original slice, middle: labelled slice, right: labelling rule

Fig. 11
figure 11

Adjacent slices as a set of training samples

4.2.3 Training process

In this experiment, the sample consists of a total of 625 groups, 500 of which are used for training and 125 for testing. And machine learning experiments with different ratios of training and testing samples are conducted while maintaining the total amount of sample data, and the results of the experiments indicate that the number of training samples is crucial to the experimental outcomes. To avoid overfitting the experimental results, the training samples are increased to 125 groups while the training samples remain at 500 groups in order to preserve the experimental effect. In the experiments’ training phase, the Pix2Pix model generates sections of Taihu stone by learning the variation pattern of spatial elements between each sample group. 600 iterations are performed in total during the experiment. From the training results (Fig. 12), it is evident that the image boundary generated by the model is distinct and that the distribution pattern of the location of the hole is consistent with the variation pattern between adjacent slice samples. The “leaky” space is centered on the “permeability” space, and the section boundaries generated are consistent with the input samples.

Fig. 12
figure 12

The part process of the training

The majority of the generated section variation distributions follow the variation pattern of the hole distribution in adjacent sections, as shown by the generated results of the test experiments (Fig. 13). The magnitude of the section hole variation differentiates the results of test sample generation. The generation results of the test experiments demonstrate that the Pix2Pix model has mastered the pattern of change between adjacent sections within each group.

Fig. 13
figure 13

The results of the testing training

4.2.4 Generation of continuous 2D sections

To generate continuous architectural sections, the first section must be input, after which the trained Pix2Pix model can generate a second section with the spatial variation pattern of the Taihu stone. The second section is then utilized as input to produce the third section. This method completes the generation of all continuous architectural sections (Fig. 14).

Fig. 14
figure 14

The process of generating architectural sections

The Pix2Pix-generated continuous 2D sectional images cannot be directly applied to architectural design. Therefore, it is necessary to transform the 2D image into an architectural modeling object. The Rhino and Grasshopper plug-ins are used to extract the boundaries of the various elements of the section based on their respective color, and then the pixels are converted to curves (Fig. 15). The transformed sections are sequentially arranged at equal distances (Fig. 16).

Fig. 15
figure 15

Transformation of image to geometry

Fig. 16
figure 16

Generation of multiple architectural sections

4.2.5 Transformation of 2D sections into 3D model

The final 3D building volume is obtained by converting the building sectional curves to faces in Rhinoceros and then extruding the faces in the same direction. During the transformation process, the solid boundary curves are converted into solid spaces, while the “transparent” and “leaky” spaces are converted into the building’s void spaces. In accordance with the “leakage” and “transparency” changes that are characteristic of Taihu stone, the void spaces in the generated building (Fig. 17) are interconnected and change in a complex manner. Simultaneously, the solid space of the generated 3D architectural volume possesses the same qualities as fluid space and transparency in modern architectural design. The experimental results suggest that this method is capable of transforming the complex spaces of Taihu stone in contemporary architectural design.

Fig. 17
figure 17

Three-dimensional space with the spatial variation pattern of Taihu stone generated by the GAN model

This machine learning model can also be used to generate building ventilation spaces based on the natural formation principle of the internal space of Taihu Stone, with the potential to further improve the building ventilation performance. In addition, architects can determine the elevation intention (first section) and use this machine learning model to generate the overall architectural space, thereby gaining additional inspiration for their design.

4.3 Result analysis

The experimental results demonstrate that both the Pix2Pix and ANN models are capable of capturing the spatial change pattern of the 3D Taihu stone. The 3D void space demonstrates that the void space within the building transitions from a disconnected to a connected state. This spatial effect is highly consistent with Li Yu’s assertion in “A Leisurely Tale” regarding the Taihu Stone. By learning 2D continuous sections and combining them with the generated 3D building volumes, it is possible to demonstrate that the machine model can comprehend the change pattern of 3D complex space. Importantly, it is worthwhile to investigate the differences between the three-dimensional spaces generated by the GAN and ANN experiments.

4.3.1 Analysis of the continuity of adjacent sections

The sections generated by the machine learning model are analyzed by comparing the ratio of the overlapping area of the previous section to the area of the next section; this ratio serves as a key indicator for determining the continuity of adjacent sections (Fig. 18).

Fig. 18
figure 18

Similarity analysis of adjacent sections

Based on the overlapping area ratio of adjacent sections, the overlapping area ratio of the first group to the eighth group generated by the ANN experiment increases gradually, while the overlapping area ratio after the eighth group varies between 94 and 98%. (Fig. 19). This indicates that the first eight sections generated by the ANN model have good continuity, but the subsequent sections have a condition of overfitting.

Fig. 19
figure 19

Spatial continuity analysis of adjacent sections generated by ANN

Comparatively, the sections generated by the GAN experiment have greater continuity, no overfitting, and the proportion of overlapping area is maintained between 64.25% and 69.94% (Fig. 20). This demonstrates that the variation between sections during the generation of continuous sections maintains well continuity. Additionally, approximately 30% of the generated section can vary along a certain trend, which prevents the generated results from being overfitted.

Fig. 20
figure 20

Spatial continuity analysis of adjacent sections generated by GAN

4.3.2 Analysis of the number of void spaces of the sections

During the generation of the sections, the number of void spaces of the sections fluctuates, and this fluctuation is another significant indicator of the 3D space’s density (Fig. 21).

Fig. 21
figure 21

Void space and solid space of the section

According to the trend of the number of void space changes, only one change in the number of void spaces from front to back occurred during the ANN experiment sections. During the generation of sections by the GAN experiment, however, the number of void spaces varied in a number of ways. And the number of void spaces remained between 3 and 6, indicating an increase in void space density (Fig. 22).

Fig. 22
figure 22

Analysis of the trend in the number of void spaces of the sections, left: Sections generated by ANN model, right: Sections generated by GAN model

4.3.3 Comparison analysis of the overall 3D spatial effect

By comparing the void space and solid space of the 3D space, the overall effect of the generated 3D space can be observed more clearly. Comparing void space and solid space reveals that the 3D space generated by ANN has less variation in void space levels and weaker connectivity between void spaces. In contrast, the 3D space generated by the GAN experiment has a greater variety of void space levels, greater continuity between void spaces, and greater cohesiveness (Fig. 23).

Fig. 23
figure 23

Architectural solid space and void space, left: 3D space generated by ANN model, right: 3D space generated by GAN model

It is evident that the 3D space generated by the GAN model is more consistent with the spatial characteristics of Taihu stone when compared to the spatial variation pattern of Taihu stone.

In conclusion, the GAN model is the superior machine learning model for extracting the complex 3D spatial characteristics of the Taihu stone in this experiment. GAN achieves better generation results than ANN primarily because its data set contains more information. The main reason for the difference in model performance is that the coordinate vector dataset of ANN contains relatively less information. For machine learning of three-dimensional complex spaces such as the Taihu stone, image-to-image translation with generative adversarial network may be a better option.

5 Conclusion and discussion

This paper uses machine learning to extract the three-dimensional spatial characteristics of Taihu stone. This research improves the ability of machine learning to master 3D space characteristics by enhancing the sample labeling method and converting the 3D model into continuous 2D training samples. In addition, different machine learning models are utilized for 3D spatial learning experiments, and the experimental outcomes are used to investigate the differences between ANN and GAN for learning 3D space. Moreover, by analyzing the spatial effects of 2D sections and 3D models generated by machine learning models, it is possible to demonstrate that this experiment has successfully transformed the complex spaces of 3D Taihu stone in modern architectural design. This study offers a novel approach for machine learning to master three-dimensional spatial characteristics. Moreover, this study provides a new method for the transformation of traditional Chinese architectural space into modern architectural design.

Obviously, this study still contains some limitations. First, the generation of 2D sections by the GAN model is a tedious and complicated process. Only the subsequent section that corresponds to the inputted section can be generated. It is more time-consuming because the generation of sections requires constant iterations. Second, the connectivity between sections generated by the ANN model is insufficient and less holistic. The reason for this is because ANN imposes restrictions on the data structure of the samples. In the future, these issues can be resolved by enhancing the structure of both the neural network and the training samples.