You could just search for an open source implementation for face detecion (I just checked and there seem to be multiple implementations) and use one of these as a starter code.
If you want to implement it by yourself, you would need a dataset, create an appropriate model architecture, and train the model as described in our tutorials.