{"nbformat_minor": 1, "cells": [{"cell_type": "markdown", "metadata": {}, "source": ["Looking to understand feature pyramid network, https://arxiv.org/abs/1612.03144\n", "\n", "From what I can tell it is very similar to the second half of unet. There is a lot of room for variation in the number of layers, etc.  Anything completely wrong with below implementation?"]}, {"execution_count": null, "cell_type": "code", "outputs": [], "metadata": {"_uuid": "dcc0b66020281769353dc37bf1ddbfbc2f39970e", "collapsed": true, "_cell_guid": "8c1758ac-df2e-4b4c-be48-98f5779ae325"}, "source": ["import tensorflow as tf \n", "tl = tf.layers"]}, {"execution_count": null, "cell_type": "code", "outputs": [], "metadata": {"collapsed": true}, "source": ["def fpn_up_mrg(x, skp_x, n_filts=256):\n", "    with tf.name_scope('fpn_up_mrg'):\n", "        # 1x1 convolution to the skip connection \n", "        skp_x = tl.conv2d(skp_x, n_filts, (1,1))\n", "        \n", "        shp = tf.shape(x)\n", "        x = image.resize_nearest_neighbor(x, [shp[1]*2, shp[2]*2], True)\n", "        x = x + skp_x\n", "        x = tl.conv2d(x, n_filts, (3,3), padding='same')\n", "    return x \n", "\n", "# c1-c4 are skip connections from feature extractor network. \n", "def fpn(c0,c1,c2,c3,c4):\n", "    with tf.name_scope('fpn'):\n", "        p4 = tl.conv2d(c4, 256, (1, 1))\n", "        p3 = fpn_up_mrg(p4, c3)\n", "        p2 = fpn_up_mrg(p3, c2)\n", "        p1 = fpn_up_mrg(p2, c1) \n", "        p0 = fpn_up_mrg(p1, c0)\n", "    return p0, p1, p2, p3, p4 "]}, {"execution_count": null, "cell_type": "code", "outputs": [], "metadata": {"collapsed": true}, "source": []}], "nbformat": 4, "metadata": {"kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"}, "language_info": {"pygments_lexer": "ipython3", "file_extension": ".py", "codemirror_mode": {"name": "ipython", "version": 3}, "version": "3.6.4", "mimetype": "text/x-python", "nbconvert_exporter": "python", "name": "python"}}}