Abstract: In order to ensure the tightness of the heat-sealing of pharmaceutical packaging, a method of tightness detection based on image processing and deep learning is proposed. The bit-plane slicing method is used for preprocessing, which highlights the less obvious temperature level information of the infrared image. The plane with obvious level information is selected as the data set for training the neural network, and finally the accuracy is calculated by classification and recognition of samples. The experimental results show that this method can effectively classify the actual series, and the accuracy of identifying whether the hot air vent is well-sealed can reach more than 98%, which provides a guarantee for the rejection of defective products on the subsequent heat-sealing production line.