This was originally the entrance to the 'Rasphuis', or 'grating house', a penal institution, dating back to the early seventeenth century. Such institutions were considered very modern, as they embraced the principle that criminals could be re-educated by means of hard work and sequestration.
The red and black shield with the white crosses is Amsterdam's coat of arms held by the "virgin of Amsterdam"
'Castigatio' means punishment; the two prisoners to the left and right represent sloth and vice.
Underneath the three figures is a vignette with the text 'Virtutis est domare / quae cuncti pavent' which means 'It's for the virtuous to tame / what everyone fears.'