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.
- ⚡ 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
| 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 |
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
| 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 |
# 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- Frequency (f_GHz): 1.0 - 12.0 GHz
- Dielectric Constant (εᵣ): 2.2 - 12.0
- Length (L_mm): Patch antenna length in millimeters
- Width (W_mm): Patch antenna width in millimeters
patch_antenna_model.h5- Trained neural network weights and architecturex_scaler.pkl- StandardScaler for input feature normalizationy_scaler.pkl- StandardScaler for output parameter denormalization
- Click the Colab badge above
- Run the cell
- Interact with the Gradio interface at the bottom
- Python 3.8+
- pip package manager
git clone https://github.com/ScriptedLines404/Inverse-design-of-patch-antenna-using-Deep-Learning.git
cd Inverse-design-of-patch-antenna-using-Deep-Learningpython -m venv antenna_env
# On Windows:
antenna_env\Scripts\activate
# On Linux/Mac:
source antenna_env/bin/activate
Use a virtual environment for isolation:
pip install -r requirements.txtExecute the main script for inference:
python src/inverse_design_patch_antenna.pyThe script:
- Loads the pre-trained model.
- Accepts desired antenna characteristics (e.g., resonant frequency).
- Outputs optimal geometric parameters.
Launch the notebook for step-by-step experimentation:
jupyter notebook src/inverse_design_patch_antenna.ipynbHere’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")Predicted Dimensions: L=28.45mm, W=31.27mm(e.g., patch length, patch width, substrate height — units depend on dataset configuration)
| 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:
The following is the Gradio output at localhost: 127.0.0.1:7860 / https://85cba0709ab084d899.gradio.live:
| 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% |
| 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 |
- 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
Contributions are welcomed! 🙌
- 🍴 Fork the repository.
- 🌿 Create a new branch for your feature or bugfix.
- 🖊️ Write clear commit messages and include tests where possible.
- 📬 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.
This project is licensed under the MIT License. You are free to use, modify, and share this project with proper attribution.
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.

