SafeContain is a computer vision project focused on recognizing container identification codes from images, following the ISO 6346 standard. It was developed as part of a broader effort to support more automated, accurate, and verifiable tracking of shipping containers in ports, warehouses, and logistics hubs.
The system is designed to work with real-world container images—whether from handheld devices, surveillance cameras, or aerial views—and extract the full code (e.g. MSCU1234567), breaking it into its component parts and validating it according to international standards.
- Takes in an image of a shipping container
- Locates and reads the container code using OCR
- Parses the code into segments (owner, serial number, check digit)
- Validates the result using ISO 6346 rules
- Returns a clean, structured output ready for further use
This can help reduce human error during manual checks and streamline digital record-keeping in supply chain operations.
git clone https://github.com/m-fol/safecontain.git
cd safecontainWe recommend using a virtual environment.
pip install -r requirements.txtpython infer.py --image_path examples/sample1.jpgYou’ll see output like:
Detected code: MSCU1234567
Owner: MSC
Serial Number: 123456
Check Digit: 7
Valid: True