Comprehensive car condition assessment using specialized PyTorch models for damage detection, cleanliness analysis, window condition evaluation, and tire classification.
Our solution employs 7 specialized PyTorch models for comprehensive vehicle assessment:
-
π Binary Damage Detection (
damage_binary.pt)- Architecture: EfficientNet-B0 with ImageNet transfer learning
- Task: Binary classification (damaged/intact)
- Training: Cross-entropy loss with AdamW optimizer
- Data Augmentation: Random flips, color jitter, normalization
-
π― Damage Parts Localization (
damage_parts.pt)- Architecture: Multi-class EfficientNet-B0
- Task: Specific car part damage identification
- Classes: Bumpers, doors, fenders, body panels
-
π§½ Vehicle Cleanliness Assessment (
dirty_binary.pt)- Architecture: EfficientNet-B0 with surface texture analysis
- Task: Binary classification (clean/dirty)
- Optimization: Specialized for various lighting conditions
-
πͺ Window Damage Detection (
damaged_windows.pt)- Architecture: CNN optimized for glass surface analysis
- Task: Window integrity assessment
- Features: Crack, chip, and breakage detection
-
π Unified Window Analysis (
unified_windows.pt)- Architecture: Enhanced window condition classifier
- Task: Comprehensive window state evaluation
- Dataset: Combined window damage datasets
-
β‘ Scratch & Dent Classification (
scratch_dent.pt)- Architecture: Multi-class CNN for surface damage types
- Task: Damage type categorization (scratch, dent, rust)
- Training: Specialized loss functions for imbalanced classes
-
π Tire Condition Analysis (
tire_classification.pt)- Architecture: ResNet/EfficientNet hybrid
- Task: Tire condition assessment (full/flat/worn)
- Augmentation: Advanced geometric transformations
Azure OpenAI GPT-4 provides:
- Technical Report Generation: Human-readable analysis summaries
- Stakeholder-Specific Insights: Driver, passenger, and business perspectives
- Condition Scoring: Automated 0-100 rating system
- Maintenance Recommendations: Actionable improvement suggestions
All models utilize ImageNet pre-trained weights for optimal performance:
# EfficientNet-B0 with transfer learning
weights = models.EfficientNet_B0_Weights.IMAGENET1K_V1
model = models.efficientnet_b0(weights=weights)
# Fine-tune classifier head
model.classifier[-1] = nn.Linear(in_features, num_classes)- Optimizer: AdamW with weight decay (1e-4)
- Learning Rate: 3e-4 with Cosine Annealing scheduler
- Batch Size: 32 (optimized for GPU memory)
- Image Size: 224x224 (ImageNet standard)
- Loss Function: CrossEntropyLoss for classification tasks
train_transforms = transforms.Compose([
transforms.Resize((224, 224)),
transforms.RandomHorizontalFlip(p=0.5),
transforms.RandomRotation(degrees=20),
transforms.ColorJitter(brightness=0.2, contrast=0.2),
transforms.RandomPerspective(distortion_scale=0.2),
transforms.GaussianBlur(kernel_size=3),
transforms.Normalize(mean=IMAGENET_MEAN, std=IMAGENET_STD)
])FastAPI + PyTorch + Azure OpenAI
βββ π§ Core API (app.py)
β βββ Model inference endpoints
β βββ Comprehensive analysis pipeline
β βββ LLM report generation
βββ π§ Inference Modules (/inference/)
β βββ Individual model predictors
β βββ Preprocessing pipelines
βββ π³ Docker containerizationReact + TypeScript + TailwindCSS
βββ π¨ Modern UI with Radix components
βββ π± Responsive design
βββ π Multi-tab result display
βββ π Real-time condition scoringPOST /analyze-comprehensive
Content-Type: multipart/form-data
Response:
{
"condition_score": 85,
"technical_analysis": {
"is_damaged": false,
"damage_parts_local": null,
"dirty": {"prediction": "clean", "confidence": 0.89}
},
"reports": {
"driver": "...",
"passenger": "...",
"business": "..."
},
"recommendations": [...]
}POST /damage_local- Binary damage detectionPOST /damage_parts_local- Damaged parts identificationPOST /damaged_windows_local- Window condition analysisPOST /unified_windows_local- Enhanced window assessmentPOST /dirty_local- Vehicle cleanliness evaluationPOST /scratch_dent_local- Surface damage classificationPOST /tire_classification_local- Tire condition analysisGET /health- System health check
- Docker & Docker Compose
- Python 3.8+ with PyTorch
- Azure OpenAI API access (optional for LLM features)
# 1. Clone repository
git clone https://github.com/elitekbtu/indrive-hack.git
cd indrive-hack
# 2. Configure environment
cd backend
cp example.env .env
# Add your Azure OpenAI credentials to .env
# 3. Launch with Docker
docker-compose up --build
# 4. Access application
# Frontend: http://localhost
# Backend API: http://localhost:8000
# API Documentation: http://localhost:8000/docs# Backend setup
cd backend
pip install -r requirements.txt
python app.py
# Frontend setup
cd frontend
npm install
npm run devAZURE_OPENAI_API_KEY=your_api_key_here
AZURE_OPENAI_ENDPOINT=https://your-instance.openai.azure.com/
AZURE_OPENAI_GPT4O_DEPLOYMENT_NAME=gpt-4o| Model | Dataset Source | Classes | Training Images |
|---|---|---|---|
| Damage Detection | Custom binary dataset | 2 (damaged/intact) | ~7,000 |
| Damage Parts | Multi-class car parts | 8 part categories | ~13,000 |
| Window Analysis | Combined window datasets | 3 window states | ~3,500 |
| Cleanliness | Custom clean/dirty | 2 (clean/dirty) | ~1,800 |
| Scratch & Dent | Roboflow Dataset | 3 damage types | ~3,500 |
| Tire Classification | Roboflow Dataset | 2 tire states | ~1,200 |
- Training Time: 2-10 epochs per model (early stopping)
- Hardware: GPU-accelerated training (CUDA/MPS support)
- Validation Split: 80/20 train/validation
- Model Size: ~20-50MB per model (EfficientNet-B0 base)
- Inference Speed: ~100-500ms per image
- Memory Usage: ~2GB GPU memory for all models
- Batch Processing: Supported for multiple images
- Device Support: CPU/CUDA/MPS (Apple Silicon)
backend/
βββ app.py # FastAPI main application
βββ models/ # Trained PyTorch models (.pt files)
βββ inference/ # Model inference modules
βββ trains/ # Training scripts for each model
βββ services/ # LLM service integration
βββ datasets/ # Training datasets
βββ requirements.txt # Python dependencies
Each model has dedicated training pipeline:
train_damage.py- Binary damage detectiontrain_damage_parts.py- Parts localizationtrain_damaged_windows.py- Window analysistrain_unified_windows.py- Enhanced window detectiontrain_dirty.py- Cleanliness assessmenttrain_scratch_dent.py- Surface damage classificationtrain_tire_classification.py- Tire condition analysis
# Example: Damage detection inference
from inference.inference_damage import load_checkpoint, predict_image_bytes
model, transforms, class_to_idx, damage_idx = load_checkpoint("models/damage_binary.pt")
result = predict_image_bytes(model, transforms, image_bytes, damage_idx)- EfficientNet-B0: Optimal balance of accuracy and inference speed
- Transfer Learning: Leverages ImageNet pre-trained features
- Fine-tuning Strategy: Only classifier head modified for domain adaptation
- Multi-GPU Support: Distributed training capabilities
- Model Versioning: Checkpoint-based model management
- Error Handling: Graceful degradation when models unavailable
- Resource Management: Memory-efficient inference pipeline
- Scalability: Containerized deployment with Docker
- Image Preprocessing: Efficient tensor operations
- Batch Inference: Multiple image processing
- Memory Management: CUDA/MPS device optimization
- Response Caching: Reduced redundant computations
- Scratch & Dent: Car Scratch and Dent Dataset (CC BY 4.0)
- Tire Classification: Full vs Flat Tire Dataset (CC BY 4.0)
- Window Damage: Multiple combined window datasets
- Damage Detection: Binary classification dataset (damaged/intact)
- Cleanliness: Clean vs dirty vehicle classification
- Parts Localization: Multi-class car part damage identification
# Train individual models
cd backend
python trains/train_damage.py --epochs 10
python trains/train_tire_classification.py --epochs 5
# Run inference server
python app.py
# Frontend development
cd frontend
npm run dev# Build and run all services
docker-compose up --build
# Individual service builds
docker build -t car-analysis-backend ./backend
docker build -t car-analysis-frontend ./frontend- Training Checkpoints: Automatic best model saving
- Model Registry: Version-controlled model storage
- A/B Testing: Compare model performance
- Hot Swapping: Update models without service restart
- Backend: FastAPI, PyTorch, Azure OpenAI
- Frontend: React, TypeScript, TailwindCSS
- Infrastructure: Docker, Docker Compose
- ML Framework: PyTorch with torchvision
- Deployment: Containerized microservices
Team BUTAQ - Multi-disciplinary AI/ML specialists
- Computer Vision model development
- Full-stack web application architecture
- Cloud deployment and DevOps
- Business analysis and market research
Comprehensive car condition analysis through specialized computer vision models and intelligent reporting