#!/bin/bash
# Install dependencies in the anti_uav_complete environment

set -e

echo "🚀 Installing dependencies in anti_uav_complete environment"
echo "=========================================================="

# Activate environment
source $(conda info --base)/etc/profile.d/conda.sh
conda activate anti_uav_complete

echo "✅ Environment activated: $(conda info --show)"

# Install PyTorch with CUDA 12.1 (compatible version)
echo "🔥 Installing PyTorch 2.3.0 + CUDA 12.1..."
pip install torch==2.3.0 torchvision==0.18.0 torchaudio==2.3.0 --index-url https://download.pytorch.org/whl/cu121

# Install Ultralytics YOLOv8
echo "🎯 Installing YOLOv8 (Ultralytics)..."
pip install ultralytics==8.2.0

# Install core dependencies
echo "📦 Installing core dependencies..."
pip install numpy opencv-python Pillow matplotlib seaborn pandas tqdm pyyaml scipy

# Install hyperparameter optimization
echo "⚙️ Installing HPO dependencies..."
pip install optuna "ray[tune]" bayesian-optimization hyperopt

# Install model export
echo "🔄 Installing model export dependencies..."
pip install onnx onnxruntime onnxruntime-gpu

# Install API service dependencies
echo "🌐 Installing API service dependencies..."
pip install fastapi "uvicorn[standard]" websockets python-multipart

# Install advanced ML dependencies  
echo "🧠 Installing advanced ML dependencies..."
pip install transformers timm einops

# Install monitoring
echo "📊 Installing monitoring dependencies..."
pip install wandb tensorboard psutil

echo "✅ Core dependencies installation completed!"