SMS: A Statistical Model for General Contextual Object Recognition