A Semantics-Based Approach To Machine Perception