This tool uses Google's Gemini AI to analyze truck images for various verification checks including license plate validation and cargo bed inspection.
- License plate number verification
- Truck bed content inspection
- Automated image processing pipeline
- Configurable logging
- Environment-based configuration
- Python 3.8 or higher
- Google Cloud API key with Gemini AI access
- Images of trucks stored in an
imgdirectory
-
Clone the repository:
-
Install required dependencies:
pip install -r requirements.txt- Create a
.envfile in the project root and add your Google API key:
API_KEY=your_google_api_key_here
Images should be named following this format:
<plate_number>_<index>.<extension>
Where:
plate_number: The license plate number to verifyindex: A number (1-5) indicating the type of check to performextension: Image file extension (jpg, jpeg, or png)
Example: ABC123_1.jpg
The index in the filename determines the type of check:
- License plate verification
- Truck entry check
- License plate verification
- Truck bed content check
- License plate verification
- Place your truck images in the
imgdirectory - Run the script:
python detect.pyThe script will process each image and output the results to the console.
The AI will respond with either:
PASS: All criteria metERROR: With a detailed report explaining the issue
├── detect.py # Main script
├── requirements.txt # Python dependencies
├── .env # Environment variables
├── img/ # Directory for images
└── README.md # This file
The script includes detailed logging with timestamps. Logs are output to the console and include:
- Info messages for normal operation
- Error messages for issues
- Processing status for each image
The script includes robust error handling for:
- Invalid file names
- Missing API keys
- Failed API requests
- Invalid image formats
- Network issues
todo