Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

20 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:

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

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages