Urban green space (GS) exposure is recognized as a nature-based strategy for addressing urban challenges. However, the stress relieving effects and mechanisms of GS exposure are yet to be fully explored. The development of machine learning and street view images offers a method for large-scale measurement and precise empirical analysis. This study focuses on the central area of Shanghai, examining the complex effects of GS exposure on psychological stress perception. By constructing a multidimensional psychological stress perception scale and integrating machine learning algorithms with extensive street view images data, we successfully developed a framework for measuring urban stress perception. Using the scores from the psychological stress perception scale provided by volunteers as labeled data, we predicted the psychological stress perception in Shanghai's central urban area through the Support Vector Machine (SVM) algorithm. Additionally, this study employed the interpretable machine learning model eXtreme Gradient Boosting (XGBoost) algorithm to reveal the nonlinear relationship between GS exposure and residents' psychological stress. Results indicate that the GS exposure in central Shanghai is generally low, with significant spatial heterogeneity. GS exposure has a positive impact on reducing residents' psychological stress. However, this effect has a threshold; when GS exposure exceeds 0.35, its impact on stress perception gradually diminishes. We recommend combining the threshold of stress perception with GS exposure to identify urban spaces, thereby guiding precise strategies for enhancing GS. This research not only demonstrates the complex mitigating effect of GS exposure on psychological stress perception but also emphasizes the importance of considering the "dose-effect" of it in urban planning and construction. Based on open-source data, the framework and methods developed in this study have the potential to be applied in different urban environments, thus providing more comprehensive support for future urban planning.