Aiming at the problem that there are 2D interference objects with the training weight recognition target style in the camera recognition range, and only relying on the YOLOv5 recognition algorithm to distinguish the 3D target and the 2D interference objects (such as printed color maps), we designed a model based on YOLOv5, which relies on the detection algorithm of the depth camera. The YOLOv5 detection results (including the label of each recognition result, the position of the target in the picture) and the depth data of the depth camera are passed into the algorithm as parameters to detect whether there are 2D interferences, and finally return the processing results. The experimental results show that the improved algorithm can effectively remove 2D interference objects, and can deal with 2D interference objects placed in different positions. Compared with the recognition algorithm of only YOLOv5, the detection speed is only reduced by about 44.76ms/frame, which can meet the requirements of real-time performance.