Skip to content

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

Notifications You must be signed in to change notification settings

perslev/Autofocus-Layer-TF

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

from autofocus import Autofocus2D
import tensorflow as tf

# Dilation rates, here 4 parallel conv applications
dilations = [1, 2, (3, 3), (4, 6)]

# Define model
model = tf.keras.Sequential([
    tf.keras.layers.InputLayer(input_shape=[128, 128, 3], batch_size=64),
    Autofocus2D(dilations, 
                filters=20, 
                kernel_size=(5, 5), 
                activation='relu',
                attention_activation=tf.nn.relu,
                attention_filters=10,
                attention_kernel_size=3,
                use_bn=True),
    tf.keras.layers.Conv2D(10, 3, activation="relu")
    # etc....
])

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages