product recognition algorithm