Currently, the security of the Internet of Things (IoT) has aroused great concern. Face detection under arbitrary occlusion has become a key problem affecting social security. This paper designs a novel face occlusion recognition framework in the security scene of IOT, which is used to detect some crime behaviors. Our designed framework utilizes the gradient and shape cues in a deep learning model, and it has been demonstrated to be robust for its superiority to detect faces with severe occlusion. Our contributions contain three main aspects: Firstly, we present a new algorithm based on energy function for face detection; Secondly, we use the CNN models to create deep features of occluded face; Finally, to check whether the detected face is occluded, novel sparse classification model with deep learning scheme is constructed. Statistical results demonstrate that, compared with the state of the arts, our algorithm is superior in both accuracy and robustness. Our designed head detection algorithm can achieve 98.89% accuracy rate even though there are various types of severe occlusions in faces, and our designed occlusion verification scheme can achieve 97.25% accuracy rate, at a speed of 10 frames per second.