Skip to content

Physics-constrained deep learning framework for real-time inverse design of patch antennas. Achieves sub-millimeter accuracy and 20x faster predictions than traditional EM simulations. Includes beginner-friendly Google Colab demo.

License

Notifications You must be signed in to change notification settings

ScriptedLines404/Inverse-design-of-patch-antenna-using-Deep-Learning

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🛰️ Inverse Design of Patch Antenna using Deep Learning

Deep Learning Antenna Design Python License

Accelerating antenna design through physics-constrained deep learning

🧭 Overview

This project implements a physics-constrained deep learning framework for the inverse design of patch antennas. Traditional antenna design relies on iterative electromagnetic simulations, which are computationally expensive and time-consuming. Our approach uses a neural network trained on synthetic data generated from classical antenna equations to predict optimal antenna dimensions from desired specifications in real-time.

🎯 Key Advantages

  • 20x faster than traditional EM simulations
  • 🎯 Sub-millimeter accuracy (0.12mm MAE)
  • 🔬 99.3% physics compliance with design constraints
  • 🌐 Interactive web interface for easy access

✨ Key Features

Feature Description
🧠 Deep Learning Model Physics-informed neural network with custom loss function
Real-time Prediction ~5ms inference time per design
📊 Synthetic Dataset 30,000 samples with manufacturing noise
🔧 Physics Constraints Embedded electromagnetic design rules
🌐 Web Interface Gradio-based interactive design tool
📈 Performance Metrics Comprehensive evaluation and visualization

📁 Project Structure

Inverse-design-of-patch-antenna-using-Deep-Learning/
│
├── LICENSE # License information
├── requirements.txt # Dependencies
├── training_plots.png # Training performance visualization
│
├── 📁 .gradio/
│ └── flagged/dataset1.csv # Example dataset
│
├── 📁 models/
│ ├── patch_antenna_model.h5 # Trained neural network model
│ ├── x_scaler.pkl # Input feature scaler
│ └── y_scaler.pkl # Output label scaler
│
├── 📁 src/
│ ├── inverse_design_patch_antenna.ipynb # Notebook version for exploration
│ └── inverse_design_patch_antenna.py # Script version for direct execution
│
└── 📁 img/
├── 🖼️ gradio_output.png
└── 📈 training_curves.png

🧠 Model Architecture

📊 Technical Specifications

Component Specification
Framework TensorFlow 2.12+ / Keras
Architecture Fully Connected Neural Network
Input Layer 2 neurons (Frequency, Dielectric Constant)
Hidden Layers 256 → 128 neurons (ReLU activation)
Output Layer 2 neurons (Length, Width)
Regularization Dropout (30%)
Optimizer Adam (lr=0.001)
Loss Function Custom MSE + Physics Penalty

🔧 Model Details

# Custom Physics-Informed Loss Function
def custom_loss(y_true, y_pred):
    mse = tf.reduce_mean(tf.square(y_true - y_pred))
    physics_penalty = tf.reduce_mean(
        tf.square(tf.maximum(1.05*y_pred[:,0] - y_pred[:,1], 0))
    )
    return mse + 0.001 * physics_penalty

📊 Input Features

  • Frequency (f_GHz): 1.0 - 12.0 GHz
  • Dielectric Constant (εᵣ): 2.2 - 12.0

🎯 Output Parameters

  • Length (L_mm): Patch antenna length in millimeters
  • Width (W_mm): Patch antenna width in millimeters

🔧 Model Artifacts

  • patch_antenna_model.h5 - Trained neural network weights and architecture
  • x_scaler.pkl - StandardScaler for input feature normalization
  • y_scaler.pkl - StandardScaler for output parameter denormalization

🎯 Quick Start

Google Colab (Recommended for beginners)

Open In Colab

  1. Click the Colab badge above
  2. Run the cell
  3. Interact with the Gradio interface at the bottom

⚙️ Installation

Prerequisites

  • Python 3.8+
  • pip package manager

1️⃣ Clone the Repository

git clone https://github.com/ScriptedLines404/Inverse-design-of-patch-antenna-using-Deep-Learning.git
cd Inverse-design-of-patch-antenna-using-Deep-Learning

2️⃣ Create Virtual Environment (Recommended)

python -m venv antenna_env

# On Windows:
antenna_env\Scripts\activate

# On Linux/Mac:
source antenna_env/bin/activate

3️⃣ Install Dependencies

Use a virtual environment for isolation:

pip install -r requirements.txt

🚀 Usage

▶️ Option 1: Run the Python Script

Execute the main script for inference:

python src/inverse_design_patch_antenna.py

The script:

  • Loads the pre-trained model.
  • Accepts desired antenna characteristics (e.g., resonant frequency).
  • Outputs optimal geometric parameters.

💡 Option 2: Use the Jupyter Notebook

Launch the notebook for step-by-step experimentation:

jupyter notebook src/inverse_design_patch_antenna.ipynb

🧩 Example Code Snippets

🔹 Load and Use the Trained Model

Here’s a quick example of how to use the pre-trained model for basic predictions:

import tensorflow as tf
import joblib
import numpy as np

# Load model and scalers
model = tf.keras.models.load_model("models/patch_antenna_model.h5")
x_scaler = joblib.load("models/x_scaler.pkl")
y_scaler = joblib.load("models/y_scaler.pkl")

# Predict dimensions
frequency = 2.4  # GHz
dielectric_constant = 4.4
input_features = np.array([[frequency, dielectric_constant]])
scaled_input = x_scaler.transform(input_features)
prediction = model.predict(scaled_input)
dimensions = y_scaler.inverse_transform(prediction)

L, W = dimensions[0]
print(f"Predicted Dimensions: L={L:.2f}mm, W={W:.2f}mm")

🔹 Example Output

Predicted Dimensions: L=28.45mm, W=31.27mm

(e.g., patch length, patch width, substrate height — units depend on dataset configuration)

📊 Results

🎯 Model Performance

Metric Value Description
Mean Absolute Error (Length) 0.12 mm Average error in patch length prediction
Mean Absolute Error (Width) 0.09 mm Average error in patch width prediction
R² Score 0.998 Coefficient of determination (closer to 1 is better)
Physics Compliance 99.3% Percentage of predictions satisfying W ≥ 1.05×L constraint
Inference Time ~5 ms Time per prediction on standard GPU

The following plot shows model performance during training:

Training Plots

The following is the Gradio output at localhost: 127.0.0.1:7860 / https://85cba0709ab084d899.gradio.live:

Gradio Output

📈 Performance Comparison

Method Speed Accuracy Physics Compliance
Traditional EM Simulation 100-1000 ms High 100%
Our DL Model ~5 ms High 99.3%
Standard ML Regression ~10 ms Medium 85-90%

🌟 Applications

Application Use Case Benefits
📱 5G and IoT Devices Rapid prototyping of compact antennas Faster time-to-market, optimized performance
🛰️ Satellite Communication Spaceborne antenna design Reduced simulation time, reliable designs
🏥 Medical Devices Wearable and implantable antennas Biocompatible designs, patient-specific optimization
🎓 Education Accessible antenna design tool Hands-on learning, no expensive software required
🔬 Research Parameter space exploration Rapid iteration, design optimization
🏭 Industry Mass production quality control Consistent designs, reduced prototyping costs

💡 Real-World Impact

  • 20x faster than traditional EM simulation workflows
  • Reduced computational costs by eliminating iterative simulations
  • Democratized access to advanced antenna design capabilities
  • Accelerated R&D cycles for wireless communication products

🤝 Contributing

Contributions are welcomed! 🙌

  1. 🍴 Fork the repository.
  2. 🌿 Create a new branch for your feature or bugfix.
  3. 🖊️ Write clear commit messages and include tests where possible.
  4. 📬 Submit a pull request with a detailed description.

Guidelines:

  • 🧹 Follow Python best practices.
  • 📚 Keep code clean and well-documented.
  • 📝 Update relevant documentation when making changes.

📜 License

This project is licensed under the MIT License. You are free to use, modify, and share this project with proper attribution.

🌟 About Me

Hi, there!. I am Vladimir Illich Arunan, an engineering student with a deep passion for understanding the inner workings of the digital world. My goal is to master the systems that power modern technology—not just to build and innovate, but also to test their limits through cybersecurity.

About

Physics-constrained deep learning framework for real-time inverse design of patch antennas. Achieves sub-millimeter accuracy and 20x faster predictions than traditional EM simulations. Includes beginner-friendly Google Colab demo.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published