# A Two-Stage Automatic Container Code Recognition Method Considering Environmental Interference  
[PERSON]  
1 School of Transportation and Logistics Engineering, Wuhan University of Technology, Wuhan 430063, China; 1 [EMAIL_ADDRESS] (M.Y. ); [EMAIL_ADDRESS] (S.Z.) 1  
[PERSON]  
1 School of Transportation and Logistics Engineering, Wuhan University of Technology, Wuhan 430063, China; 1 [EMAIL_ADDRESS] (M.Y. ); [EMAIL_ADDRESS] (S.Z.) 1  
[PERSON]  
2 China Ocean Shipipping Agency Tianjin Co., Ltd., Tianjin 300456, China; [EMAIL_ADDRESS] 2  
[PERSON]  
3 Qingdao New Qianwan Container Terminal Co., Ltd., Qingdao 266000, China; [EMAIL_ADDRESS] 3  
[PERSON]  
1 School of Transportation and Logistics Engineering, Wuhan University of Technology, Wuhan 430063, China; 1 [EMAIL_ADDRESS] (M.Y. ); [EMAIL_ADDRESS] (S.Z.) 1  
Footnote 1: [[https://www.mdpi.com/journal/applsci](https://www.mdpi.com/journal/applsci)]([https://www.mdpi.com/journal/applsci](https://www.mdpi.com/journal/applsci))  
Footnote 2: [[https://www.mdpi.com/journals/pdf/14/201](https://www.mdpi.com/journals/pdf/14/201)]([https://www.mdpi.com/journals/pdf/14/201](https://www.mdpi.com/journals/pdf/14/201))  
gate entrances, leading to traffic congestion and environmental pollution [4]. Consequently, container terminal gate entrances have become a bottleneck that hinders the development of CMT [5]. The application of Internet of Things (IoT) technology in smart ports is rapidly advancing. Smart ports leverage IoT technology to achieve real-time monitoring and management of cargo, equipment, and infrastructure, enhancing operational efficiency and reducing costs. Existing IoT solutions primarily rely on barcode scanners and RFID devices for data collection. Although these methods are mature, they have certain limitations, such as the need for additional hardware and high maintenance costs. This manuscript proposes a video-based data collection solution that utilizes existing surveillance cameras, eliminating the need for extra hardware and enabling more efficient data collection. Moreover, the algorithm presented in this paper takes into account different angles and lighting conditions, making it adaptable to various image capture devices. As a result, it offers a more flexible and cost-effective option for IoT systems in smart ports. Due to the slow speed and high cost associated with manual container code recognition and recording [6], Automatic Container Code Recognition (ACCR) systems are primarily used at port gate entrances. Among them, barcode-based ACCR systems have been phased out due to their poor reliability. Radio Frequency Identification (RFID)-based ACCR systems offer high detection accuracy but come with high deployment and maintenance costs [7]. On the other hand, Optical Character Recognition (OCR)-based ACCR systems have low installation costs [8] and are the mainstream approach in modern container terminals due to their simple system integration. However, their recognition accuracy is generally below 95%. This is mainly attributed to the high requirements of methods such as container code localization (CCL) [9], character segmentation, and container code recognition (CCR) [10] in terms of recognition conditions. In situations with uneven lighting, image blurring, or skewed container codes, errors in container code localization or character recognition are prone to occur. Deep learning algorithms can automatically extract features directly from raw images, showing strong resistance to interference, and have achieved significant results in various areas such as traffic signal detection [11], license plate recognition [12], and medical image segmentation [13]. Based on deep learning algorithms, the development of ACCR can be divided into two types: (1) using a single neural network to complete the entire container code recognition process [14] and (2) stacking two neural networks to separately accomplish CCL and CCR [15].