Skip to content

Conversation

@debug-soham
Copy link
Contributor

Description

This pull request introduces MaxPooling2D and AveragePooling2D layers to the PyDeepFlow library. These are essential components for building modern Convolutional Neural Networks (CNNs) and are crucial for down-sampling feature maps, reducing computational complexity, and improving translation invariance.

This enhancement significantly improves the capabilities of PyDeepFlow for computer vision tasks.

Changes Made

  • MaxPooling2D Layer: Implemented a new MaxPooling2D class with both forward and backward passes. The forward pass caches the indices of max values for correct gradient routing during backpropagation.
  • AveragePooling2D Layer: Implemented a new AveragePooling2D class. The backward pass correctly distributes the gradient equally across the pooling window.
  • Integration with Multi_Layer_CNN: Updated the Multi_Layer_CNN class to recognize and handle 'maxpool' and 'avgpool' as valid layer types in the model architecture definition.
  • Validator Update: Updated the ModelValidator to include 'maxpool' and 'avgpool' as valid layer types.
  • Unit Tests: Added a new test file, tests/test_layers.py, with comprehensive unit tests for both pooling layers to ensure the correctness of the forward and backward passes.

How to Test

The new layers can be verified by running the new unit tests from the project's root directory:

python -m unittest tests/test_layers.py

Closes: #108

@debug-soham
Copy link
Contributor Author

Closing this PR. Will create a final PR addressing all the issues. Sorry for the inconvenience.

@debug-soham debug-soham deleted the feat/add-pooling-layers branch October 13, 2025 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant