With the development of science and technology and the advent of the era of big data, the problem of social information security receives much concern. For example, the public security department identifies suspects from the streets, banks need identity authentication of customers, and the customhouse identifies the identity of exit-entry people. The means of identity authentication emerges in endlessly, such as password, fingerprint, ID card, RFID card and other ways of recognition, wherein face recognition is a popular research area at present. In recent years, many excellent talents have conducted research in the field of face recognition, and have made great achievement. In view of the weaknesses and shortcomings of the methods put forward by predecessors, the traditional bacteria foraging method is improved in the invention, and the improved algorithm is applied to face recognition, namely, classification is performed on an original face database by the improved bacteria foraging method first, and then, a target face is recognized by a comparison method. Experiments show that a method of the invention has very high recognition rate. The method of the invention mainly comprises a face input module, a face image preprocessing module, a face feature extraction module, a bacterial foraging algorithm training module, a target face image input module, and a target face image recognition module.