Top AI Repos — open-source AI, indexed and scored
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Top AI Repos tracks AI repositories on GitHub and answers two different questions about each one: is it moving right now, and would you bet a product on it.
Gradient based receptive field estimation for Convolutional Neural Networks
| Date | Stars |
|---|---|
| 2026-07-31 | 341 |
| 2026-08-05 | 341 |
| 2026-08-06 | 341 |
Today
— stars today
This week
— stars this week
This month
— stars this month
Momentum
0.0
growth rate 0.00%/day
<img src="img/demo_readme.jpg" width="800">
# receptivefield
Gradient based receptive field estimation for Convolutional
Neural Networks. **receptivefield** uses backpropagation of
the gradients from output of selected feature maps to the input image in order to
estimate the size (width, height), stride and offset of resulting
receptive field. Numerical estimation of receptive field can be
useful when dealing with more complicated neural networks like
ResNet, Inception (see notebooks) where analytical approach of
computing receptive fields cannot be used.
[](https://travis-ci.org/fornaxai/receptivefield)
# Installation & supported APIs
* Requires: python (in version >= 3.6), numpy, matplotlib, pillow (check requirements.txt)
* `pip install receptivefield>=0.5.0`
* tensorflow.keras>=2.0
* pytorch>=1.3.1
* `pip install receptivefield==0.4.0`
* keras==2.1.6
* tensorflow==1.8.0
* pytorch>=0.4.0
# Some remarks
* In order to get better results or avoid possible NaNs in the
estimated receptive field parameters, it is suggested to
use `Linear` (instead `Relu`) activation and `AvgPool2D` instead of `MaxPool2D`.
This improves gradient flow in the network and hence better signal
in the input image. Note, that this is required only for RF estimation.
* Additionally, one may even initialize network with constant
positive values in all weights (positive if max pooling is used)
and set biases to zero. In the case of Keras API this can be obtained by setting `init_weight=True`
in the `KerasReceptiveField(init_weight=True)` constructor.
# Limitations
* Numerical approach cannot be used when RF is larger that input image, however
one may try to increase the input image size, since RF parameters depend on the architecture not
input image size.
# Supported APIs
Currently only Keras, Tensorflow and Pytorch API are supported. However, it should be
possible to extend **receptivefield** functionality by deriving
abstract class **ReceptiveField** in the base.py file.
* Keras: `KerasReceptiveField`, example usage in *notebooks/keras_api.ipynb*
* Tensorflow: `TFReceptiveField` or `TFFeatureMapsReceptiveField`, example usage in *notebooks/tensorflow_api.ipynb*
* Pytorch: `PytorchReceptiveField`, example usage in *notebooks/minimal_example_with_pytorch_API.ipynb*
# How does it work?
This is description of a general approach which is almost the same for other
APIs.
1. Define build_function which returns model (here Keras model)
```python
def model_build_func(input_shape=[224, 224, 3]):
...
return Model(input, output)
```
2. Compute receptive field parameters with `KerasReceptiveField`
```python
from receptivefield.keras import KerasReceptiveField
rf_params = KerasReceptiveField(model_build_func).compute(
input_shape=[224, 224, 3], # this will be passed to model_build_func
input_layer='input_image', # must exist - usually input image layer
output_layers=['feature_map'] # for example last conv layer
)
```
3. The `rf_params` is a list of `FeatureMapDescription`. Here we selected
only single feature map `output_layers=['feature_map']` and the `rf_params` will
contain
```python
rf_params = [
FeatureMapDescription(
size=Size(w=60, h=60),
rf=ReceptiveFieldDescription(
offset=(2.5, 2.5),
stride=(1.0, 1.0),
size=Size(w=9, h=9))
)
]
```
Explanation of `FeatureMapDescription` fields:
* `size` - defined the spatial dimensions of the feature map i.e. the width
and height of the feature map grid.
* rf is an instance of `ReceptiveFieldDescription`:
* `offset` - defines location of the first left-top anchor in the
image coordinates (defined in pixels).
* `stride` - defines how much RF of the network moves w.r.t uExcerpt of 13,812 characters
Read on GitHubWould you bet a product on this? Bounded 0–100 and slow moving.
matched fp:6d8ca447981a9f6d, llm:description: 'Gradient based receptive field estimation for Convolutional Neural Networks'
matched fp:6d8ca447981a9f6d, llm:description: 'Gradient based receptive field estimation for Convolutional Neural Networks'
matched fp:6d8ca447981a9f6d, llm:description: 'Gradient based receptive field estimation for Convolutional Neural Networks'