Use of prior knowledge in classification of similar and structured objects