The widespread spread and spread of the COVID-19 outbreak poses a great threat to the economic development and physical and mental health of countries around the world. For typical places with great risk of virus transmission, such as hospitals, wearing protective masks has been verified to be an effective way to cut off the virus transmission and can significantly reduce the virus transmission rate. Based on this, the paper proposes a mask-wearing recognition algorithm based on Convolutional Neural Network (ConvNet) and Region Proposal Network (RPN) for people entering and leaving hospital outpatient departments. Firstly, the initial training sample library for mask wear recognition is established based on the actual filming images of the outpatient department. Second, to ensure the accuracy of the recognition algorithm, the initial training samples are expanded to improve the robustness in mask wearing recognition. Third, the convolutional neural network is trained and tested in Matlab software using the established database. At the same time, the captured images were segmented with the help of RPN to determine the candidate regions to realize the improvement of the convolutional neural network and enhance the recognition accuracy. The results show that accurate recognition of mask wear can be achieved using the established sample database. The application of the trained model to hospital outpatient departments can significantly reduce the risk of virus transmission and has excellent application prospects.