├── RAS-tutorial_save.ipynb ├── README.md ├── deploy.prototxt ├── solve.py ├── solver.prototxt └── train.prototxt /RAS-tutorial_save.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 11, 6 | "metadata": { 7 | "collapsed": true 8 | }, 9 | "outputs": [], 10 | "source": [ 11 | "import numpy as np\n", 12 | "import scipy.misc\n", 13 | "import Image\n", 14 | "import scipy.io\n", 15 | "import os\n", 16 | "import cv2\n", 17 | "import time\n", 18 | "\n", 19 | "# Make sure that caffe is on the python path:\n", 20 | "caffe_root = '../../'\n", 21 | "import sys\n", 22 | "sys.path.insert(0, caffe_root + 'python')\n", 23 | "\n", 24 | "import caffe\n", 25 | "\n", 26 | "EPSILON = 1e-8" 27 | ] 28 | }, 29 | { 30 | "cell_type": "code", 31 | "execution_count": 12, 32 | "metadata": { 33 | "collapsed": true 34 | }, 35 | "outputs": [], 36 | "source": [ 37 | "data_root = '/home/shuhan/datasets/MSRA-5000/'\n", 38 | "with open('../../data/msra_b/test.lst') as f:\n", 39 | " test_lst = f.readlines()\n", 40 | " \n", 41 | "test_lst = [data_root+x.strip() for x in test_lst]" 42 | ] 43 | }, 44 | { 45 | "cell_type": "code", 46 | "execution_count": 13, 47 | "metadata": {}, 48 | "outputs": [], 49 | "source": [ 50 | "#remove the following two lines if testing with cpu\n", 51 | "caffe.set_mode_gpu()\n", 52 | "# choose which GPU you want to use\n", 53 | "caffe.set_device(0)\n", 54 | "caffe.SGDSolver.display = 0\n", 55 | "# load net\n", 56 | "net = caffe.Net('deploy.prototxt', 'ras_iter_10000.caffemodel', caffe.TEST)\n", 57 | "save_root = '../../data/result/'\n", 58 | "if not os.path.exists(save_root):\n", 59 | " os.mkdir(save_root)" 60 | ] 61 | }, 62 | { 63 | "cell_type": "code", 64 | "execution_count": 14, 65 | "metadata": {}, 66 | "outputs": [ 67 | { 68 | "ename": "KeyboardInterrupt", 69 | "evalue": "", 70 | "output_type": "error", 71 | "traceback": [ 72 | "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", 73 | "\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)", 74 | "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m()\u001b[0m\n\u001b[1;32m 14\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 15\u001b[0m \u001b[0;31m# run net and take argmax for prediction\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 16\u001b[0;31m \u001b[0mnet\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mforward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 17\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnet\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mblobs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'sigmoid-score1'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 18\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", 75 | "\u001b[0;32m/home/angeler/code/caffe_dss/python/caffe/pycaffe.pyc\u001b[0m in \u001b[0;36m_Net_forward\u001b[0;34m(self, blobs, start, end, **kwargs)\u001b[0m\n\u001b[1;32m 119\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mblobs\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0min_\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdata\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mblob\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 120\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 121\u001b[0;31m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m_forward\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstart_ind\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mend_ind\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 122\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 123\u001b[0m \u001b[0;31m# Unpack blobs to extract\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", 76 | "\u001b[0;31mKeyboardInterrupt\u001b[0m: " 77 | ] 78 | } 79 | ], 80 | "source": [ 81 | "start_time = time.time()\n", 82 | "for idx in range(0, len(test_lst)):\n", 83 | " # load image\n", 84 | " img = Image.open(test_lst[idx])\n", 85 | " img = np.array(img, dtype=np.uint8)\n", 86 | " im = np.array(img, dtype=np.float32)\n", 87 | " im = im[:,:,::-1]\n", 88 | " im -= np.array((104.00698793,116.66876762,122.67891434))\n", 89 | " im = im.transpose((2,0,1))\n", 90 | " \n", 91 | " # shape for input (data blob is N x C x H x W), set data\n", 92 | " net.blobs['data'].reshape(1, *im.shape)\n", 93 | " net.blobs['data'].data[...] = im\n", 94 | " \n", 95 | " # run net and take argmax for prediction\n", 96 | " net.forward()\n", 97 | " res = net.blobs['sigmoid-score1'].data[0][0,:,:]\n", 98 | " \n", 99 | " # normalization\n", 100 | " res = (res - np.min(res) + EPSILON) / (np.max(res) - np.min(res) + EPSILON)\n", 101 | " res = 255*res;\n", 102 | " cv2.imwrite(save_root + test_lst[idx][33:-4] + '.png', res)\n", 103 | "\n", 104 | "diff_time = time.time() - start_time\n", 105 | "print 'Detection took {:.3f}s per image'.format(diff_time/len(test_lst))" 106 | ] 107 | }, 108 | { 109 | "cell_type": "code", 110 | "execution_count": null, 111 | "metadata": { 112 | "collapsed": true 113 | }, 114 | "outputs": [], 115 | "source": [] 116 | } 117 | ], 118 | "metadata": { 119 | "kernelspec": { 120 | "display_name": "Python 2", 121 | "language": "python", 122 | "name": "python2" 123 | }, 124 | "language_info": { 125 | "codemirror_mode": { 126 | "name": "ipython", 127 | "version": 2 128 | }, 129 | "file_extension": ".py", 130 | "mimetype": "text/x-python", 131 | "name": "python", 132 | "nbconvert_exporter": "python", 133 | "pygments_lexer": "ipython2", 134 | "version": "2.7.6" 135 | } 136 | }, 137 | "nbformat": 4, 138 | "nbformat_minor": 1 139 | } 140 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RAS 2 | This code is for the paper "Reverse Attention for Salient Object Detection".[pdf](https://arxiv.org/pdf/1807.09940.pdf) 3 | 4 | --- 5 | Pytorch Version 6 | --- 7 | A PyTorch version is available at [here](https://github.com/ShuhanChen/RAS-pytorch). 8 | 9 | Citation 10 | --- 11 | ``` 12 | @inproceedings{chen2018eccv, 13 | author={Chen, Shuhan and Tan, Xiuli and Wang, Ben and Hu, Xuelong}, 14 | booktitle={European Conference on Computer Vision}, 15 | title={Reverse Attention for Salient Object Detection}, 16 | year={2018} 17 | } 18 | ``` 19 | ``` 20 | @article{chen2020tip, 21 | author={Chen, Shuhan and Tan, Xiuli and Wang, Ben and Lu, Huchuan and Hu, Xuelong and Fu, Yun}, 22 | journal={IEEE Transactions on Image Processing}, 23 | title={Reverse Attention Based Residual Network for Salient Object Detection}, 24 | volume={29}, 25 | pages={3763-3776}, 26 | year={2020} 27 | } 28 | ``` 29 | 30 | Installing 31 | --- 32 | 1. Install prerequisites for Caffe (http://caffe.berkeleyvision.org/installation.html#prequequisites).
33 | 2. Build [DSS](https://github.com/Andrew-Qibin/caffe_dss) [1] with cuDNN v5.1 for acceleration. Supposing the root directory of DSS is ``$DSS``.
34 | ``` 35 | USE_CUDNN := 1 36 | ``` 37 | 3. Copy the folder RAS to ``$DSS/example/``.
38 | 39 | Training 40 | --- 41 | 1. Prepare training dataset and its corresponding data list.
42 | 2. Download the Pre-trained VGG model ([VGG-16](http://vcl.ucsd.edu/hed/5stage-vgg.caffemodel)) and copy it to ``$DSS/example/ras``.
43 | 3. Change the dataset path in ``$DSS/example/RAS/train.prototxt``.
44 | 4. Run ``solve.py`` in shell (or you could use IDE like Eclipse).
45 | 46 | ``` 47 | cd $DSS/example/RAS/ 48 | python solve.py 49 | ``` 50 | 51 | Testing 52 | --- 53 | 1. Change the dataset path in ``$DSS/example/RAS-tutorial_save.py``.
54 | 2. Run ``jupyter notebook RAS-tutorial_save.ipynb``.
55 | 56 | Evaluation 57 | --- 58 | We use the [code](https://github.com/MingMingCheng/CmCode/tree/master/CmLib/Illustration) of [1] for evaluation. 59 | 60 | Pre-trained RAS model 61 | --- 62 | Pre-trained RAS model on [MSRA-B](https://people.cs.umass.edu/~hzjiang/drfi/index.html): [Baidu drive](https://pan.baidu.com/s/1aM2VYUioCpsReOQ-42POoA)(h7qj) and [Google drive](https://drive.google.com/open?id=1vDHzr0O7qcQcx0qkzz0iSe5qTPn8h6J0).
63 | Note that this released model is newly trained and is slightly different from the one reported in our paper. 64 | 65 | Saliency Map 66 | --- 67 | ECCV 2018: The saliency maps on 7 datasets are available at [Baidu drive](https://pan.baidu.com/s/1fG-LO48CwZOeFIqH2Xvc2Q)(zin5) and [Google drive](https://drive.google.com/open?id=1OTgOYlZoTOFOIHwxEDBYkZbAS7L3UKcP).
68 | TIP 2020: The saliency maps on 6 datasets are available at [Google drive](https://drive.google.com/open?id=16FRhqXEhtWQ8dJh8TzaY-C182TdsAfFQ).
69 | 70 | Reference 71 | --- 72 | [1] Hou, Q., Cheng, M.M., Hu, X., Borji, A., Tu, Z., Torr, P.: Deeply supervised 73 | salient object detection with short connections. In: CVPR. (2017) 5300–5309. 74 | -------------------------------------------------------------------------------- /deploy.prototxt: -------------------------------------------------------------------------------- 1 | ### RAS ### 2 | name: "RAS" 3 | input: "data" 4 | input_dim: 1 5 | input_dim: 3 6 | input_dim: 500 7 | input_dim: 500 8 | 9 | layer { bottom: 'data' top: 'conv1_1' name: 'conv1_1' type: "Convolution" 10 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 11 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 } } 12 | layer { bottom: 'conv1_1' top: 'conv1_1' name: 'relu1_1' type: "ReLU" } 13 | layer { bottom: 'conv1_1' top: 'conv1_2' name: 'conv1_2' type: "Convolution" 14 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 15 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 } } 16 | layer { bottom: 'conv1_2' top: 'conv1_2' name: 'relu1_2' type: "ReLU" } 17 | layer { name: 'pool1' bottom: 'conv1_2' top: 'pool1' type: "Pooling" 18 | pooling_param { pool: MAX kernel_size: 2 stride: 2 } } 19 | 20 | layer { name: 'conv2_1' bottom: 'pool1' top: 'conv2_1' type: "Convolution" 21 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 22 | convolution_param { engine: CUDNN num_output: 128 pad: 1 kernel_size: 3 } } 23 | layer { bottom: 'conv2_1' top: 'conv2_1' name: 'relu2_1' type: "ReLU" } 24 | layer { bottom: 'conv2_1' top: 'conv2_2' name: 'conv2_2' type: "Convolution" 25 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 26 | convolution_param { engine: CUDNN num_output: 128 pad: 1 kernel_size: 3 } } 27 | layer { bottom: 'conv2_2' top: 'conv2_2' name: 'relu2_2' type: "ReLU" } 28 | layer { bottom: 'conv2_2' top: 'pool2' name: 'pool2' type: "Pooling" 29 | pooling_param { pool: MAX kernel_size: 2 stride: 2 } } 30 | 31 | layer { bottom: 'pool2' top: 'conv3_1' name: 'conv3_1' type: "Convolution" 32 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 33 | convolution_param { engine: CUDNN num_output: 256 pad: 1 kernel_size: 3 } } 34 | layer { bottom: 'conv3_1' top: 'conv3_1' name: 'relu3_1' type: "ReLU" } 35 | layer { bottom: 'conv3_1' top: 'conv3_2' name: 'conv3_2' type: "Convolution" 36 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 37 | convolution_param { engine: CUDNN num_output: 256 pad: 1 kernel_size: 3 } } 38 | layer { bottom: 'conv3_2' top: 'conv3_2' name: 'relu3_2' type: "ReLU" } 39 | layer { bottom: 'conv3_2' top: 'conv3_3' name: 'conv3_3' type: "Convolution" 40 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 41 | convolution_param { engine: CUDNN num_output: 256 pad: 1 kernel_size: 3 } } 42 | layer { bottom: 'conv3_3' top: 'conv3_3' name: 'relu3_3' type: "ReLU" } 43 | layer { bottom: 'conv3_3' top: 'pool3' name: 'pool3' type: "Pooling" 44 | pooling_param { pool: MAX kernel_size: 2 stride: 2 } } 45 | 46 | layer { bottom: 'pool3' top: 'conv4_1' name: 'conv4_1' type: "Convolution" 47 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 48 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 49 | layer { bottom: 'conv4_1' top: 'conv4_1' name: 'relu4_1' type: "ReLU" } 50 | layer { bottom: 'conv4_1' top: 'conv4_2' name: 'conv4_2' type: "Convolution" 51 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 52 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 53 | layer { bottom: 'conv4_2' top: 'conv4_2' name: 'relu4_2' type: "ReLU" } 54 | layer { bottom: 'conv4_2' top: 'conv4_3' name: 'conv4_3' type: "Convolution" 55 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 56 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 57 | layer { bottom: 'conv4_3' top: 'conv4_3' name: 'relu4_3' type: "ReLU" } 58 | layer { bottom: 'conv4_3' top: 'pool4' name: 'pool4' type: "Pooling" 59 | pooling_param { pool: MAX kernel_size: 3 stride: 2 pad: 1 } } 60 | 61 | layer { bottom: 'pool4' top: 'conv5_1' name: 'conv5_1' type: "Convolution" 62 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 63 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 64 | layer { bottom: 'conv5_1' top: 'conv5_1' name: 'relu5_1' type: "ReLU" } 65 | layer { bottom: 'conv5_1' top: 'conv5_2' name: 'conv5_2' type: "Convolution" 66 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 67 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 68 | layer { bottom: 'conv5_2' top: 'conv5_2' name: 'relu5_2' type: "ReLU" } 69 | layer { bottom: 'conv5_2' top: 'conv5_3' name: 'conv5_3' type: "Convolution" 70 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 71 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 72 | layer { bottom: 'conv5_3' top: 'conv5_3' name: 'relu5_3' type: "ReLU" } 73 | layer { bottom: 'conv5_3' top: 'pool5' name: 'pool5' type: "Pooling" 74 | pooling_param { pool: MAX kernel_size: 3 stride: 2 pad: 1 } } 75 | 76 | ### DSN conv 6 ### 77 | layer { name: 'conv1-dsn6' type: "Convolution" bottom: 'pool5' top: 'conv1-dsn6' 78 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 79 | convolution_param { engine: CUDNN num_output: 256 kernel_size: 1 80 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 81 | layer { name: 'conv2-dsn6' type: "Convolution" bottom: 'conv1-dsn6' top: 'conv2-dsn6' 82 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 83 | convolution_param { engine: CUDNN num_output: 256 pad: 2 kernel_size: 5 84 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 85 | layer { bottom: 'conv2-dsn6' top: 'conv2-dsn6' name: 'relu1-dsn6' type: "ReLU" } 86 | layer { name: 'conv3-dsn6' type: "Convolution" bottom: 'conv2-dsn6' top: 'conv3-dsn6' 87 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 88 | convolution_param { engine: CUDNN num_output: 256 pad: 2 kernel_size: 5 89 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 90 | layer { bottom: 'conv3-dsn6' top: 'conv3-dsn6' name: 'relu2-dsn6' type: "ReLU" } 91 | layer { name: 'conv4-dsn6' type: "Convolution" bottom: 'conv3-dsn6' top: 'conv4-dsn6' 92 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 93 | convolution_param { engine: CUDNN num_output: 256 pad: 2 kernel_size: 5 94 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 95 | layer { bottom: 'conv4-dsn6' top: 'conv4-dsn6' name: 'relu3-dsn6' type: "ReLU" } 96 | layer { name: 'conv5-dsn6' type: "Convolution" bottom: 'conv4-dsn6' top: 'conv5-dsn6' 97 | param { lr_mult: 0.1 decay_mult: 1 } param { lr_mult: 0.2 decay_mult: 0 } 98 | convolution_param { engine: CUDNN num_output: 1 kernel_size: 1 99 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 100 | 101 | layer { type: "Deconvolution" name: 'upsample32_dsn6' bottom: 'conv5-dsn6' top: 'conv5-dsn6-up' 102 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 103 | convolution_param { kernel_size: 64 stride: 32 num_output: 1 } } 104 | layer { type: "Crop" name: 'crop-dsn6' bottom: 'conv5-dsn6-up' bottom: 'data' top: 'upscore-dsn6' } 105 | layer { type: "Sigmoid" name: "sigmoid-score6" bottom: "upscore-dsn6" top: "sigmoid-score6" } 106 | 107 | ### DSN conv 5 ### 108 | layer { type: "Deconvolution" name: 'upsample2_dsn5' bottom: 'conv5-dsn6' top: 'conv5-dsn6-5' 109 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 110 | convolution_param { kernel_size: 4 stride: 2 num_output: 1 } } 111 | layer { type: "Crop" name: 'crop1-dsn5' bottom: 'conv5-dsn6-5' bottom: 'conv5_3' top: 'weight-dsn6-5' } 112 | layer { type: "Sigmoid" name: "sigmoid-dsn5" bottom: "weight-dsn6-5" top: "sigmoid-dsn5" } 113 | layer { name: "rev-dsn5" type: "Power" bottom: 'sigmoid-dsn5' top: 'rev-dsn5' 114 | power_param { power: 1 scale: -1 shift: 1 } } 115 | layer { type: "Tile" name: "tile-dsn5" bottom: 'rev-dsn5' top: 'weight-dsn5' 116 | tile_param { tiles: 512 } } 117 | layer { type: "Eltwise" name: "prod1-dsn5" bottom: 'conv5_3' bottom: 'weight-dsn5' 118 | top: 'prod1-dsn5' eltwise_param { operation: PROD } } 119 | 120 | layer { name: 'conv1-dsn5' type: "Convolution" bottom: 'prod1-dsn5' top: 'conv1-dsn5' 121 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 122 | convolution_param { engine: CUDNN num_output: 64 kernel_size: 1 123 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 124 | 125 | layer { name: 'conv2-dsn5' type: "Convolution" bottom: 'conv1-dsn5' top: 'conv2-dsn5' 126 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 127 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 128 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 129 | layer { bottom: 'conv2-dsn5' top: 'conv2-dsn5' name: 'relu1-dsn5' type: "ReLU" } 130 | layer { name: 'conv3-dsn5' type: "Convolution" bottom: 'conv2-dsn5' top: 'conv3-dsn5' 131 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 132 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 133 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 134 | layer { bottom: 'conv3-dsn5' top: 'conv3-dsn5' name: 'relu2-dsn5' type: "ReLU" } 135 | 136 | layer { name: 'conv4-dsn5' type: "Convolution" bottom: 'conv3-dsn5' top: 'conv4-dsn5' 137 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 138 | convolution_param { engine: CUDNN num_output: 1 pad: 1 kernel_size: 3 139 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 140 | layer { type: "Eltwise" name: "sum-dsn5" bottom: 'conv4-dsn5' bottom: 'weight-dsn6-5' 141 | top: 'sum-dsn5' eltwise_param { operation: SUM } } 142 | layer { type: "Deconvolution" name: 'upsample16_dsn5' bottom: 'sum-dsn5' top: 'sum-dsn5-up' 143 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 144 | convolution_param { kernel_size: 32 stride: 16 num_output: 1 } } 145 | layer { type: "Crop" name: 'crop2-dsn5' bottom: 'sum-dsn5-up' bottom: 'data' top: 'upscore-dsn5' } 146 | layer { type: "Sigmoid" name: "sigmoid-score5" bottom: "upscore-dsn5" top: "sigmoid-score5" } 147 | 148 | ### DSN conv 4 ### 149 | layer { type: "Deconvolution" name: 'upsample2_dsn4' bottom: 'sum-dsn5' top: 'sum-dsn5-4' 150 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 151 | convolution_param { kernel_size: 4 stride: 2 num_output: 1 } } 152 | layer { type: "Crop" name: 'crop1-dsn4' bottom: 'sum-dsn5-4' bottom: 'conv4_3' top: 'weight-dsn5-4' } 153 | layer { type: "Sigmoid" name: "sigmoid-dsn4" bottom: "weight-dsn5-4" top: "sigmoid-dsn4" } 154 | layer { name: "rev-dsn4" type: "Power" bottom: 'sigmoid-dsn4' top: 'rev-dsn4' 155 | power_param { power: 1 scale: -1 shift: 1 } } 156 | layer { type: "Tile" name: "tile-dsn4" bottom: 'rev-dsn4' top: 'weight-dsn4' 157 | tile_param { tiles: 512 } } 158 | layer { type: "Eltwise" name: "prod1-dsn4" bottom: 'conv4_3' bottom: 'weight-dsn4' 159 | top: 'prod1-dsn4' eltwise_param { operation: PROD } } 160 | 161 | layer { name: 'conv1-dsn4' type: "Convolution" bottom: 'prod1-dsn4' top: 'conv1-dsn4' 162 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 163 | convolution_param { engine: CUDNN num_output: 64 kernel_size: 1 164 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 165 | 166 | layer { name: 'conv2-dsn4' type: "Convolution" bottom: 'conv1-dsn4' top: 'conv2-dsn4' 167 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 168 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 169 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 170 | layer { bottom: 'conv2-dsn4' top: 'conv2-dsn4' name: 'relu1-dsn4' type: "ReLU" } 171 | layer { name: 'conv3-dsn4' type: "Convolution" bottom: 'conv2-dsn4' top: 'conv3-dsn4' 172 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 173 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 174 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 175 | layer { bottom: 'conv3-dsn4' top: 'conv3-dsn4' name: 'relu2-dsn4' type: "ReLU" } 176 | 177 | layer { name: 'conv4-dsn4' type: "Convolution" bottom: 'conv3-dsn4' top: 'conv4-dsn4' 178 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 179 | convolution_param { engine: CUDNN num_output: 1 pad: 1 kernel_size: 3 180 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 181 | layer { type: "Eltwise" name: "sum-dsn4" bottom: 'conv4-dsn4' bottom: 'weight-dsn5-4' 182 | top: 'sum-dsn4' eltwise_param { operation: SUM } } 183 | layer { type: "Deconvolution" name: 'upsample8_dsn4' bottom: 'sum-dsn4' top: 'sum-dsn4-up' 184 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 185 | convolution_param { kernel_size: 16 stride: 8 num_output: 1 } } 186 | layer { type: "Crop" name: 'crop2-dsn4' bottom: 'sum-dsn4-up' bottom: 'data' top: 'upscore-dsn4' } 187 | layer { type: "Sigmoid" name: "sigmoid-score4" bottom: "upscore-dsn4" top: "sigmoid-score4" } 188 | 189 | ### DSN conv 3 ### 190 | layer { type: "Deconvolution" name: 'upsample2_dsn3' bottom: 'sum-dsn4' top: 'sum-dsn4-3' 191 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 192 | convolution_param { kernel_size: 4 stride: 2 num_output: 1 } } 193 | layer { type: "Crop" name: 'crop1-dsn3' bottom: 'sum-dsn4-3' bottom: 'conv3_3' top: 'weight-dsn4-3' } 194 | layer { type: "Sigmoid" name: "sigmoid-dsn3" bottom: "weight-dsn4-3" top: "sigmoid-dsn3" } 195 | layer { name: "rev-dsn3" type: "Power" bottom: 'sigmoid-dsn3' top: 'rev-dsn3' 196 | power_param { power: 1 scale: -1 shift: 1 } } 197 | layer { type: "Tile" name: "tile-dsn3" bottom: 'rev-dsn3' top: 'weight-dsn3' 198 | tile_param { tiles: 256 } } 199 | layer { type: "Eltwise" name: "prod1-dsn3" bottom: 'conv3_3' bottom: 'weight-dsn3' 200 | top: 'prod1-dsn3' eltwise_param { operation: PROD } } 201 | 202 | layer { name: 'conv1-dsn3' type: "Convolution" bottom: 'prod1-dsn3' top: 'conv1-dsn3' 203 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 204 | convolution_param { engine: CUDNN num_output: 64 kernel_size: 1 205 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 206 | 207 | layer { name: 'conv2-dsn3' type: "Convolution" bottom: 'conv1-dsn3' top: 'conv2-dsn3' 208 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 209 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 210 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 211 | layer { bottom: 'conv2-dsn3' top: 'conv2-dsn3' name: 'relu1-dsn3' type: "ReLU" } 212 | layer { name: 'conv3-dsn3' type: "Convolution" bottom: 'conv2-dsn3' top: 'conv3-dsn3' 213 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 214 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 215 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 216 | layer { bottom: 'conv3-dsn3' top: 'conv3-dsn3' name: 'relu2-dsn3' type: "ReLU" } 217 | 218 | layer { name: 'conv4-dsn3' type: "Convolution" bottom: 'conv3-dsn3' top: 'conv4-dsn3' 219 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 220 | convolution_param { engine: CUDNN num_output: 1 pad: 1 kernel_size: 3 221 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 222 | layer { type: "Eltwise" name: "sum-dsn3" bottom: 'conv4-dsn3' bottom: 'weight-dsn4-3' 223 | top: 'sum-dsn3' eltwise_param { operation: SUM } } 224 | layer { type: "Deconvolution" name: 'upsample4_dsn3' bottom: 'sum-dsn3' top: 'sum-dsn3-up' 225 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 226 | convolution_param { kernel_size: 8 stride: 4 num_output: 1 } } 227 | layer { type: "Crop" name: 'crop2-dsn3' bottom: 'sum-dsn3-up' bottom: 'data' top: 'upscore-dsn3' } 228 | layer { type: "Sigmoid" name: "sigmoid-score3" bottom: "upscore-dsn3" top: "sigmoid-score3" } 229 | 230 | ### DSN conv 2 ### 231 | layer { type: "Deconvolution" name: 'upsample2_1-dsn2' bottom: 'sum-dsn3' top: 'sum-dsn3-2' 232 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 233 | convolution_param { kernel_size: 4 stride: 2 num_output: 1 } } 234 | layer { type: "Crop" name: 'crop1-dsn2' bottom: 'sum-dsn3-2' bottom: 'conv2_2' top: 'weight-dsn3-2' } 235 | layer { type: "Sigmoid" name: "sigmoid-dsn2" bottom: "weight-dsn3-2" top: "sigmoid-dsn2" } 236 | layer { name: "rev-dsn2" type: "Power" bottom: 'sigmoid-dsn2' top: 'rev-dsn2' 237 | power_param { power: 1 scale: -1 shift: 1 } } 238 | layer { type: "Tile" name: "tile-dsn2" bottom: 'rev-dsn2' top: 'weight-dsn2' 239 | tile_param { tiles: 128 } } 240 | layer { type: "Eltwise" name: "prod1-dsn2" bottom: 'conv2_2' bottom: 'weight-dsn2' 241 | top: 'prod1-dsn2' eltwise_param { operation: PROD } } 242 | 243 | layer { name: 'conv1-dsn2' type: "Convolution" bottom: 'prod1-dsn2' top: 'conv1-dsn2' 244 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 245 | convolution_param { engine: CUDNN num_output: 64 kernel_size: 1 246 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 247 | 248 | layer { name: 'conv2-dsn2' type: "Convolution" bottom: 'conv1-dsn2' top: 'conv2-dsn2' 249 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 250 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 251 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 252 | layer { bottom: 'conv2-dsn2' top: 'conv2-dsn2' name: 'relu1-dsn2' type: "ReLU" } 253 | layer { name: 'conv3-dsn2' type: "Convolution" bottom: 'conv2-dsn2' top: 'conv3-dsn2' 254 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 255 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 256 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 257 | layer { bottom: 'conv3-dsn2' top: 'conv3-dsn2' name: 'relu2-dsn2' type: "ReLU" } 258 | 259 | layer { name: 'conv4-dsn2' type: "Convolution" bottom: 'conv3-dsn2' top: 'conv4-dsn2' 260 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 261 | convolution_param { engine: CUDNN num_output: 1 pad: 1 kernel_size: 3 262 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 263 | layer { type: "Eltwise" name: "sum-dsn2" bottom: 'conv4-dsn2' bottom: 'weight-dsn3-2' 264 | top: 'sum-dsn2' eltwise_param { operation: SUM } } 265 | layer { type: "Deconvolution" name: 'upsample2_2-dsn2' bottom: 'sum-dsn2' top: 'sum-dsn2-up' 266 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 267 | convolution_param { kernel_size: 4 stride: 2 num_output: 1 } } 268 | layer { type: "Crop" name: 'crop2-dsn2' bottom: 'sum-dsn2-up' bottom: 'data' top: 'upscore-dsn2' } 269 | layer { type: "Sigmoid" name: "sigmoid-score2" bottom: "upscore-dsn2" top: "sigmoid-score2" } 270 | 271 | ### DSN conv 1 ### 272 | layer { type: "Sigmoid" name: "sigmoid-dsn1" bottom: "upscore-dsn2" top: "sigmoid-dsn1" } 273 | layer { name: "rev-dsn1" type: "Power" bottom: 'sigmoid-dsn1' top: 'rev-dsn1' 274 | power_param { power: 1 scale: -1 shift: 1 } } 275 | layer { type: "Tile" name: "tile-dsn1" bottom: 'rev-dsn1' top: 'weight-dsn1' 276 | tile_param { tiles: 64 } } 277 | layer { type: "Eltwise" name: "prod1-dsn1" bottom: 'conv1_2' bottom: 'weight-dsn1' 278 | top: 'prod1-dsn1' eltwise_param { operation: PROD } } 279 | 280 | layer { name: 'conv1-dsn1' type: "Convolution" bottom: 'prod1-dsn1' top: 'conv1-dsn1' 281 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 282 | convolution_param { engine: CUDNN num_output: 64 kernel_size: 1 283 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 284 | 285 | layer { name: 'conv2-dsn1' type: "Convolution" bottom: 'conv1-dsn1' top: 'conv2-dsn1' 286 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 287 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 288 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 289 | layer { bottom: 'conv2-dsn1' top: 'conv2-dsn1' name: 'relu1-dsn1' type: "ReLU" } 290 | layer { name: 'conv3-dsn1' type: "Convolution" bottom: 'conv2-dsn1' top: 'conv3-dsn1' 291 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 292 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 293 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 294 | layer { bottom: 'conv3-dsn1' top: 'conv3-dsn1' name: 'relu2-dsn1' type: "ReLU" } 295 | 296 | layer { name: 'conv4-dsn1' type: "Convolution" bottom: 'conv3-dsn1' top: 'conv4-dsn1' 297 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 298 | convolution_param { engine: CUDNN num_output: 1 pad: 1 kernel_size: 3 299 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 300 | layer { type: "Eltwise" name: "sum-dsn1" bottom: 'conv4-dsn1' bottom: 'upscore-dsn2' 301 | top: 'sum-dsn1' eltwise_param { operation: SUM } } 302 | layer { type: "Crop" name: 'crop2-dsn1' bottom: 'sum-dsn1' bottom: 'data' top: 'upscore-dsn1' } 303 | layer { type: "Sigmoid" name: "sigmoid-score1" bottom: "upscore-dsn1" top: "sigmoid-score1" } -------------------------------------------------------------------------------- /solve.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | import numpy as np 3 | import sys 4 | caffe_root = '../../' 5 | sys.path.insert(0, caffe_root + 'python') 6 | import caffe 7 | 8 | def upsample_filt(size): 9 | factor = (size + 1) // 2 10 | if size % 2 == 1: 11 | center = factor - 1 12 | else: 13 | center = factor - 0.5 14 | og = np.ogrid[:size, :size] 15 | return (1 - abs(og[0] - center) / factor) * \ 16 | (1 - abs(og[1] - center) / factor) 17 | 18 | # set parameters s.t. deconvolutional layers compute bilinear interpolation 19 | # N.B. this is for deconvolution without groups 20 | def interp_surgery(net, layers): 21 | for l in layers: 22 | m, k, h, w = net.params[l][0].data.shape 23 | if m != k: 24 | print 'input + output channels need to be the same' 25 | raise 26 | if h != w: 27 | print 'filters need to be square' 28 | raise 29 | filt = upsample_filt(h) 30 | net.params[l][0].data[range(m), range(k), :, :] = filt 31 | 32 | base_weights = 'vgg16.caffemodel' # the vgg16 model 33 | 34 | # init 35 | caffe.set_mode_gpu() 36 | caffe.set_device(0) 37 | 38 | solver = caffe.SGDSolver('solver.prototxt') 39 | 40 | # do net surgery to set the deconvolution weights for bilinear interpolation 41 | interp_layers = [k for k in solver.net.params.keys() if 'up' in k] 42 | interp_surgery(solver.net, interp_layers) 43 | 44 | # copy base weights for fine-tuning 45 | solver.net.copy_from(base_weights) 46 | solver.step(10000) 47 | -------------------------------------------------------------------------------- /solver.prototxt: -------------------------------------------------------------------------------- 1 | train_net: "train.prototxt" 2 | # lr for fine-tuning should be lower than when starting from scratch 3 | #debug_info: true 4 | base_lr: 1e-8 5 | lr_policy: "step" 6 | #power: 0.9 7 | gamma: 0.1 8 | iter_size: 10 9 | # stepsize should also be lower, as we're closer to being done 10 | stepsize: 7500 11 | average_loss: 20 12 | display: 20 13 | max_iter: 10000 14 | momentum: 0.90 15 | weight_decay: 0.0005 16 | snapshot: 2500 17 | snapshot_prefix: "snapshot/ras" 18 | # uncomment the following to default to CPU mode solving 19 | # solver_mode: CPU 20 | 21 | -------------------------------------------------------------------------------- /train.prototxt: -------------------------------------------------------------------------------- 1 | ### RAS ### 2 | name: "RAS" 3 | layer { 4 | name: "data" 5 | type: "ImageLabelmapData" 6 | top: "data" 7 | top: "label" 8 | include { phase: TRAIN } 9 | transform_param { 10 | mirror: true 11 | mean_value: 104.00699 12 | mean_value: 116.66877 13 | mean_value: 122.67892 14 | } 15 | image_data_param { 16 | root_folder: "/home/shuhan/datasets/MSRA-5000/" 17 | source: "../../data/msra_b/train.lst" 18 | batch_size: 1 19 | shuffle: true 20 | normalize: true 21 | } 22 | } 23 | 24 | layer { bottom: 'data' top: 'conv1_1' name: 'conv1_1' type: "Convolution" 25 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 26 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 } } 27 | layer { bottom: 'conv1_1' top: 'conv1_1' name: 'relu1_1' type: "ReLU" } 28 | layer { bottom: 'conv1_1' top: 'conv1_2' name: 'conv1_2' type: "Convolution" 29 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 30 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 } } 31 | layer { bottom: 'conv1_2' top: 'conv1_2' name: 'relu1_2' type: "ReLU" } 32 | layer { name: 'pool1' bottom: 'conv1_2' top: 'pool1' type: "Pooling" 33 | pooling_param { pool: MAX kernel_size: 2 stride: 2 } } 34 | 35 | layer { name: 'conv2_1' bottom: 'pool1' top: 'conv2_1' type: "Convolution" 36 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 37 | convolution_param { engine: CUDNN num_output: 128 pad: 1 kernel_size: 3 } } 38 | layer { bottom: 'conv2_1' top: 'conv2_1' name: 'relu2_1' type: "ReLU" } 39 | layer { bottom: 'conv2_1' top: 'conv2_2' name: 'conv2_2' type: "Convolution" 40 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 41 | convolution_param { engine: CUDNN num_output: 128 pad: 1 kernel_size: 3 } } 42 | layer { bottom: 'conv2_2' top: 'conv2_2' name: 'relu2_2' type: "ReLU" } 43 | layer { bottom: 'conv2_2' top: 'pool2' name: 'pool2' type: "Pooling" 44 | pooling_param { pool: MAX kernel_size: 2 stride: 2 } } 45 | 46 | layer { bottom: 'pool2' top: 'conv3_1' name: 'conv3_1' type: "Convolution" 47 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 48 | convolution_param { engine: CUDNN num_output: 256 pad: 1 kernel_size: 3 } } 49 | layer { bottom: 'conv3_1' top: 'conv3_1' name: 'relu3_1' type: "ReLU" } 50 | layer { bottom: 'conv3_1' top: 'conv3_2' name: 'conv3_2' type: "Convolution" 51 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 52 | convolution_param { engine: CUDNN num_output: 256 pad: 1 kernel_size: 3 } } 53 | layer { bottom: 'conv3_2' top: 'conv3_2' name: 'relu3_2' type: "ReLU" } 54 | layer { bottom: 'conv3_2' top: 'conv3_3' name: 'conv3_3' type: "Convolution" 55 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 56 | convolution_param { engine: CUDNN num_output: 256 pad: 1 kernel_size: 3 } } 57 | layer { bottom: 'conv3_3' top: 'conv3_3' name: 'relu3_3' type: "ReLU" } 58 | layer { bottom: 'conv3_3' top: 'pool3' name: 'pool3' type: "Pooling" 59 | pooling_param { pool: MAX kernel_size: 2 stride: 2 } } 60 | 61 | layer { bottom: 'pool3' top: 'conv4_1' name: 'conv4_1' type: "Convolution" 62 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 63 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 64 | layer { bottom: 'conv4_1' top: 'conv4_1' name: 'relu4_1' type: "ReLU" } 65 | layer { bottom: 'conv4_1' top: 'conv4_2' name: 'conv4_2' type: "Convolution" 66 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 67 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 68 | layer { bottom: 'conv4_2' top: 'conv4_2' name: 'relu4_2' type: "ReLU" } 69 | layer { bottom: 'conv4_2' top: 'conv4_3' name: 'conv4_3' type: "Convolution" 70 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 71 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 72 | layer { bottom: 'conv4_3' top: 'conv4_3' name: 'relu4_3' type: "ReLU" } 73 | layer { bottom: 'conv4_3' top: 'pool4' name: 'pool4' type: "Pooling" 74 | pooling_param { pool: MAX kernel_size: 3 stride: 2 pad: 1 } } 75 | 76 | layer { bottom: 'pool4' top: 'conv5_1' name: 'conv5_1' type: "Convolution" 77 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 78 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 79 | layer { bottom: 'conv5_1' top: 'conv5_1' name: 'relu5_1' type: "ReLU" } 80 | layer { bottom: 'conv5_1' top: 'conv5_2' name: 'conv5_2' type: "Convolution" 81 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 82 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 83 | layer { bottom: 'conv5_2' top: 'conv5_2' name: 'relu5_2' type: "ReLU" } 84 | layer { bottom: 'conv5_2' top: 'conv5_3' name: 'conv5_3' type: "Convolution" 85 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0} 86 | convolution_param { engine: CUDNN num_output: 512 pad: 1 kernel_size: 3 } } 87 | layer { bottom: 'conv5_3' top: 'conv5_3' name: 'relu5_3' type: "ReLU" } 88 | layer { bottom: 'conv5_3' top: 'pool5' name: 'pool5' type: "Pooling" 89 | pooling_param { pool: MAX kernel_size: 3 stride: 2 pad: 1 } } 90 | 91 | ### DSN conv 6 ### 92 | layer { name: 'conv1-dsn6' type: "Convolution" bottom: 'pool5' top: 'conv1-dsn6' 93 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 94 | convolution_param { engine: CUDNN num_output: 256 kernel_size: 1 95 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 96 | layer { name: 'conv2-dsn6' type: "Convolution" bottom: 'conv1-dsn6' top: 'conv2-dsn6' 97 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 98 | convolution_param { engine: CUDNN num_output: 256 pad: 2 kernel_size: 5 99 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 100 | layer { bottom: 'conv2-dsn6' top: 'conv2-dsn6' name: 'relu1-dsn6' type: "ReLU" } 101 | layer { name: 'conv3-dsn6' type: "Convolution" bottom: 'conv2-dsn6' top: 'conv3-dsn6' 102 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 103 | convolution_param { engine: CUDNN num_output: 256 pad: 2 kernel_size: 5 104 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 105 | layer { bottom: 'conv3-dsn6' top: 'conv3-dsn6' name: 'relu2-dsn6' type: "ReLU" } 106 | layer { name: 'conv4-dsn6' type: "Convolution" bottom: 'conv3-dsn6' top: 'conv4-dsn6' 107 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 108 | convolution_param { engine: CUDNN num_output: 256 pad: 2 kernel_size: 5 109 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 110 | layer { bottom: 'conv4-dsn6' top: 'conv4-dsn6' name: 'relu3-dsn6' type: "ReLU" } 111 | layer { name: 'conv5-dsn6' type: "Convolution" bottom: 'conv4-dsn6' top: 'conv5-dsn6' 112 | param { lr_mult: 0.1 decay_mult: 1 } param { lr_mult: 0.2 decay_mult: 0 } 113 | convolution_param { engine: CUDNN num_output: 1 kernel_size: 1 114 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 115 | 116 | layer { type: "Deconvolution" name: 'upsample32_dsn6' bottom: 'conv5-dsn6' top: 'conv5-dsn6-up' 117 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 118 | convolution_param { kernel_size: 64 stride: 32 num_output: 1 } } 119 | layer { type: "Crop" name: 'crop-dsn6' bottom: 'conv5-dsn6-up' bottom: 'data' top: 'upscore-dsn6' } 120 | layer { type: "SigmoidCrossEntropyLoss" bottom: "upscore-dsn6" bottom: "label" top: "loss6-score" 121 | name: "loss6-score" loss_weight: 1 } 122 | 123 | ### DSN conv 5 ### 124 | layer { type: "Deconvolution" name: 'upsample2_dsn5' bottom: 'conv5-dsn6' top: 'conv5-dsn6-5' 125 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 126 | convolution_param { kernel_size: 4 stride: 2 num_output: 1 } } 127 | layer { type: "Crop" name: 'crop1-dsn5' bottom: 'conv5-dsn6-5' bottom: 'conv5_3' top: 'weight-dsn6-5' } 128 | layer { type: "Sigmoid" name: "sigmoid-dsn5" bottom: "weight-dsn6-5" top: "sigmoid-dsn5" } 129 | layer { name: "rev-dsn5" type: "Power" bottom: 'sigmoid-dsn5' top: 'rev-dsn5' 130 | power_param { power: 1 scale: -1 shift: 1 } } 131 | layer { type: "Tile" name: "tile-dsn5" bottom: 'rev-dsn5' top: 'weight-dsn5' 132 | tile_param { tiles: 512 } } 133 | layer { type: "Eltwise" name: "prod1-dsn5" bottom: 'conv5_3' bottom: 'weight-dsn5' 134 | top: 'prod1-dsn5' eltwise_param { operation: PROD } } 135 | 136 | layer { name: 'conv1-dsn5' type: "Convolution" bottom: 'prod1-dsn5' top: 'conv1-dsn5' 137 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 138 | convolution_param { engine: CUDNN num_output: 64 kernel_size: 1 139 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 140 | 141 | layer { name: 'conv2-dsn5' type: "Convolution" bottom: 'conv1-dsn5' top: 'conv2-dsn5' 142 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 143 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 144 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 145 | layer { bottom: 'conv2-dsn5' top: 'conv2-dsn5' name: 'relu1-dsn5' type: "ReLU" } 146 | layer { name: 'conv3-dsn5' type: "Convolution" bottom: 'conv2-dsn5' top: 'conv3-dsn5' 147 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 148 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 149 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 150 | layer { bottom: 'conv3-dsn5' top: 'conv3-dsn5' name: 'relu2-dsn5' type: "ReLU" } 151 | 152 | layer { name: 'conv4-dsn5' type: "Convolution" bottom: 'conv3-dsn5' top: 'conv4-dsn5' 153 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 154 | convolution_param { engine: CUDNN num_output: 1 pad: 1 kernel_size: 3 155 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 156 | layer { type: "Eltwise" name: "sum-dsn5" bottom: 'conv4-dsn5' bottom: 'weight-dsn6-5' 157 | top: 'sum-dsn5' eltwise_param { operation: SUM } } 158 | layer { type: "Deconvolution" name: 'upsample16_dsn5' bottom: 'sum-dsn5' top: 'sum-dsn5-up' 159 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 160 | convolution_param { kernel_size: 32 stride: 16 num_output: 1 } } 161 | layer { type: "Crop" name: 'crop2-dsn5' bottom: 'sum-dsn5-up' bottom: 'data' top: 'upscore-dsn5' } 162 | layer { type: "SigmoidCrossEntropyLoss" bottom: "upscore-dsn5" bottom: "label" top: "loss5-score" 163 | name: "loss5-score" loss_weight: 1 } 164 | 165 | ### DSN conv 4 ### 166 | layer { type: "Deconvolution" name: 'upsample2_dsn4' bottom: 'sum-dsn5' top: 'sum-dsn5-4' 167 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 168 | convolution_param { kernel_size: 4 stride: 2 num_output: 1 } } 169 | layer { type: "Crop" name: 'crop1-dsn4' bottom: 'sum-dsn5-4' bottom: 'conv4_3' top: 'weight-dsn5-4' } 170 | layer { type: "Sigmoid" name: "sigmoid-dsn4" bottom: "weight-dsn5-4" top: "sigmoid-dsn4" } 171 | layer { name: "rev-dsn4" type: "Power" bottom: 'sigmoid-dsn4' top: 'rev-dsn4' 172 | power_param { power: 1 scale: -1 shift: 1 } } 173 | layer { type: "Tile" name: "tile-dsn4" bottom: 'rev-dsn4' top: 'weight-dsn4' 174 | tile_param { tiles: 512 } } 175 | layer { type: "Eltwise" name: "prod1-dsn4" bottom: 'conv4_3' bottom: 'weight-dsn4' 176 | top: 'prod1-dsn4' eltwise_param { operation: PROD } } 177 | 178 | layer { name: 'conv1-dsn4' type: "Convolution" bottom: 'prod1-dsn4' top: 'conv1-dsn4' 179 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 180 | convolution_param { engine: CUDNN num_output: 64 kernel_size: 1 181 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 182 | 183 | layer { name: 'conv2-dsn4' type: "Convolution" bottom: 'conv1-dsn4' top: 'conv2-dsn4' 184 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 185 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 186 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 187 | layer { bottom: 'conv2-dsn4' top: 'conv2-dsn4' name: 'relu1-dsn4' type: "ReLU" } 188 | layer { name: 'conv3-dsn4' type: "Convolution" bottom: 'conv2-dsn4' top: 'conv3-dsn4' 189 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 190 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 191 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 192 | layer { bottom: 'conv3-dsn4' top: 'conv3-dsn4' name: 'relu2-dsn4' type: "ReLU" } 193 | 194 | layer { name: 'conv4-dsn4' type: "Convolution" bottom: 'conv3-dsn4' top: 'conv4-dsn4' 195 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 196 | convolution_param { engine: CUDNN num_output: 1 pad: 1 kernel_size: 3 197 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 198 | layer { type: "Eltwise" name: "sum-dsn4" bottom: 'conv4-dsn4' bottom: 'weight-dsn5-4' 199 | top: 'sum-dsn4' eltwise_param { operation: SUM } } 200 | layer { type: "Deconvolution" name: 'upsample8_dsn4' bottom: 'sum-dsn4' top: 'sum-dsn4-up' 201 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 202 | convolution_param { kernel_size: 16 stride: 8 num_output: 1 } } 203 | layer { type: "Crop" name: 'crop2-dsn4' bottom: 'sum-dsn4-up' bottom: 'data' top: 'upscore-dsn4' } 204 | layer { type: "SigmoidCrossEntropyLoss" bottom: "upscore-dsn4" bottom: "label" top: "loss4-score" 205 | name: "loss4-score" loss_weight: 1 } 206 | 207 | ### DSN conv 3 ### 208 | layer { type: "Deconvolution" name: 'upsample2_dsn3' bottom: 'sum-dsn4' top: 'sum-dsn4-3' 209 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 210 | convolution_param { kernel_size: 4 stride: 2 num_output: 1 } } 211 | layer { type: "Crop" name: 'crop1-dsn3' bottom: 'sum-dsn4-3' bottom: 'conv3_3' top: 'weight-dsn4-3' } 212 | layer { type: "Sigmoid" name: "sigmoid-dsn3" bottom: "weight-dsn4-3" top: "sigmoid-dsn3" } 213 | layer { name: "rev-dsn3" type: "Power" bottom: 'sigmoid-dsn3' top: 'rev-dsn3' 214 | power_param { power: 1 scale: -1 shift: 1 } } 215 | layer { type: "Tile" name: "tile-dsn3" bottom: 'rev-dsn3' top: 'weight-dsn3' 216 | tile_param { tiles: 256 } } 217 | layer { type: "Eltwise" name: "prod1-dsn3" bottom: 'conv3_3' bottom: 'weight-dsn3' 218 | top: 'prod1-dsn3' eltwise_param { operation: PROD } } 219 | 220 | layer { name: 'conv1-dsn3' type: "Convolution" bottom: 'prod1-dsn3' top: 'conv1-dsn3' 221 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 222 | convolution_param { engine: CUDNN num_output: 64 kernel_size: 1 223 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 224 | 225 | layer { name: 'conv2-dsn3' type: "Convolution" bottom: 'conv1-dsn3' top: 'conv2-dsn3' 226 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 227 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 228 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 229 | layer { bottom: 'conv2-dsn3' top: 'conv2-dsn3' name: 'relu1-dsn3' type: "ReLU" } 230 | layer { name: 'conv3-dsn3' type: "Convolution" bottom: 'conv2-dsn3' top: 'conv3-dsn3' 231 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 232 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 233 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 234 | layer { bottom: 'conv3-dsn3' top: 'conv3-dsn3' name: 'relu2-dsn3' type: "ReLU" } 235 | 236 | layer { name: 'conv4-dsn3' type: "Convolution" bottom: 'conv3-dsn3' top: 'conv4-dsn3' 237 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 238 | convolution_param { engine: CUDNN num_output: 1 pad: 1 kernel_size: 3 239 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 240 | layer { type: "Eltwise" name: "sum-dsn3" bottom: 'conv4-dsn3' bottom: 'weight-dsn4-3' 241 | top: 'sum-dsn3' eltwise_param { operation: SUM } } 242 | layer { type: "Deconvolution" name: 'upsample4_dsn3' bottom: 'sum-dsn3' top: 'sum-dsn3-up' 243 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 244 | convolution_param { kernel_size: 8 stride: 4 num_output: 1 } } 245 | layer { type: "Crop" name: 'crop2-dsn3' bottom: 'sum-dsn3-up' bottom: 'data' top: 'upscore-dsn3' } 246 | layer { type: "SigmoidCrossEntropyLoss" bottom: "upscore-dsn3" bottom: "label" top: "loss3-score" 247 | name: "loss3-score" loss_weight: 1 } 248 | 249 | ### DSN conv 2 ### 250 | layer { type: "Deconvolution" name: 'upsample2_1-dsn2' bottom: 'sum-dsn3' top: 'sum-dsn3-2' 251 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 252 | convolution_param { kernel_size: 4 stride: 2 num_output: 1 } } 253 | layer { type: "Crop" name: 'crop1-dsn2' bottom: 'sum-dsn3-2' bottom: 'conv2_2' top: 'weight-dsn3-2' } 254 | layer { type: "Sigmoid" name: "sigmoid-dsn2" bottom: "weight-dsn3-2" top: "sigmoid-dsn2" } 255 | layer { name: "rev-dsn2" type: "Power" bottom: 'sigmoid-dsn2' top: 'rev-dsn2' 256 | power_param { power: 1 scale: -1 shift: 1 } } 257 | layer { type: "Tile" name: "tile-dsn2" bottom: 'rev-dsn2' top: 'weight-dsn2' 258 | tile_param { tiles: 128 } } 259 | layer { type: "Eltwise" name: "prod1-dsn2" bottom: 'conv2_2' bottom: 'weight-dsn2' 260 | top: 'prod1-dsn2' eltwise_param { operation: PROD } } 261 | 262 | layer { name: 'conv1-dsn2' type: "Convolution" bottom: 'prod1-dsn2' top: 'conv1-dsn2' 263 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 264 | convolution_param { engine: CUDNN num_output: 64 kernel_size: 1 265 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 266 | 267 | layer { name: 'conv2-dsn2' type: "Convolution" bottom: 'conv1-dsn2' top: 'conv2-dsn2' 268 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 269 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 270 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 271 | layer { bottom: 'conv2-dsn2' top: 'conv2-dsn2' name: 'relu1-dsn2' type: "ReLU" } 272 | layer { name: 'conv3-dsn2' type: "Convolution" bottom: 'conv2-dsn2' top: 'conv3-dsn2' 273 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 274 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 275 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 276 | layer { bottom: 'conv3-dsn2' top: 'conv3-dsn2' name: 'relu2-dsn2' type: "ReLU" } 277 | 278 | layer { name: 'conv4-dsn2' type: "Convolution" bottom: 'conv3-dsn2' top: 'conv4-dsn2' 279 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 280 | convolution_param { engine: CUDNN num_output: 1 pad: 1 kernel_size: 3 281 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 282 | layer { type: "Eltwise" name: "sum-dsn2" bottom: 'conv4-dsn2' bottom: 'weight-dsn3-2' 283 | top: 'sum-dsn2' eltwise_param { operation: SUM } } 284 | layer { type: "Deconvolution" name: 'upsample2_2-dsn2' bottom: 'sum-dsn2' top: 'sum-dsn2-up' 285 | param { lr_mult: 0 decay_mult: 1 } param { lr_mult: 0 decay_mult: 0 } 286 | convolution_param { kernel_size: 4 stride: 2 num_output: 1 } } 287 | layer { type: "Crop" name: 'crop2-dsn2' bottom: 'sum-dsn2-up' bottom: 'data' top: 'upscore-dsn2' } 288 | layer { type: "SigmoidCrossEntropyLoss" bottom: "upscore-dsn2" bottom: "label" top: "loss2-score" 289 | name: "loss2-score" loss_weight: 1 } 290 | 291 | ### DSN conv 1 ### 292 | layer { type: "Sigmoid" name: "sigmoid-dsn1" bottom: "upscore-dsn2" top: "sigmoid-dsn1" } 293 | layer { name: "rev-dsn1" type: "Power" bottom: 'sigmoid-dsn1' top: 'rev-dsn1' 294 | power_param { power: 1 scale: -1 shift: 1 } } 295 | layer { type: "Tile" name: "tile-dsn1" bottom: 'rev-dsn1' top: 'weight-dsn1' 296 | tile_param { tiles: 64 } } 297 | layer { type: "Eltwise" name: "prod1-dsn1" bottom: 'conv1_2' bottom: 'weight-dsn1' 298 | top: 'prod1-dsn1' eltwise_param { operation: PROD } } 299 | 300 | layer { name: 'conv1-dsn1' type: "Convolution" bottom: 'prod1-dsn1' top: 'conv1-dsn1' 301 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 302 | convolution_param { engine: CUDNN num_output: 64 kernel_size: 1 303 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 304 | 305 | layer { name: 'conv2-dsn1' type: "Convolution" bottom: 'conv1-dsn1' top: 'conv2-dsn1' 306 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 307 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 308 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 309 | layer { bottom: 'conv2-dsn1' top: 'conv2-dsn1' name: 'relu1-dsn1' type: "ReLU" } 310 | layer { name: 'conv3-dsn1' type: "Convolution" bottom: 'conv2-dsn1' top: 'conv3-dsn1' 311 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 312 | convolution_param { engine: CUDNN num_output: 64 pad: 1 kernel_size: 3 313 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 314 | layer { bottom: 'conv3-dsn1' top: 'conv3-dsn1' name: 'relu2-dsn1' type: "ReLU" } 315 | 316 | layer { name: 'conv4-dsn1' type: "Convolution" bottom: 'conv3-dsn1' top: 'conv4-dsn1' 317 | param { lr_mult: 1 decay_mult: 1 } param { lr_mult: 2 decay_mult: 0 } 318 | convolution_param { engine: CUDNN num_output: 1 pad: 1 kernel_size: 3 319 | weight_filler { type: "gaussian" std: 0.01 } bias_filler { type: "constant" value: 0 } } } 320 | layer { type: "Eltwise" name: "sum-dsn1" bottom: 'conv4-dsn1' bottom: 'upscore-dsn2' 321 | top: 'sum-dsn1' eltwise_param { operation: SUM } } 322 | layer { type: "Crop" name: 'crop2-dsn1' bottom: 'sum-dsn1' bottom: 'data' top: 'upscore-dsn1' } 323 | layer { type: "SigmoidCrossEntropyLoss" bottom: "upscore-dsn1" bottom: "label" top: "loss1-score" 324 | name: "loss1-score" loss_weight: 1 } --------------------------------------------------------------------------------