项目作者: perslev

项目描述 :
TensorFlow implementation of the autofocus layer as described in 'Autofocus Layer for Semantic Segmentation' (https://arxiv.org/pdf/1805.08403.pdf), MICCAI 2018.
高级语言: Python
项目地址: git://github.com/perslev/Autofocus-Layer-TF.git
创建时间: 2018-09-25T13:51:45Z
项目社区:https://github.com/perslev/Autofocus-Layer-TF

开源协议:

下载


Autofocus-Layer-TF

TensorFlow implementation of the autofocus layer as described in ‘Autofocus Layer for Semantic Segmentation’ (https://arxiv.org/pdf/1805.08403.pdf), MICCAI 2018.

Paper authors:
Yao Qin, Konstantinos Kamnitsas, Siddharth Ancha, Jay Nanavati, Garrison Cottrell, Antonio Criminisi, and Aditya Nori

Note: I am not among the authors, there may be differences between this implementation and the one suggested by the authors.

See https://github.com/yaq007/Autofocus-Layer for PyTorch implementation.

Use

The layer can be used as a drop-in replacement of the tf.keras.layers.Conv2D layer:

  1. from autofocus import Autofocus2D
  2. import tensorflow as tf
  3. # Dilation rates, here 4 parallel conv applications
  4. dilations = [1, 2, (3, 3), (4, 6)]
  5. # Define model
  6. model = tf.keras.Sequential([
  7. tf.keras.layers.InputLayer(input_shape=[128, 128, 3], batch_size=64),
  8. Autofocus2D(dilations,
  9. filters=20,
  10. kernel_size=(5, 5),
  11. activation='relu',
  12. attention_activation=tf.nn.relu,
  13. attention_filters=10,
  14. attention_kernel_size=3,
  15. use_bn=True),
  16. tf.keras.layers.Conv2D(10, 3, activation="relu")
  17. # etc....
  18. ])