A pattern classification method based on a spape-variant CNN template