This was my experience a couple years ago as well. I absolutely love San Francisco and it's my favorite US city outside of my own. I'm used to the general dirt and grime of cities (my child knows to be suspicious of wet ground, especially when it's in corners and it hasn't rained recently) along with the many colorful people that inhabit them. In my recent trip to San Francisco, things were well beyond what I'd expected. One end of the BART car had a pile of human feces, as did the station, and someone had clearly urinated while on the up escalator to make a nice trail. On Market street, there was trash and tents, and at least one person squatting to go to the bathroom. I popped into a store to grab some sundries, and the interior looked more like the store was at the tail end of a going out of business sale.
Outside of downtown it felt a little better, but it was such a shocking difference from my previous trips to the city.