Perception modules are integral in many modern autonomous systems, but their
accuracy can be subject to the vagaries of the environment. In this paper, we
propose a learning-based approach that can automatically characterize the error
of a perception module from data and use this for safe control. The proposed
approach constructs a {\em perception contract (PC)\/} which generates a set
that contains the ground-truth value that is being estimated by the perception
module, with high probability. We apply the proposed approach to study a vision
pipeline deployed on a quadcopter. With the proposed approach, we successfully
constructed a PC for the vision pipeline. We then designed a control algorithm
that utilizes the learned PC, with the goal of landing the quadcopter safely on
a landing pad. Experiments show that with the learned PC, the control algorithm
safely landed the quadcopter despite the error from the perception module,
while the baseline algorithm without using the learned PC failed to do so