Investigating the relationship between built environment factors and roadway safety is crucial for preventing road traffic accidents. Although studies have analyzed traffic-related built environment factors based on pre-determined zonal units, conclusive evidence regarding the relationship between streetscape features and traffic accidents at a fine-grained road segment level is still lacking. With the widespread availability of large-scale street view images, automatically analyzing urban built environments on a large scale is possible. Therefore, the aim of this study was to investigate the relationship between streetscape features and traffic accidents at a fine-grained road segment level using street view images. Specifically, we employed semantic image segmentation to extract streetscape elements from urban street view images, and then created traffic crash-related variables, including the street-level built environment variables, traffic variables, land-use indices, and proximity characteristics, at the road-segment level. Finally, we adopted a classification-then-regression strategy to model the number of traffic crashes while considering the zero-inflated and spatial heterogeneity issues. Our findings suggest that streetscape features can effectively reflect built-environment characteristics at the road-segment level. Moreover, a comparison of our proposed modeling method with existing models demonstrates its superior performance. The results provide insight into the development of effective planning strategies to improve traffic safety.