A comprehensive application for detecting victims in disaster scenarios using UAV imagery, built with YOLO and advanced image harmonization techniques.
- Real-time Victim Detection: Uses YOLOv5 for accurate person detection
- Image Harmonization: Integrates with advanced harmonization models for better detection in challenging conditions
- Multiple Input Sources: Support for images, videos, and live camera feeds
- Interactive GUI: User-friendly interface built with Tkinter
- Export Capabilities: Save results in JSON, CSV, and YOLO formats
- Batch Processing: Process multiple images simultaneously
- Configurable Parameters: Adjustable confidence thresholds and detection settings
- Python 3.8 or higher
- CUDA-compatible GPU (optional, for faster processing)
- 4GB+ RAM recommended
- Webcam (for live detection)
git clone <repository-url>
cd VictimDetpython setup.pyThis will automatically:
- Install all required dependencies
- Download YOLOv5 model
- Create necessary directories
- Set up configuration files
python app.pyIf you prefer manual installation:
pip install -r requirements.txtThe app will automatically download YOLOv5s on first run, or you can download it manually:
import torch
model = torch.hub.load('ultralytics/yolov5', 'yolov5s', pretrained=True)mkdir -p models checkpoints weights data/samples outputs logs- Load an Image: Click "Load Image" and select a disaster scene image
- Adjust Settings: Set confidence threshold and enable/disable harmonization
- Detect Victims: Click "Detect Victims" to run the detection
- View Results: See bounding boxes and detection information
- Export Results: Save results in your preferred format
from detector import VideoProcessor, VictimDetector
detector = VictimDetector()
processor = VideoProcessor(detector)
# Process video file
processor.process_video("disaster_scene.mp4", "output.mp4")
# Process live camera feed
processor.process_camera(camera_id=0)from detector import VictimDetector
import cv2
detector = VictimDetector()
images = [cv2.imread(f"image_{i}.jpg") for i in range(10)]
results = detector.detect_batch(images)from detector import VictimDetector
# Use custom trained model
detector = VictimDetector(model_path="path/to/your/model.pt")
detections = detector.detect(image)The application uses a JSON configuration file (config.json) with the following options:
{
"detection": {
"confidence_threshold": 0.5,
"iou_threshold": 0.45,
"model_path": null,
"use_harmonization": true
},
"harmonization": {
"enabled": true,
"model_path": null,
"preprocessing_filters": ["histogram", "sharpen"]
},
"ui": {
"window_size": [1200, 800],
"theme": "light",
"auto_save": true
},
"export": {
"default_format": "json",
"include_metadata": true,
"save_images": true
}
}from detector import VictimDetector
# Initialize detector
detector = VictimDetector(model_path="path/to/model.pt")
# Detect victims in image
detections = detector.detect(image, confidence=0.5)
# Batch detection
batch_results = detector.detect_batch(images)
# Get model information
info = detector.get_model_info()from harmonizer import ImageHarmonizer
# Initialize harmonizer
harmonizer = ImageHarmonizer(model_path="path/to/harmonization_model.pt")
# Process image
harmonized_image = harmonizer.process(image, mask)from utils import ResultsExporter
exporter = ResultsExporter()
# Export to JSON
exporter.export_json(results, "results.json")
# Export to CSV
exporter.export_csv(results, "results.csv")
# Export in YOLO format
exporter.export_yolo_format(results, "labels.txt", (640, 640)){
"timestamp": "2024-01-15T10:30:00",
"total_detections": 3,
"detections": [
{
"bbox": [100, 150, 200, 300],
"confidence": 0.85,
"class_id": 0,
"class_name": "person"
}
]
}detection_id,x1,y1,x2,y2,confidence,class_name
1,100,150,200,300,0.85,person
2,250,180,350,320,0.92,person- Collect disaster scene images with victim annotations
- Use YOLO format annotations
- Ensure diverse lighting and weather conditions
# Using YOLOv5
python train.py --data victim_dataset.yaml --epochs 100 --batch-size 16detector = VictimDetector(model_path="path/to/your/trained_model.pt")The app supports integration with your existing harmonization model:
- Place Model Weights: Put your trained harmonization model in the
models/directory - Update Configuration: Set the model path in
config.json - Enable Harmonization: Set
harmonization.enabledtotrue
-
CUDA Out of Memory
- Reduce batch size
- Use CPU instead of GPU
- Process images one at a time
-
Model Loading Failed
- Check internet connection for YOLOv5 download
- Verify model file paths
- Ensure sufficient disk space
-
GUI Not Displaying
- Check if tkinter is installed
- Try running with
python -m tkinter - Use alternative GUI frameworks if needed
-
GPU Acceleration
- Install CUDA toolkit
- Install cuDNN
- Verify PyTorch CUDA installation
-
Memory Management
- Process images in smaller batches
- Clear GPU cache between operations
- Use mixed precision training
Typical performance on different hardware:
| Hardware | Images/sec | Memory Usage |
|---|---|---|
| CPU (Intel i7) | 2-3 | 2GB |
| GPU (RTX 3080) | 15-20 | 4GB |
| GPU (RTX 4090) | 25-30 | 6GB |
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and questions:
- Check the troubleshooting section
- Open an issue on GitHub
- Contact the development team
- Initial release with basic YOLO detection
- GUI interface
- Export functionality
- Real-time video processing
- Advanced harmonization integration
- Mobile app version
- Cloud deployment options