- Athira M D and Lijo Jacob
- January 20, 2021
Automatic Container Code Recognition using Deep Learning
Business photo created by 4045 – freepik.com
Deep Learning has provided a major boost to computer vision’s already rapidly expanding reach. A lot of new applications of computer vision technologies have been implemented with Deep Learning and are now becoming a part of our daily lives.
The shipping industry in particular has started to see the enormous benefits of this technology. As shipping and trading companies process tens of thousands of containers every day, Automatic Container ID and ISO Detection in real time is the need of the hour.
The container identification system used is an ISO format composed of a series of letters and numbers. As the terminal gates and other checkpoints handle a large number of containers, there is always a possibility that the container identification sequence has not been properly followed. Human inspection and manual recording of the container ID and ISO are likely to cause errors. They hamper the speed of operation, particularly during the customs clearance verification process, in which customs officers and terminal operators have to deal with individual containers as they enter and leave terminals.
Being cognizant of the above operational challenges with the current manual container reading system, Ignitarium’s engineers conceptualized and developed an alternative deep-learning-based computer vision solution to automatically detect and recognize the ID and ISO of the containers. Before jumping into the key modules of this project, it will be good to look at an overview of the Container Identification System used in the industry today.
An overview of the Container Identification system:

Fig. 1. Image Credits: The Geography of Transport Systems by Jean-Paul Rodrigue
The container ID is an eleven-digit number that comprises owner code, product group code, license number, and a check digit. An additional 4 digits in the end display ISO type & size codes denoting container category and size. Each of these markings play a very important role in the transport of the container and provides valuable information to all organizations in the supply chain concerning the control and safety of the container.
Data Preparation:
Data collection is the process of gathering and measuring information on variables of interest. In order to train a model, we need sufficient and relevant amounts of data. And labeling is also an important part of any training. The training results will yield maximum accuracy only if the data labels are correct. For our purpose, the dataset was generated by collecting several container videos and dumping the images from these videos. The labeling of containers, text regions as well as characters were done using labeling apps. A few examples of labeling apps can be found here: LabelImg and LabelMe
The key modules of the project were:
- Container Detection
- Text Detection
- Character Detection
- Character Classification
1. Container Detection:
Object detection is a computer vision technique that helps to detect the objects within an image or video. Due to its close relationship with video analysis and image understanding, it has attracted much research attention in recent years. Numerous deep learning-based object detection frameworks are available for object detection tasks. You can get an overview of object detection algorithms using deep learning here – An overview of deep learning based object detection algorithms.

Fig. 2. Container detection
For container detection, a customized variant of the RetinaNet network is utilized. RetinaNet is a composite network which consists of a backbone network and two sub-networks. The backbone network is responsible for generating the convolutional feature maps of the image. One sub-network is responsible for generating classification results based on the output from backbone networks. And the other subnetwork is responsible for performing the regression task using the outputs from the backbone network. The pretrained weights used are from ResNet50. Here is a related post that will give a detailed explanation regarding the RetinaNet architecture.

Fig. 3. RetinaNet Architecture
For training and evaluating a RetinaNet model, two .csv files are required. The XML files generated while labeling containers are parsed and an annotation.csv file is generated. The annotation.csv file will contain the input image location, its bounding box values, and corresponding label. <path/to/image>, <xmin>, <ymin>, <xmax>, <ymax>, <label>. The classes.csv file will contain all class labels in the dataset which are unique, along with their corresponding index values. The input to the model will be these CSV files and once training is completed, a trained weight file will be saved. For making predictions, we convert this trained model into an inference model. While testing, it will return bounding box values of containers along with their corresponding scores and labels. The boxes can be filtered out by setting up a threshold value. For visualizing the outputs OpenCV components can be utilized.
The base RetinaNet repo is available in the following link keras-retinanet.
2. Text Detection:
Once the containers are detected, the text regions corresponding to ID and ISO need to be detected. Because of the size, location, lighting, and texture changes of objects in the image, text detection from images have become one of the most difficult tasks in computer vision. Out of several object detection algorithms, the semantic segmentation algorithm performs well for text detection.
Semantic Segmentation:
Semantic segmentation is the task of understanding the semantic content in images. Semantic Segmentation has many applications, such as detecting road signs, detecting drivable areas in autonomous vehicles, etc. An overview of Keras semantic segmentation can be found at Semantic Segmentation and at A Beginner’s guide to Deep Learning based Semantic Segmentation using Keras.

Fig. 4. Text Detection using semantic segmentation
The semantic segmentation network follows an encoder-decoder architecture. Several pretrained models are also available. So the initial step is selecting the proper base network and segmentation network for semantic segmentation tasks. Along with choosing the required architecture for semantic segmentation, choosing the input dimension also has significance. If the input size is large it consumes more memory and training will be slower.
The mask images were generated from the annotated jsons. The feature vectors generated from the encoder will be given to the decoder model and the generated result vectors will be mapped to the original image shape using numpy functionalities. Several image processing techniques were also applied for mapping the results to the original image. The base repo is available here image-segmentation-keras.
3. Character Detection:
For character detection, a custom RetinaNet network was utilized. The input to the system is the annotation.csv file and classes.csv file. The annotation.csv file contains the bounding box annotations for each character and their corresponding image path. While testing, the input is the detected text crops and outputs can be visualized using OpenCV functions.

Fig. 5. Character Detection
4. Character Classification:
For character classification, a custom CNN model was utilized. A convolutional neural network has several layers. An overview of convolutional neural networks can be found here (Convolutional Neural Networks) and here (Understanding of Convolutional Neural Networks) . For compiling the model, several optimizers like Adam and RMSprop can be used. Different metrics can be used for model evaluation during training like validation loss, train loss, Val accuracy and more. The loss value for the optimizer can be selected depending upon the problem statement.
The input to the CNN model are the character crops from the custom RetinaNet. It can be either digit crops or alphabet crops, which can be trained individually or separately.

Fig. 6. Container ID and ISO detection and classification
Accuracy:
The success of any system can be defined as the ability to detect and classify each module correctly. Analyzing the outcomes, the custom RetinaNet network gives better results with a minimum loss of 1.4. For text detection, the semantic segmentation detects the ID and ISO with an error of 1%. Character detection is done using the same RetinaNet model and the error was 0.5. The custom CNN model is lightweight compared to other classification networks like AlexNet and gives an accuracy of 99% for character classification.
Conclusion:
Our system is designed to automatically detect and recognize the container ID and ISO which will help reduce the disadvantages of manually recording them while they enter the container terminal gates. The system will facilitate effective container management and operations at terminal gates, yard, and in the loading and unloading zones for cranes, etc. As a future scope for performance improvement, we can consider the replacement of multiple RetinaNet models with a single CRNN module to improve performance.
100 thoughts on “Automatic Container Code Recognition using Deep Learning”
Hi, there, thank you for sharing such a great piece of content with us. It is really an informative and amazing post, it also helps me a lot.
Class Interface or Enum Expected Error
Thankyou for this post, I am a big fan of this internet site would like to proceed updated.
Thank you, your article surprised me, there is such an excellent point of view. Thank you for sharing, I learned a lot. https://accounts.binance.com/bg/register-person?ref=PORL8W0Z
Your article helped me a lot, is there any more related content? Thanks! https://www.binance.info/tr/join?ref=DB40ITMB
azithromycine prix sans ordonnance: PharmaDirecte – medicament remboursГ© sans ordonnance
meladinine sans ordonnance: pharmacie garde sans ordonnance – acheter du viagra
https://tryggmed.com/# п»їapotek
lГ¤kemedel barn gratis: Snabb Apoteket – hur mycket Г¤r 500 ml i liter
medicine online: SnabbApoteket – sГҐrpulver apotek
https://snabbapoteket.shop/# pincett apotek
tuggben hund bäst i test [url=http://snabbapoteket.com/#]apotek blodtryck[/url] best leverans kontakt
pharma online: belgie apotheek online – online doktersrecept
online apotheek: MedicijnPunt – online pharmacy nl
https://tryggmed.shop/# apotek lørdag
hur mycket Г¤r 500 ml i liter [url=https://snabbapoteket.com/#]SnabbApoteket[/url] apotek hГ¶gkostnadsskydd
http://tryggmed.com/# brokkbind apotek
betrouwbare online apotheek: Medicijn Punt – medicijnen bestellen online
receptbelagd medicin mot riklig mens: SnabbApoteket – bh barn 10 ГҐr
http://zorgpakket.com/# recept medicijnen
apotheke nl [url=http://zorgpakket.com/#]medicijnen kopen zonder recept[/url] holandia apteka internetowa
online apotheek – gratis verzending: medicijen – mijn apotheek medicijnen
http://zorgpakket.com/# afbeelding medicijnen
tissetrakt apotek: TryggMed – krem apotek
apteka nl online [url=https://zorgpakket.shop/#]medicatie online[/url] appotheek
https://snabbapoteket.shop/# mät blodtryck apotek
tumstГ¶d apotek: SnabbApoteket – sluta sova pГҐ dagen 2 ГҐr
http://tryggmed.com/# aloe vera krem apotek
apotek varer: fatle skulder apotek – hente resept pГҐ annet apotek
aptoheek [url=http://zorgpakket.com/#]Medicijn Punt[/url] online medicijnen bestellen met recept
julsenap apotek: billiga frГ¶n – kinesiotape apotek
https://tryggmed.shop/# apotek rikshospitalet åpningstider
jernmangel test apotek: TryggMed – apotekvarer pГҐ dГёra
medicatie apotheker [url=https://zorgpakket.com/#]Medicijn Punt[/url] apotheek apotheek
http://tryggmed.com/# apoteka
http://snabbapoteket.com/# hur många apotek finns det i sverige
huisapotheek online: MedicijnPunt – apotheken
safe place to buy semaglutide online mexico: buy kamagra oral jelly mexico – generic drugs mexican pharmacy
https://medimexicorx.com/# mexican drugstore online
buy antibiotics from mexico [url=https://medimexicorx.com/#]modafinil mexico online[/url] MediMexicoRx
order azithromycin mexico: MediMexicoRx – legit mexican pharmacy for hair loss pills
order azithromycin mexico: MediMexicoRx – real mexican pharmacy USA shipping
https://medimexicorx.shop/# mexican rx online
http://indiamedshub.com/# IndiaMedsHub
IndiaMedsHub [url=http://indiamedshub.com/#]reputable indian online pharmacy[/url] reputable indian pharmacies
legit mexican pharmacy for hair loss pills: buy neurontin in mexico – buy meds from mexican pharmacy
https://expresscarerx.org/# enalapril online pharmacy
french pharmacy products online [url=https://expresscarerx.org/#]generic propecia online pharmacy[/url] ambien indian pharmacy
pharmacy selling cytotec: india online pharmacy viagra – Duricef
https://expresscarerx.online/# watch tour de pharmacy online
https://medimexicorx.com/# buying from online mexican pharmacy
singulair pharmacy assistance: ExpressCareRx – ExpressCareRx
order from mexican pharmacy online [url=https://medimexicorx.com/#]MediMexicoRx[/url] order kamagra from mexican pharmacy
IndiaMedsHub: IndiaMedsHub – india online pharmacy
https://indiamedshub.com/# Online medicine home delivery
IndiaMedsHub: IndiaMedsHub – IndiaMedsHub
women’s international pharmacy [url=https://expresscarerx.online/#]ExpressCareRx[/url] ExpressCareRx
cheap cialis mexico: zithromax mexican pharmacy – legit mexican pharmacy for hair loss pills
http://expresscarerx.org/# buy nolvadex online pharmacy
ExpressCareRx: roadrunner pharmacy – where to buy viagra pharmacy
https://medimexicorx.shop/# MediMexicoRx
ExpressCareRx: discount rx – pharmacy viagra price
ExpressCareRx [url=http://expresscarerx.org/#]online pharmacy pain medication[/url] best online pharmacy no prescription cialis
https://indiamedshub.shop/# IndiaMedsHub
п»їmexican pharmacy: rybelsus from mexican pharmacy – MediMexicoRx
trimix online pharmacy: medical pharmacy west – can i buy viagra in a pharmacy
online shopping pharmacy india [url=https://indiamedshub.com/#]IndiaMedsHub[/url] buy prescription drugs from india
http://expresscarerx.org/# ExpressCareRx
http://indiamedshub.com/# top 10 pharmacies in india
reputable indian online pharmacy: IndiaMedsHub – IndiaMedsHub
top 10 online pharmacy in india: mail order pharmacy india – Online medicine order
ExpressCareRx [url=https://expresscarerx.org/#]ExpressCareRx[/url] online pharmacy no perscription
http://expresscarerx.org/# percocet pharmacy
https://indiamedshub.com/# buy medicines online in india
IndiaMedsHub [url=https://indiamedshub.com/#]IndiaMedsHub[/url] best india pharmacy
IndiaMedsHub: IndiaMedsHub – п»їlegitimate online pharmacies india
best prices on finasteride in mexico: order from mexican pharmacy online – cheap mexican pharmacy
https://zoloft.company/# Zoloft Company
https://lexapro.pro/# lexapro brand name
Lexapro for depression online [url=https://lexapro.pro/#]Lexapro for depression online[/url] buy lexapro
purchase generic Accutane online discreetly: generic isotretinoin – USA-safe Accutane sourcing
generic Cialis from India: generic Cialis from India – buy Cialis online cheap
http://isotretinoinfromcanada.com/# isotretinoin online
purchase generic Accutane online discreetly: Accutane for sale – isotretinoin online
isotretinoin online [url=http://isotretinoinfromcanada.com/#]purchase generic Accutane online discreetly[/url] buy Accutane online
lexapro online no prescription: best price for lexapro – Lexapro for depression online
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
http://finasteridefromcanada.com/# cheap Propecia Canada
Zoloft for sale: Zoloft for sale – purchase generic Zoloft online discreetly
tadalafil online no rx [url=http://tadalafilfromindia.com/#]cheap Cialis Canada[/url] tadalafil 20 mg over the counter
generic Finasteride without prescription: Propecia for hair loss online – cheap Propecia Canada
https://lexapro.pro/# Lexapro for depression online
https://finasteridefromcanada.com/# Finasteride From Canada
Accutane for sale: order isotretinoin from Canada to US – cheap Accutane
Lexapro for depression online [url=https://lexapro.pro/#]lexapro cost uk[/url] Lexapro for depression online
http://tadalafilfromindia.com/# Cialis without prescription
cost of tadalafil in canada: cheap Cialis Canada – tadalafil online no rx
get propecia price: get generic propecia without rx – generic Finasteride without prescription
order isotretinoin from Canada to US [url=https://isotretinoinfromcanada.shop/#]cheap Accutane[/url] order isotretinoin from Canada to US
http://isotretinoinfromcanada.com/# isotretinoin online
https://tadalafilfromindia.com/# cheap Cialis Canada