A Streamlit-based web app that allows you to visualize the feature maps generated by a convolution layer (Conv2d) in PyTorch. This tool is perfect for understanding how convolutional filters interact with images and exploring deep learning fundamentals.
-
Upload an image in PNG, JPG, or JPEG format.
-
Adjust convolution parameters using an interactive sidebar:
- Out Channels: Number of convolutional filters.
- Kernel Size: Size of each convolutional filter.
- Stride: Step size for sliding the kernel over the image.
- Padding: Zero-padding added to the input image.
-
Visualize each feature map in a grid layout.
-
Developed entirely with PyTorch, Torchvision, PIL, Matplotlib, and Streamlit.
- Clone the repository:
git clone https://github.com/RohanSardar/Conv2dVisualization
cd Conv2dVisualization- Create and activate a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # Linux/Mac
venv\Scripts\activate # Windows- Install dependencies:
pip install -r requirements.txt- Run the Streamlit app:
streamlit run app.py- Upload an image through the sidebar.
- Adjust convolution parameters.
- Click "Process Image" to visualize the feature maps.
- Out Channels: Controls how many different features the convolution layer extracts.
- Kernel Size: Determines the size of the filter used to scan the image.
- Stride: Determines how much the filter moves at each step.
- Padding: Adds zeros around the image to control output size.
Each filter produces a feature map showing activated patterns from the input image. This visualization helps understand how convolution layers detect edges, textures, and more complex patterns.
- Python
- Streamlit
- PyTorch
- Torchvision
- PIL / Pillow
- Matplotlib
Developed by Rohan Sardar Project completed on 2nd December 2025.
