For the devices having inbuilt feature to unlock using face detection:
Go to settings and then security from the home screen of your smartphone. Next tap on screen lock. Here you will find many options to lock your screen.
None – for no locking at all
Slide– for the typical slide to unlock
Face Unlock – to set the Face Unlock feature
Pattern – to set a Pattern unlock
PIN – to set a standard four-digit PIN unlock
Password – to set a more secure password to unlock
See Also: How to Secure your Android Devices with Pattern, PIN, or Password
Tap on face unlock from above. Now you phone will turn on your front camera to save a face to unlock. You need to place your phone parallel to your eyes so that it can capture a better unlocking image.
Once you are done with capturing images you have to enter a pattern or a password. You can unlock your phone using face detection but still you need to enter password or a pattern because if someday for front camera stop working or if you want someone to unlock your phone then face lock can be by-passed with your permission. After entering and confirming your pattern/pin face unlock will be set on your phone. Next time when you will slide your phone’s screen to unlock it will automatically turn on front camera and you can unlock the device by holding it parallel to your eyes same as while you were capturing image for face lock.
See Also: 8 Ways to Secure Your Android Device