Risk-Driven Design of Perception Systems