Spontaneous living spaces are public activity venues within cities that emerge through residents’ autonomous creation and informal planning. Although these spaces may appear disorganized, they serve vital functions: fostering social interaction, enhancing community vitality, improving spatial adaptability, and increasing life satisfaction. However, research on the formation mechanisms, structural logic, resident satisfaction, and the impact of spontaneous living spaces on community vitality is limited, and there is a lack of robust research methodologies. This study aims to explore the formation mechanisms of spontaneous living spaces within historic cultural districts and their influence on community vitality. Using Wuhan’s Tanhualin National Historic and Cultural District as a case study, this research innovatively combines the Mask R-CNN deep learning model with a Random Forest regression model. The Mask R-CNN model was employed to accurately identify and perform pixel-level segmentation of 1249 spontaneous living spaces. Combined with questionnaire surveys and the Random Forest model, this study reveals non-linear relationships between key factors such as community vitality, resident satisfaction with various types of spontaneous living spaces, and crowd density. The findings show that spontaneous living spaces effectively address residents’ unmet needs for emotional connection and dynamic lifestyles—needs often overlooked by official residential planning. This research provides a reliable technical framework and quantitative decision support for regulating the formation of spontaneous living spaces, thereby enhancing residents’ quality of life and urban vitality while preserving historical character.
Guan et al. (Wed,) studied this question.