The issue related to the risk of identity impersonation, where one person can be replaced by another in online exam surveillance systems, poses challenges. This study focuses on the effectiveness of detecting attempts of identity impersonation through face substitution during online exams, with the aim of ensuring the integrity of assessments. The goal is to develop facial recognition algorithms capable of precisely detecting these impersonations, training them on a tailored database rather than biased generic data. An original database of student faces has been created. An algorithm leveraging advanced deep learning techniques such as depthwise separable convolution has been developed and evaluated on this database. We achieved very high levels of precision, reaching an accuracy rate of 98% in face detection and recognition.