  Liquids and granular media are pervasive throughout human environments. Their
free-flowing nature causes people to constrain them into containers. We do so
with thousands of different types of containers made out of different materials
with varying sizes, shapes, and colors. In this work, we present a
state-of-the-art sensing technique for robots to perceive what liquid is inside
of an unknown container. We do so by integrating Visible to Near Infrared
(VNIR) reflectance spectroscopy into a robot's end effector. We introduce a
hierarchical model for inferring the material classes of both containers and
internal contents given spectral measurements from two integrated
spectrometers. To train these inference models, we capture and open source a
dataset of spectral measurements from over 180 different combinations of
containers and liquids. Our technique demonstrates over 85% accuracy in
identifying 13 different liquids and granular media contained within 13
different containers. The sensitivity of our spectral readings allow our model
to also identify the material composition of the containers themselves with 96%
accuracy. Overall, VNIR spectroscopy presents a promising method to give
household robots a general-purpose ability to infer the liquids inside of
containers, without needing to open or manipulate the containers.
