Target recognition based on template