Inspiration

Lithium-ion and other batteries power almost everything around us, from smartphones and laptops to electric vehicles and everyday electronics. However, damaged or deteriorating batteries can pose serious safety risks, especially during storage, repair, transportation, and recycling.

Visible warning signs such as leakage, corrosion, casing damage, and swelling may be overlooked or misinterpreted. As battery-powered devices become increasingly common, there is a growing need for accessible tools that can help identify potential abnormalities before they escalate.

This inspired BatteryGuard Vision, an AI-assisted visual inspection application that helps people examine batteries, identify potentially suspicious visual conditions, and determine when further inspection may be necessary.

The goal isn't to replace professional battery inspections. It's to make preliminary visual screening more accessible, consistent, and evidence-aware.

What it does

BatteryGuard Vision analyzes an uploaded battery photograph using a combination of traditional computer vision and multimodal AI.

The application:

  1. Checks resolution, sharpness, and lighting to identify photographs that may be unsuitable for inspection.

  2. Uses OpenCV 5 to identify candidate regions based on color, texture, and surface irregularities to highlight visual anomalies.

  3. Uses Amazon Bedrock's Nova Lite vision model to assess potential leakage-like residue, corrosion, casing damage, and deformation.

  4. Considers whether unusual visual features might be normal components, such as protective tape, labels, or battery seams.

  5. Explains potential findings, indicates uncertainty, and suggests additional evidence or human inspection when appropriate.

  6. Executes the OpenCV 5 image-analysis pipeline through AWS Lambda.

Rather than assigning an arbitrary battery safety score, BatteryGuard Vision separates visual observations from confirmed defects, encouraging informed decisions and professional review.

How I built it

BatteryGuard Vision combines a lightweight web interface, an OpenCV-based processing engine, and cloud-hosted AI services.

Technology stack:

  • Python - Core application and analysis logic.

  • OpenCV 5 - Image-quality evaluation, color segmentation, texture analysis, morphological processing, and visual region highlighting.

  • Streamlit - Interactive web interface for image uploads and inspection results.

  • AWS Lambda - Serverless execution of the OpenCV 5 analysis engine.

  • Amazon ECR and Docker - Container packaging and deployment of the image-processing service.

  • Amazon Bedrock (Nova Lite) - Context-aware visual interpretation and structured inspection findings.

  • AWS CLI and boto3 - Cloud deployment and service integration.

The inspection workflow begins when a user uploads a photograph. The image is processed by the containerized OpenCV 5 engine running on AWS Lambda, which evaluates image quality and identifies potential visual irregularities.

Amazon Bedrock then provides contextual analysis to help distinguish ordinary battery components from possible abnormalities. The application combines these outputs into an inspection report containing visual evidence, possible findings, uncertainty, and recommended follow-up actions.

Challenges

1. Detecting meaningful defects rather than unusual colors

My initial OpenCV implementation relied on color segmentation. During testing, it highlighted normal yellow protective insulation as a possible anomaly while missing obvious white residue around a leaking battery.

I realized that unusual colors alone do not necessarily indicate damage.

2.Generalizing across different battery types

I tested cylindrical AA/AAA batteries, rechargeable cells, lithium-polymer pouch batteries, and 9V batteries.

Each presented different visual characteristics. Features such as printed labels, metallic reflections, insulation, and normal casing wrinkles frequently triggered false positives. This highlighted the limitations of purely rule based visual inspection.

3. Recognizing swelling and deformation

Unlike residue or surface discoloration, swelling involves three-dimensional geometry that may not be reliably established from a single photograph.

My early detection pipeline struggled to recognize deformation. Adding contextual vision analysis improved some interpretations, but this remains an area requiring further validation.

4. Deploying OpenCV 5 in a serverless environment

I encountered several infrastructure challenges, including local Docker virtualization configuration, AWS regional restrictions, IAM permissions, ECR repository access, and container-image deployment.

I successfully built and deployed an OpenCV 5 container to AWS Lambda and verified that actual image processing executed in the cloud.

5. Combining visual detection with AI reasoning

Early multimodal model results occasionally mischaracterized visible abnormalities and produced inconsistent classification labels.

I improved the inspection instructions and introduced structured output validation so findings use defined categories, specify observable evidence, and express uncertainty rather than making unsupported diagnoses.

Accomplishments

I successfully developed a working prototype that combines OpenCV 5, AWS Lambda, and Amazon Bedrock in a unified visual inspection workflow.

The application demonstrated promising results in highlighting some leakage-like residue and corrosion regions, while the contextual vision model distinguished certain normal battery features from potentially suspicious conditions.

I also implemented image-quality assessment, structured findings, uncertainty reporting, and follow-up inspection guidance.

Importantly, I documented false positives, missed detections, and limitations instead of presenting the prototype as a validated battery safety system.

What I learned

One of my biggest lessons was that detecting an anomaly is not the same as understanding a defect. Traditional computer vision is valuable for identifying image characteristics and candidate regions, but contextual interpretation is important when dealing with complex real-world objects. I also learned:

  1. Hybrid AI approaches can be more useful than either approach alone. OpenCV provides explainable image-processing operations, while multimodal AI adds contextual interpretation.

  2. False positives matter. Highlighting ordinary battery labels or insulation as damage can undermine trust in an inspection system.

  3. Image quality is part of the inspection process. Low-resolution, blurry, or poorly lit images can reduce confidence in visual findings.

  4. Uncertainty should be communicated explicitly. A responsible inspection assistant should acknowledge insufficient evidence rather than force a confident conclusion.

  5. Cloud-native computer vision is achievable. I demonstrated OpenCV 5 processing through an AWS Lambda container, integrated with a local Streamlit application.

  6. Real-world evaluation is essential. Testing across different battery shapes, conditions, and backgrounds revealed important limitations that were not apparent during initial development.

What's next for BatteryGuard Vision

BatteryGuard Vision is an early-stage proof of concept with opportunities for further development:

  1. Train and validate specialized computer-vision models using diverse, labeled battery images.

  2. Better align AI-identified defects with precise regions in the image.

  3. Use additional views and geometry-aware analysis to improve deformation assessment.

  4. Automatically determine when additional evidence or human approval is required.

  5. Support screening multiple batteries for recycling and maintenance operations.

  6. Maintain audit trails and track visible changes across repeated inspections.

  7. Explore running computer-vision processing on local or embedded devices.

Long-term vision is to evolve BatteryGuard Vision into a practical, explainable inspection assistant that supports safer battery handling and recycling.

BatteryGuard Vision is not a battery safety certification or diagnostic tool. It is designed to support preliminary visual screening and human decision-making.

Built With

Share this project:

Updates

Submission history