SpirAi takımı tarafından geliştirilen, Teknofest 2025 Havacılıkta Yapay Zeka yarışması için nesne tespit ve pozisyon kestirim kütüphanesi.
spiral/
├── requirements.txt # Bağımlılıklar
├── example/ # Kullanım örnekleri
│ ├── dataloader.py # Veri yükleme araçları
│ ├── monitoring.py # Görselleştirme araçları
│ └── usage.py # Kullanım senaryoları
├── spiral_lib/ # Ana kütüphane
│ ├── config/ # Yapılandırma dosyaları
│ ├── object_detection/# Nesne tespiti modülü
│ ├── position_estimation/# Pozisyon kestirim modülü
│ ├── postprocessing/ # Sonuç işleme araçları
│ ├── preprocessing/ # Ön işleme araçları
│ └── utils/ # Yardımcı fonksiyonlar
└── tests/ # Test senaryoları
├── main/ # Ana pipeline testleri
├── object_detection/# Nesne tespiti testleri
└── position_estimation/# Pozisyon kestirim testleri
Nesne tespiti için YOLO tabanlı güçlü bir pipeline sunulmaktadır:
from spiral_lib import ObjectDetectionPipeline
import cv2
# Pipeline başlatma
spiral_od = ObjectDetectionPipeline()
# Görüntü yükleme
frame = cv2.imread("goruntu.jpg")
# Nesne tespiti
nesneler = spiral_od.predict(frame, verbose=False)
# Her nesne şu bilgileri içerir:
# - Sınırlayıcı kutu koordinatları (normalize ve mutlak)
# - Güven skoru
# - Sınıf etiketi
# - Takip ID'si (varsa)
Pozisyon kestirimi için:
from spiral_lib import PositionEstimationPipeline
# Pipeline başlatma
spiral_pe = PositionEstimationPipeline(enable_pix2meter=True)
# Pozisyon kestirimi
frame = cv2.imread("goruntu.jpg")
health_status = True # Sistem sağlık durumu
tahmin_edilen_pozisyon = spiral_pe.predict(frame, health_status)
x, y, z = tahmin_edilen_pozisyon
Tüm işlemleri tek bir pipeline'da birleştirmek için:
from spiral_lib import MainPipeline
# Ana pipeline başlatma
spiral = MainPipeline()
# Görüntü işleme
frame = cv2.imread("goruntu.jpg")
health_status = True
nesneler, pozisyonlar = spiral.predict(
frame,
health_status,
translation_x=0.0,
translation_y=0.0,
translation_z=0.0
)
tests/object_detection/
klasöründe:
# detection_pipeline.py örneği
from spiral.spiral_lib.object_detection.pipeline import ObjectDetectionPipeline
from spiral.spiral_lib.postprocessing.monitor_helper import MonitorHelper
model = ObjectDetectionPipeline()
TestPrediction.predict_image_list(model, goruntu_yollari, show=True)
tests/position_estimation/
klasöründe test senaryoları bulunmaktadır.
MonitorHelper sınıfı ile görselleştirme:
from spiral_lib.postprocessing.monitor_helper import MonitorHelper
monitor = MonitorHelper()
# Tespit edilen nesneleri görselleştirme
goruntu = monitor.paint_objects(goruntu, nesneler)
# Yörünge görselleştirme
goruntu = monitor.paint_values(goruntu, nesneler, pos_x, pos_y, pos_z)
Yapılandırma dosyaları spiral_lib/config/
altında:
object_detection.yaml
: Nesne tespiti parametreleriposition_estimation.yaml
: Pozisyon kestirimi parametreleripostprocess.yaml
: Sonrası işlem ayarlarıpreprocess.yaml
: Ön işlem ayarları
Sistem otomatik olarak önemli bilgileri loglar:
- Log dosyaları
spiral_lib/logs/
altında - Zaman damgalı detaylı çalışma bilgileri
- Farklı log seviyeleri (INFO, WARNING, vb.)
Temel bağımlılıklar:
- OpenCV (cv2)
- PyTorch
- Ultralytics YOLO
- NumPy
- OmegaConf
Tüm bağımlılıklar için requirements.txt
dosyasına bakınız.
Daha detaylı örnekler için example/
dizini ve test dosyalarını inceleyebilirsiniz.
Object detection and position estimation library developed by the SpirAi team for the Teknofest 2025 Artificial Intelligence in Aviation competition.
spiral/
├── requirements.txt # Dependencies
├── example/ # Usage examples
│ ├── dataloader.py # Data loading tools
│ ├── monitoring.py # Visualization tools
│ └── usage.py # Usage scenarios
├── spiral_lib/ # Main library
│ ├── config/ # Configuration files
│ ├── object_detection/# Object detection module
│ ├── position_estimation/# Position estimation module
│ ├── postprocessing/ # Result processing tools
│ ├── preprocessing/ # Preprocessing tools
│ └── utils/ # Helper functions
└── tests/ # Test scenarios
├── main/ # Main pipeline tests
├── object_detection/# Object detection tests
└── position_estimation/# Position estimation tests
A powerful YOLO-based pipeline for object detection:
from spiral_lib import ObjectDetectionPipeline
import cv2
# Initialize pipeline
spiral_od = ObjectDetectionPipeline()
# Load image
frame = cv2.imread("image.jpg")
# Object detection
objects = spiral_od.predict(frame, verbose=False)
# Each object contains:
# - Bounding box coordinates (normalized and absolute)
# - Confidence score
# - Class label
# - Tracking ID (if available)
For position estimation:
from spiral_lib import PositionEstimationPipeline
# Initialize pipeline
spiral_pe = PositionEstimationPipeline(enable_pix2meter=True)
# Position estimation
frame = cv2.imread("image.jpg")
health_status = True # System health status
estimated_position = spiral_pe.predict(frame, health_status)
x, y, z = estimated_position
To combine all operations in a single pipeline:
from spiral_lib import MainPipeline
# Initialize main pipeline
spiral = MainPipeline()
# Image processing
frame = cv2.imread("image.jpg")
health_status = True
objects, positions = spiral.predict(
frame,
health_status,
translation_x=0.0,
translation_y=0.0,
translation_z=0.0
)
In the tests/object_detection/
directory:
# detection_pipeline.py example
from spiral.spiral_lib.object_detection.pipeline import ObjectDetectionPipeline
from spiral.spiral_lib.postprocessing.monitor_helper import MonitorHelper
model = ObjectDetectionPipeline()
TestPrediction.predict_image_list(model, image_paths, show=True)
Test scenarios are available in the tests/position_estimation/
directory.
Visualization with MonitorHelper class:
from spiral_lib.postprocessing.monitor_helper import MonitorHelper
monitor = MonitorHelper()
# Visualize detected objects
image = monitor.paint_objects(image, objects)
# Visualize trajectory
image = monitor.paint_values(image, objects, pos_x, pos_y, pos_z)
Configuration files under spiral_lib/config/
:
object_detection.yaml
: Object detection parametersposition_estimation.yaml
: Position estimation parameterspostprocess.yaml
: Post-processing settingspreprocess.yaml
: Preprocessing settings
The system automatically logs important information:
- Log files under
spiral_lib/logs/
- Timestamped detailed operation information
- Different log levels (INFO, WARNING, etc.)
Core dependencies:
- OpenCV (cv2)
- PyTorch
- Ultralytics YOLO
- NumPy
- OmegaConf
For all dependencies, please refer to the requirements.txt
file.
For more detailed examples, check the example/
directory and test files.