The Game Ends, The Work Begins
The credits rolled on Alan Wake 2. For a moment, I sat in that holy silence after a story ends.
Then reality returned. Homework due tomorrow.
Stories have a way of getting under your skin. They reframe every equation as a metaphor, turn every problem into a reminder of what youโre trying not to think about.
I opened the PDF. Partial differential equations stared back at me, incomprehensible as grief.
โu/โt = ฮฑโยฒu
The heat equation. How warmth dissipates through space and time. How things fade away.
Like her.
My computer vision code waitedโteaching machines to detect edges, to find boundaries between light and dark, between whatโs there and whatโs not.
Alan Wake wrote his way through darkness to return to Alice. I was just trying to survive until tomorrow, one equation at a time.
In the darkness, something whispered: โItโs not a lake. Itโs an ocean.โ
That was my story now.
[END]
ๆฐด็งฏ่ฏๅซๅ่ฝฆ่พๆทนๆฒก้จไฝๅคๅซ็ณป็ป
A comprehensive system for detecting vehicles in flood images and analyzing their submersion levels using custom-trained YOLO models.
This system uses custom-trained YOLO models to:
- Detect vehicle parts (body, window, wheel) in flood images
- Segment water areas using semantic segmentation
- Calculate submersion levels by analyzing part-water overlap
- Generate statistics and color-coded visualizations
Built for academic research on flood disaster assessment and vehicle damage analysis.
- Detects vehicle components separately: body, window, wheel
- Custom YOLO model trained on 100 epochs (exp23)
- Confidence threshold: 10% (adjustable 1-100%)
- Semantic segmentation for water area identification
- Custom YOLO segmentation model
- 60% opacity bright blue overlay for clear visualization
- Fully Submerged: โฅ70% of body/window underwater
- Partially Submerged: Wheels underwater or 20-70% body coverage
- Not Submerged: <20% water coverage
- Per-part submersion ratio calculation
- Built with Streamlit for easy interaction
- Multi-model selection (custom + official YOLO models)
- Real-time processing with progress indicators
- Three view modes: Detection Only, Segmentation Only, Combined
- Split-screen comparison (original vs processed)
- Download all results as ZIP archive
- Individual downloads per image (detection, segmentation, combined, stats JSON)
- Aggregate statistics across multiple images
- CSV export support
# Conda environment with Python 3.8+
conda activate yolov11
# Required packages
pip install -r requirements.txt# Method 1: Direct command
streamlit run app.py
# Method 2: Batch file (Windows)
run.batThe web interface will open at http://localhost:8501
Project3/
โโโ README.md # This file
โโโ GUIDE.md # Quick start guide
โโโ run.bat # Application launcher
โโโ requirements.txt # Python dependencies
โ
โโโ Core Application
โ โโโ app.py # Streamlit web interface
โ โโโ detection.py # Vehicle part detection module
โ โโโ segmentation.py # Water segmentation module
โ โโโ utils.py # Analysis and visualization
โ โโโ config.py # Configuration and model paths
โ
โโโ models/ # Trained YOLO models
โ โโโ vehical/
โ โ โโโ best_exp23.pt # Best vehicle detection (12.37% max conf)
โ โ โโโ last_exp23.pt # Last epoch checkpoint
โ โ โโโ best.pt # Improved model (0.44% max conf)
โ โ โโโ last.pt
โ โโโ flood/
โ โโโ best.pt # Best water segmentation
โ โโโ last.pt # Last epoch checkpoint
โ
โโโ demo_images/ # Sample flood images
โโโ results/ # Processing outputs
โโโ uploads/ # User uploaded images
โ
โโโ README/ # Documentation
โ โโโ README.md # Complete documentation
โ โโโ requirement.md # Project requirements
โ โโโ project_details.md # Implementation details
โ โโโ architecture.md # System architecture
โ โโโ CUSTOM_MODELS.md # Custom model info
โ โโโ CUSTOM_MODEL_CLASSES.md # Class definitions
โ โโโ SETUP_COMPLETE.md # Setup guide
โ
โโโ test/ # Test scripts (19 files)
โโโ test_flood_now.bat/.py
โโโ test_exp23.bat/.py
โโโ test_custom.bat/.py
โโโ ...
streamlit run app.py- Detection Model: Select vehicle detection model
- Recommended:
๐ฏ Vehicle Custom (Exp23 Best)
- Recommended:
- Segmentation Model: Select water segmentation model
- Recommended:
๐ Flood Custom (Best)
- Recommended:
- Confidence Threshold: Adjust sensitivity (default: 0.10)
- Click "Browse files" to upload images
- Select one or multiple images (JPG, PNG, BMP)
- Click "๐ Process Images"
- View results with radio buttons:
- Detection Only: Vehicle bounding boxes only
- Segmentation Only: Water segmentation only
- Combined: Both detection and segmentation
- Overall statistics across all images
- Per-image breakdown table
- Submersion level distribution chart
- Download all results as ZIP
- Or download individual results per image
Test scripts are located in the test/ directory:
# Test flood segmentation
cd test
test_flood_now.bat
# Test exp23 vehicle detection
test_exp23.bat
# Test all images in demo_images/
test_all.bat
# Quick single-image test
quick_test.batEdit config.py to customize:
# Model paths
DETECTION_MODELS = {
"๐ฏ Vehicle Custom (Exp23 Best)": "models/vehical/best_exp23.pt",
# Add more models...
}
SEGMENTATION_MODELS = {
"๐ Flood Custom (Best)": "models/flood/best.pt",
# Add more models...
}
# Custom class definitions
CUSTOM_VEHICLE_PARTS = {0: 'body', 1: 'window', 2: 'wheel'}
CUSTOM_WATER_CLASSES = {0: 'water'}- Architecture: YOLOv8/v11 object detection
- Classes: body (0), window (1), wheel (2)
- Training: 100 epochs on project1 dataset
- Performance: 12.37% max confidence on test set
- Input: Ground-level vehicle images
- Architecture: YOLOv8/v11 semantic segmentation
- Classes: water (0)
- Training: Custom flood dataset
- Output: Binary mask for water regions
# Whole vehicle submersion
if submersion_ratio >= 0.7:
level = "fully_submerged"
elif submersion_ratio >= 0.2:
level = "partially_submerged"
else:
level = "not_submerged"
# Part-based submersion (custom model)
if part == 'wheel' and submersion_ratio >= 0.5:
level = "partially_submerged"
elif part in ['body', 'window'] and submersion_ratio >= 0.7:
level = "fully_submerged"- Red: Fully Submerged (โฅ70%)
- Orange: Partially Submerged (20-70%)
- Green: Not Submerged (<20%)
- Blue: Water Area (60% opacity overlay)
The custom vehicle detection model was trained on ground-level clear vehicle photos, NOT aerial flood images. For optimal results:
โ Best: Use images from training dataset
- Location:
ๆบๅจๅญฆไน ่ฏพ็จๅฎ่ทต\project1\dataset2\images\test\
- Detection may be poor due to angle/lighting differences
- Consider retraining with flood-specific images
๐ Alternative: Use official YOLO models (YOLOv11n) for general vehicles
- Default: 0.10 (10%)
- Range: 0.01 to 1.0
- Lower = more detections (more false positives)
- Higher = fewer detections (higher precision)
- Lower confidence threshold (try 0.05)
- Use images from training dataset
- Check console output for model loading confirmation
- Water overlay is 60% opacity with bright blue
- Check console for segmentation results
- Verify water exists in image
- Fixed: Results now persist across view switches
- Ensure you're in "Upload & Process" tab
Detailed documentation available in README/:
- README.md: Complete system documentation
- GUIDE.md: Quick start guide
- requirement.md: Original requirements
- architecture.md: Technical architecture
- CUSTOM_MODELS.md: Model information
- project_details.md: Implementation notes
- Frontend: Streamlit 1.28+
- Backend: Python 3.8+
- Deep Learning: PyTorch 2.0+ with CUDA
- Computer Vision: OpenCV 4.8+
- Object Detection: Ultralytics YOLO (v8 & v11)
- Data Processing: NumPy, Pandas
- Image Handling: PIL/Pillow
streamlit>=1.28.0
ultralytics>=8.0.0
opencv-python>=4.8.0
torch>=2.0.0
torchvision>=0.15.0
numpy>=1.24.0
pandas>=2.0.0
Pillow>=10.0.0Install all:
pip install -r requirements.txtProject: Task 4 - Vehicle Submersion Detection System Course: Machine Learning Practice (ๆบๅจๅญฆไน ่ฏพ็จๅฎ่ทต) Institution: [Your Institution] Due Date: October 28, 2025 Environment: Conda (yolov11), Python 3.x
This project is for academic use. Please refer to your institution's policies for code sharing and reuse.
This is an academic project. For questions or issues:
- Check
README/documentation - Review
test/scripts for examples - Consult
GUIDE.mdfor troubleshooting
For questions related to this project, please contact the development team.
- Ultralytics YOLO: Object detection framework
- Streamlit: Web interface framework
- OpenCV: Image processing library
- PyTorch: Deep learning platform
- Lines of Code: ~2,000+
- Python Files: 5 core modules
- Test Scripts: 19 test files
- Documentation: 7 markdown files
- Models: 6 trained models (2 best + 4 checkpoints)
โญ Star this repository if you find it helpful!
๐ Get started: streamlit run app.py
"# -yolo-promax"