Skip to content

fqd511/truck-img-detect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Truck Image Analysis Tool

This tool uses Google's Gemini AI to analyze truck images for various verification checks including license plate validation and cargo bed inspection.

Features

  • License plate number verification
  • Truck bed content inspection
  • Automated image processing pipeline
  • Configurable logging
  • Environment-based configuration

Prerequisites

  • Python 3.8 or higher
  • Google Cloud API key with Gemini AI access
  • Images of trucks stored in an img directory

Installation

  1. Clone the repository:

  2. Install required dependencies:

pip install -r requirements.txt
  1. Create a .env file in the project root and add your Google API key:
API_KEY=your_google_api_key_here

Image Naming Convention

Images should be named following this format:

<plate_number>_<index>.<extension>

Where:

  • plate_number: The license plate number to verify
  • index: A number (1-5) indicating the type of check to perform
  • extension: Image file extension (jpg, jpeg, or png)

Example: ABC123_1.jpg

Check Types

The index in the filename determines the type of check:

  1. License plate verification
  2. Truck entry check
  3. License plate verification
  4. Truck bed content check
  5. License plate verification

Usage

  1. Place your truck images in the img directory
  2. Run the script:
python detect.py

The script will process each image and output the results to the console.

Response Format

The AI will respond with either:

  • PASS: All criteria met
  • ERROR: With a detailed report explaining the issue

Directory Structure

├── detect.py           # Main script
├── requirements.txt    # Python dependencies
├── .env               # Environment variables
├── img/               # Directory for images
└── README.md          # This file

Logging

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

Error Handling

The script includes robust error handling for:

  • Invalid file names
  • Missing API keys
  • Failed API requests
  • Invalid image formats
  • Network issues

License

todo

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages