Beta-lactams comprise one of the earliest classes of antibiotic therapies. These molecules covalently inhibit enzymes from the family of penicillin-binding proteins (PBPs), which are essential in construction of the bacterial cell wall. As a result, beta-lactams cause striking changes to cellular morphology, the nature of which varies by the range of PBPs simultaneously engaged in the cell. The traditional method of exploring beta-lactam polyspecificity is a gel-based binding assay which is low-throughput and typically is run ex situ in cell extracts. Here, we describe a medium-throughput, image-based assay combined with machine learning methods to automatically profile the activity of beta-lactams in E. coli cells. By testing for morphological change across a panel of strains with perturbations to individual PBP enzymes, our approach automatically and quantifiably relates different beta-lactam antibiotics according to their preferences for individual PBPs in cells. We show the potential of our approach for guiding the design of novel inhibitors toward different PBP-binding profiles by predicting the mechanisms of two recently reported PBP inhibitors.