1. A method of detecting a weapon in image data, the method comprising: annotating sections of a plurality of training images to indicate whether each section is one of a plurality of different constituent parts of a weapon; encoding a pattern grammar describing the weapon using a plurality of first order logic based predicate rules; training a plurality of distinct component detectors, where each detector is trained to each identify a corresponding one of the weapon parts based on the annotated training images; processing image data with the component detectors to identify at least one of the weapon parts; and executing the rules to detect the weapon based on the identified weapon parts.