├── .gitignore ├── MobileNetV2_deploy.prototxt ├── benchmark_mobilenetv2.sh ├── conv_dw_layer.cpp ├── conv_dw_layer.cu ├── conv_dw_layer.hpp └── mobilenet_v2_new.caffemodel ├── LICENSE ├── MobileUnet1by2.prototxt ├── README.md ├── SmallRefineDet_mobilev2_ssdlite.prototxt └── forMobileUNet ├── caffe.proto ├── dice_coef_loss_layer.cpp ├── dice_coef_loss_layer.cu ├── dice_coef_loss_layer.hpp ├── hello.txt ├── resize_layer.cpp ├── resize_layer.cu └── resize_layer.hpp /.gitignore/MobileNetV2_deploy.prototxt: -------------------------------------------------------------------------------- 1 | name: "MOBILENETV2" 2 | 3 | #input: "data" 4 | #input_dim: 1 5 | #input_dim: 3 6 | #input_dim: 224 7 | #input_dim: 224 8 | 9 | layer { 10 | name: "data" 11 | type: "Data" 12 | top: "data" 13 | top: "label" 14 | include { 15 | phase: TEST 16 | } 17 | transform_param { 18 | crop_size: 224 19 | scale: 0.017 20 | mean_value: 103.94 21 | mean_value: 116.78 22 | mean_value: 123.68 23 | } 24 | data_param { 25 | source: "****/ImageNet2012/lmdb/ilsvrc12_val_lmdb" 26 | batch_size: 25 27 | backend: LMDB 28 | } 29 | } 30 | 31 | layer { 32 | name: "conv1_new" 33 | type: "Convolution" 34 | bottom: "data" 35 | top: "conv1_new" 36 | param { 37 | lr_mult: 1 38 | decay_mult: 1 39 | } 40 | convolution_param { 41 | num_output: 32 42 | bias_term: false 43 | pad: 1 44 | kernel_size: 3 45 | stride: 2 46 | weight_filler { 47 | type: "msra" 48 | } 49 | } 50 | } 51 | layer { 52 | name: "conv1/bn_new" 53 | type: "BatchNorm" 54 | bottom: "conv1_new" 55 | top: "conv1_new" 56 | param { 57 | lr_mult: 0 58 | decay_mult: 0 59 | } 60 | param { 61 | lr_mult: 0 62 | decay_mult: 0 63 | } 64 | param { 65 | lr_mult: 0 66 | decay_mult: 0 67 | } 68 | } 69 | layer { 70 | name: "conv1/scale_new" 71 | type: "Scale" 72 | bottom: "conv1_new" 73 | top: "conv1_new" 74 | param { 75 | lr_mult: 1 76 | decay_mult: 0 77 | } 78 | param { 79 | lr_mult: 1 80 | decay_mult: 0 81 | } 82 | scale_param { 83 | filler { 84 | value: 1 85 | } 86 | bias_term: true 87 | bias_filler { 88 | value: 0 89 | } 90 | } 91 | } 92 | layer { 93 | name: "relu1_new" 94 | type: "ReLU" 95 | bottom: "conv1_new" 96 | top: "conv1_new" 97 | } 98 | 99 | ################################################################## 100 | 101 | layer { 102 | name: "conv1_1/in/pw_new" 103 | type: "Convolution" 104 | bottom: "conv1_new" 105 | top: "conv1_1/in/pw_new" 106 | param { 107 | lr_mult: 1 108 | decay_mult: 1 109 | } 110 | convolution_param { 111 | num_output: 32 112 | bias_term: false 113 | pad: 0 114 | kernel_size: 1 115 | engine: CAFFE 116 | stride: 1 117 | weight_filler { 118 | type: "msra" 119 | } 120 | } 121 | } 122 | layer { 123 | name: "conv1_1/in/pw/bn_new" 124 | type: "BatchNorm" 125 | bottom: "conv1_1/in/pw_new" 126 | top: "conv1_1/in/pw_new" 127 | param { 128 | lr_mult: 0 129 | decay_mult: 0 130 | } 131 | param { 132 | lr_mult: 0 133 | decay_mult: 0 134 | } 135 | param { 136 | lr_mult: 0 137 | decay_mult: 0 138 | } 139 | } 140 | layer { 141 | name: "conv1_1/in/pw/scale_new" 142 | type: "Scale" 143 | bottom: "conv1_1/in/pw_new" 144 | top: "conv1_1/in/pw_new" 145 | param { 146 | lr_mult: 1 147 | decay_mult: 0 148 | } 149 | param { 150 | lr_mult: 1 151 | decay_mult: 0 152 | } 153 | scale_param { 154 | filler { 155 | value: 1 156 | } 157 | bias_term: true 158 | bias_filler { 159 | value: 0 160 | } 161 | } 162 | } 163 | layer { 164 | name: "relu1_1/in/pw_new" 165 | type: "ReLU" 166 | bottom: "conv1_1/in/pw_new" 167 | top: "conv1_1/in/pw_new" 168 | } 169 | layer { 170 | name: "conv1_1/dw_new" 171 | type: "ConvolutionDepthwise" 172 | bottom: "conv1_1/in/pw_new" 173 | top: "conv1_1/dw_new" 174 | param { 175 | lr_mult: 1 176 | decay_mult: 1 177 | } 178 | convolution_param { 179 | num_output: 32 180 | bias_term: false 181 | pad: 1 182 | kernel_size: 3 183 | engine: CAFFE 184 | stride: 1 185 | weight_filler { 186 | type: "msra" 187 | } 188 | } 189 | } 190 | layer { 191 | name: "conv1_1/dw/bn_new" 192 | type: "BatchNorm" 193 | bottom: "conv1_1/dw_new" 194 | top: "conv1_1/dw_new" 195 | param { 196 | lr_mult: 0 197 | decay_mult: 0 198 | } 199 | param { 200 | lr_mult: 0 201 | decay_mult: 0 202 | } 203 | param { 204 | lr_mult: 0 205 | decay_mult: 0 206 | } 207 | } 208 | layer { 209 | name: "conv1_1/dw/scale_new" 210 | type: "Scale" 211 | bottom: "conv1_1/dw_new" 212 | top: "conv1_1/dw_new" 213 | param { 214 | lr_mult: 1 215 | decay_mult: 0 216 | } 217 | param { 218 | lr_mult: 1 219 | decay_mult: 0 220 | } 221 | scale_param { 222 | filler { 223 | value: 1 224 | } 225 | bias_term: true 226 | bias_filler { 227 | value: 0 228 | } 229 | } 230 | } 231 | layer { 232 | name: "relu1_1/dw_new" 233 | type: "ReLU" 234 | bottom: "conv1_1/dw_new" 235 | top: "conv1_1/dw_new" 236 | } 237 | layer { 238 | name: "conv1_1/out/pw_new" 239 | type: "Convolution" 240 | bottom: "conv1_1/dw_new" 241 | top: "conv1_1/out/pw_new" 242 | param { 243 | lr_mult: 1 244 | decay_mult: 1 245 | } 246 | convolution_param { 247 | num_output: 16 248 | bias_term: false 249 | pad: 0 250 | kernel_size: 1 251 | engine: CAFFE 252 | stride: 1 253 | weight_filler { 254 | type: "msra" 255 | } 256 | } 257 | } 258 | layer { 259 | name: "conv1_1/out/pw/bn_new" 260 | type: "BatchNorm" 261 | bottom: "conv1_1/out/pw_new" 262 | top: "conv1_1/out/pw_new" 263 | param { 264 | lr_mult: 0 265 | decay_mult: 0 266 | } 267 | param { 268 | lr_mult: 0 269 | decay_mult: 0 270 | } 271 | param { 272 | lr_mult: 0 273 | decay_mult: 0 274 | } 275 | } 276 | layer { 277 | name: "conv1_1/out/pw/scale_new" 278 | type: "Scale" 279 | bottom: "conv1_1/out/pw_new" 280 | top: "conv1_1/out/pw_new" 281 | param { 282 | lr_mult: 1 283 | decay_mult: 0 284 | } 285 | param { 286 | lr_mult: 1 287 | decay_mult: 0 288 | } 289 | scale_param { 290 | filler { 291 | value: 1 292 | } 293 | bias_term: true 294 | bias_filler { 295 | value: 0 296 | } 297 | } 298 | } 299 | ################################################################## 300 | layer { 301 | name: "conv2_1/in/pw_new" 302 | type: "Convolution" 303 | bottom: "conv1_1/out/pw_new" 304 | top: "conv2_1/in/pw_new" 305 | param { 306 | lr_mult: 1 307 | decay_mult: 1 308 | } 309 | convolution_param { 310 | num_output: 96 311 | bias_term: false 312 | pad: 0 313 | kernel_size: 1 314 | engine: CAFFE 315 | stride: 1 316 | weight_filler { 317 | type: "msra" 318 | } 319 | } 320 | } 321 | layer { 322 | name: "conv2_1/in/pw/bn_new" 323 | type: "BatchNorm" 324 | bottom: "conv2_1/in/pw_new" 325 | top: "conv2_1/in/pw_new" 326 | param { 327 | lr_mult: 0 328 | decay_mult: 0 329 | } 330 | param { 331 | lr_mult: 0 332 | decay_mult: 0 333 | } 334 | param { 335 | lr_mult: 0 336 | decay_mult: 0 337 | } 338 | } 339 | layer { 340 | name: "conv2_1/in/pw/scale_new" 341 | type: "Scale" 342 | bottom: "conv2_1/in/pw_new" 343 | top: "conv2_1/in/pw_new" 344 | param { 345 | lr_mult: 1 346 | decay_mult: 0 347 | } 348 | param { 349 | lr_mult: 1 350 | decay_mult: 0 351 | } 352 | scale_param { 353 | filler { 354 | value: 1 355 | } 356 | bias_term: true 357 | bias_filler { 358 | value: 0 359 | } 360 | } 361 | } 362 | layer { 363 | name: "relu2_1/in/pw_new" 364 | type: "ReLU" 365 | bottom: "conv2_1/in/pw_new" 366 | top: "conv2_1/in/pw_new" 367 | } 368 | layer { 369 | name: "conv2_1/dw_new" 370 | type: "ConvolutionDepthwise" 371 | bottom: "conv2_1/in/pw_new" 372 | top: "conv2_1/dw_new" 373 | param { 374 | lr_mult: 1 375 | decay_mult: 1 376 | } 377 | convolution_param { 378 | num_output: 96 379 | bias_term: false 380 | pad: 1 381 | kernel_size: 3 382 | engine: CAFFE 383 | stride: 2 384 | weight_filler { 385 | type: "msra" 386 | } 387 | } 388 | } 389 | layer { 390 | name: "conv2_1/dw/bn_new" 391 | type: "BatchNorm" 392 | bottom: "conv2_1/dw_new" 393 | top: "conv2_1/dw_new" 394 | param { 395 | lr_mult: 0 396 | decay_mult: 0 397 | } 398 | param { 399 | lr_mult: 0 400 | decay_mult: 0 401 | } 402 | param { 403 | lr_mult: 0 404 | decay_mult: 0 405 | } 406 | } 407 | layer { 408 | name: "conv2_1/dw/scale_new" 409 | type: "Scale" 410 | bottom: "conv2_1/dw_new" 411 | top: "conv2_1/dw_new" 412 | param { 413 | lr_mult: 1 414 | decay_mult: 0 415 | } 416 | param { 417 | lr_mult: 1 418 | decay_mult: 0 419 | } 420 | scale_param { 421 | filler { 422 | value: 1 423 | } 424 | bias_term: true 425 | bias_filler { 426 | value: 0 427 | } 428 | } 429 | } 430 | layer { 431 | name: "relu2_1/dw_new" 432 | type: "ReLU" 433 | bottom: "conv2_1/dw_new" 434 | top: "conv2_1/dw_new" 435 | } 436 | layer { 437 | name: "conv2_1/out/pw_new" 438 | type: "Convolution" 439 | bottom: "conv2_1/dw_new" 440 | top: "conv2_1/out/pw_new" 441 | param { 442 | lr_mult: 1 443 | decay_mult: 1 444 | } 445 | convolution_param { 446 | num_output: 24 447 | bias_term: false 448 | pad: 0 449 | kernel_size: 1 450 | engine: CAFFE 451 | stride: 1 452 | weight_filler { 453 | type: "msra" 454 | } 455 | } 456 | } 457 | layer { 458 | name: "conv2_1/out/pw/bn_new" 459 | type: "BatchNorm" 460 | bottom: "conv2_1/out/pw_new" 461 | top: "conv2_1/out/pw_new" 462 | param { 463 | lr_mult: 0 464 | decay_mult: 0 465 | } 466 | param { 467 | lr_mult: 0 468 | decay_mult: 0 469 | } 470 | param { 471 | lr_mult: 0 472 | decay_mult: 0 473 | } 474 | } 475 | layer { 476 | name: "conv2_1/out/pw/scale_new" 477 | type: "Scale" 478 | bottom: "conv2_1/out/pw_new" 479 | top: "conv2_1/out/pw_new" 480 | param { 481 | lr_mult: 1 482 | decay_mult: 0 483 | } 484 | param { 485 | lr_mult: 1 486 | decay_mult: 0 487 | } 488 | scale_param { 489 | filler { 490 | value: 1 491 | } 492 | bias_term: true 493 | bias_filler { 494 | value: 0 495 | } 496 | } 497 | } 498 | layer { 499 | name: "conv2_2/in/pw_new" 500 | type: "Convolution" 501 | bottom: "conv2_1/out/pw_new" 502 | top: "conv2_2/in/pw_new" 503 | param { 504 | lr_mult: 1 505 | decay_mult: 1 506 | } 507 | convolution_param { 508 | num_output: 144 509 | bias_term: false 510 | pad: 0 511 | kernel_size: 1 512 | engine: CAFFE 513 | stride: 1 514 | weight_filler { 515 | type: "msra" 516 | } 517 | } 518 | } 519 | layer { 520 | name: "conv2_2/in/pw/bn_new" 521 | type: "BatchNorm" 522 | bottom: "conv2_2/in/pw_new" 523 | top: "conv2_2/in/pw_new" 524 | param { 525 | lr_mult: 0 526 | decay_mult: 0 527 | } 528 | param { 529 | lr_mult: 0 530 | decay_mult: 0 531 | } 532 | param { 533 | lr_mult: 0 534 | decay_mult: 0 535 | } 536 | } 537 | layer { 538 | name: "conv2_2/in/pw/scale_new" 539 | type: "Scale" 540 | bottom: "conv2_2/in/pw_new" 541 | top: "conv2_2/in/pw_new" 542 | param { 543 | lr_mult: 1 544 | decay_mult: 0 545 | } 546 | param { 547 | lr_mult: 1 548 | decay_mult: 0 549 | } 550 | scale_param { 551 | filler { 552 | value: 1 553 | } 554 | bias_term: true 555 | bias_filler { 556 | value: 0 557 | } 558 | } 559 | } 560 | layer { 561 | name: "relu2_2/in/pw_new" 562 | type: "ReLU" 563 | bottom: "conv2_2/in/pw_new" 564 | top: "conv2_2/in/pw_new" 565 | } 566 | layer { 567 | name: "conv2_2/dw_new" 568 | type: "ConvolutionDepthwise" 569 | bottom: "conv2_2/in/pw_new" 570 | top: "conv2_2/dw_new" 571 | param { 572 | lr_mult: 1 573 | decay_mult: 1 574 | } 575 | convolution_param { 576 | num_output: 144 577 | bias_term: false 578 | pad: 1 579 | kernel_size: 3 580 | engine: CAFFE 581 | stride: 1 582 | weight_filler { 583 | type: "msra" 584 | } 585 | } 586 | } 587 | layer { 588 | name: "conv2_2/dw/bn_new" 589 | type: "BatchNorm" 590 | bottom: "conv2_2/dw_new" 591 | top: "conv2_2/dw_new" 592 | param { 593 | lr_mult: 0 594 | decay_mult: 0 595 | } 596 | param { 597 | lr_mult: 0 598 | decay_mult: 0 599 | } 600 | param { 601 | lr_mult: 0 602 | decay_mult: 0 603 | } 604 | } 605 | layer { 606 | name: "conv2_2/dw/scale_new" 607 | type: "Scale" 608 | bottom: "conv2_2/dw_new" 609 | top: "conv2_2/dw_new" 610 | param { 611 | lr_mult: 1 612 | decay_mult: 0 613 | } 614 | param { 615 | lr_mult: 1 616 | decay_mult: 0 617 | } 618 | scale_param { 619 | filler { 620 | value: 1 621 | } 622 | bias_term: true 623 | bias_filler { 624 | value: 0 625 | } 626 | } 627 | } 628 | layer { 629 | name: "relu2_2/dw_new" 630 | type: "ReLU" 631 | bottom: "conv2_2/dw_new" 632 | top: "conv2_2/dw_new" 633 | } 634 | layer { 635 | name: "conv2_2/out/pw_new" 636 | type: "Convolution" 637 | bottom: "conv2_2/dw_new" 638 | top: "conv2_2/out/pw_new" 639 | param { 640 | lr_mult: 1 641 | decay_mult: 1 642 | } 643 | convolution_param { 644 | num_output: 24 645 | bias_term: false 646 | pad: 0 647 | kernel_size: 1 648 | engine: CAFFE 649 | stride: 1 650 | weight_filler { 651 | type: "msra" 652 | } 653 | } 654 | } 655 | layer { 656 | name: "conv2_2/out/pw/bn_new" 657 | type: "BatchNorm" 658 | bottom: "conv2_2/out/pw_new" 659 | top: "conv2_2/out/pw_new" 660 | param { 661 | lr_mult: 0 662 | decay_mult: 0 663 | } 664 | param { 665 | lr_mult: 0 666 | decay_mult: 0 667 | } 668 | param { 669 | lr_mult: 0 670 | decay_mult: 0 671 | } 672 | } 673 | layer { 674 | name: "conv2_2/out/pw/scale_new" 675 | type: "Scale" 676 | bottom: "conv2_2/out/pw_new" 677 | top: "conv2_2/out/pw_new" 678 | param { 679 | lr_mult: 1 680 | decay_mult: 0 681 | } 682 | param { 683 | lr_mult: 1 684 | decay_mult: 0 685 | } 686 | scale_param { 687 | filler { 688 | value: 1 689 | } 690 | bias_term: true 691 | bias_filler { 692 | value: 0 693 | } 694 | } 695 | } 696 | layer { 697 | name: "fuse_conv2_2" 698 | type: "Eltwise" 699 | bottom: "conv2_1/out/pw_new" 700 | bottom: "conv2_2/out/pw_new" 701 | top: "fuse_conv2_2" 702 | eltwise_param { 703 | operation: SUM 704 | } 705 | } 706 | 707 | ############################################### 708 | 709 | layer { 710 | name: "conv3_1/in/pw_new" 711 | type: "Convolution" 712 | bottom: "fuse_conv2_2" 713 | top: "conv3_1/in/pw_new" 714 | param { 715 | lr_mult: 1 716 | decay_mult: 1 717 | } 718 | convolution_param { 719 | num_output: 144 720 | bias_term: false 721 | pad: 0 722 | kernel_size: 1 723 | engine: CAFFE 724 | stride: 1 725 | weight_filler { 726 | type: "msra" 727 | } 728 | } 729 | } 730 | layer { 731 | name: "conv3_1/in/pw/bn_new" 732 | type: "BatchNorm" 733 | bottom: "conv3_1/in/pw_new" 734 | top: "conv3_1/in/pw_new" 735 | param { 736 | lr_mult: 0 737 | decay_mult: 0 738 | } 739 | param { 740 | lr_mult: 0 741 | decay_mult: 0 742 | } 743 | param { 744 | lr_mult: 0 745 | decay_mult: 0 746 | } 747 | } 748 | layer { 749 | name: "conv3_1/in/pw/scale_new" 750 | type: "Scale" 751 | bottom: "conv3_1/in/pw_new" 752 | top: "conv3_1/in/pw_new" 753 | param { 754 | lr_mult: 1 755 | decay_mult: 0 756 | } 757 | param { 758 | lr_mult: 1 759 | decay_mult: 0 760 | } 761 | scale_param { 762 | filler { 763 | value: 1 764 | } 765 | bias_term: true 766 | bias_filler { 767 | value: 0 768 | } 769 | } 770 | } 771 | layer { 772 | name: "relu3_1/in/pw_new" 773 | type: "ReLU" 774 | bottom: "conv3_1/in/pw_new" 775 | top: "conv3_1/in/pw_new" 776 | } 777 | layer { 778 | name: "conv3_1/dw_new" 779 | type: "ConvolutionDepthwise" 780 | bottom: "conv3_1/in/pw_new" 781 | top: "conv3_1/dw_new" 782 | param { 783 | lr_mult: 1 784 | decay_mult: 1 785 | } 786 | convolution_param { 787 | num_output: 144 788 | bias_term: false 789 | pad: 1 790 | kernel_size: 3 791 | engine: CAFFE 792 | stride: 2 793 | weight_filler { 794 | type: "msra" 795 | } 796 | } 797 | } 798 | layer { 799 | name: "conv3_1/dw/bn_new" 800 | type: "BatchNorm" 801 | bottom: "conv3_1/dw_new" 802 | top: "conv3_1/dw_new" 803 | param { 804 | lr_mult: 0 805 | decay_mult: 0 806 | } 807 | param { 808 | lr_mult: 0 809 | decay_mult: 0 810 | } 811 | param { 812 | lr_mult: 0 813 | decay_mult: 0 814 | } 815 | } 816 | layer { 817 | name: "conv3_1/dw/scale_new" 818 | type: "Scale" 819 | bottom: "conv3_1/dw_new" 820 | top: "conv3_1/dw_new" 821 | param { 822 | lr_mult: 1 823 | decay_mult: 0 824 | } 825 | param { 826 | lr_mult: 1 827 | decay_mult: 0 828 | } 829 | scale_param { 830 | filler { 831 | value: 1 832 | } 833 | bias_term: true 834 | bias_filler { 835 | value: 0 836 | } 837 | } 838 | } 839 | layer { 840 | name: "relu3_1/dw_new" 841 | type: "ReLU" 842 | bottom: "conv3_1/dw_new" 843 | top: "conv3_1/dw_new" 844 | } 845 | layer { 846 | name: "conv3_1/out/pw_new" 847 | type: "Convolution" 848 | bottom: "conv3_1/dw_new" 849 | top: "conv3_1/out/pw_new" 850 | param { 851 | lr_mult: 1 852 | decay_mult: 1 853 | } 854 | convolution_param { 855 | num_output: 32 856 | bias_term: false 857 | pad: 0 858 | kernel_size: 1 859 | engine: CAFFE 860 | stride: 1 861 | weight_filler { 862 | type: "msra" 863 | } 864 | } 865 | } 866 | layer { 867 | name: "conv3_1/out/pw/bn_new" 868 | type: "BatchNorm" 869 | bottom: "conv3_1/out/pw_new" 870 | top: "conv3_1/out/pw_new" 871 | param { 872 | lr_mult: 0 873 | decay_mult: 0 874 | } 875 | param { 876 | lr_mult: 0 877 | decay_mult: 0 878 | } 879 | param { 880 | lr_mult: 0 881 | decay_mult: 0 882 | } 883 | } 884 | layer { 885 | name: "conv3_1/out/pw/scale_new" 886 | type: "Scale" 887 | bottom: "conv3_1/out/pw_new" 888 | top: "conv3_1/out/pw_new" 889 | param { 890 | lr_mult: 1 891 | decay_mult: 0 892 | } 893 | param { 894 | lr_mult: 1 895 | decay_mult: 0 896 | } 897 | scale_param { 898 | filler { 899 | value: 1 900 | } 901 | bias_term: true 902 | bias_filler { 903 | value: 0 904 | } 905 | } 906 | } 907 | layer { 908 | name: "conv3_2/in/pw_new" 909 | type: "Convolution" 910 | bottom: "conv3_1/out/pw_new" 911 | top: "conv3_2/in/pw_new" 912 | param { 913 | lr_mult: 1 914 | decay_mult: 1 915 | } 916 | convolution_param { 917 | num_output: 192 918 | bias_term: false 919 | pad: 0 920 | kernel_size: 1 921 | engine: CAFFE 922 | stride: 1 923 | weight_filler { 924 | type: "msra" 925 | } 926 | } 927 | } 928 | layer { 929 | name: "conv3_2/in/pw/bn_new" 930 | type: "BatchNorm" 931 | bottom: "conv3_2/in/pw_new" 932 | top: "conv3_2/in/pw_new" 933 | param { 934 | lr_mult: 0 935 | decay_mult: 0 936 | } 937 | param { 938 | lr_mult: 0 939 | decay_mult: 0 940 | } 941 | param { 942 | lr_mult: 0 943 | decay_mult: 0 944 | } 945 | } 946 | layer { 947 | name: "conv3_2/in/pw/scale_new" 948 | type: "Scale" 949 | bottom: "conv3_2/in/pw_new" 950 | top: "conv3_2/in/pw_new" 951 | param { 952 | lr_mult: 1 953 | decay_mult: 0 954 | } 955 | param { 956 | lr_mult: 1 957 | decay_mult: 0 958 | } 959 | scale_param { 960 | filler { 961 | value: 1 962 | } 963 | bias_term: true 964 | bias_filler { 965 | value: 0 966 | } 967 | } 968 | } 969 | layer { 970 | name: "relu3_2/in/pw_new" 971 | type: "ReLU" 972 | bottom: "conv3_2/in/pw_new" 973 | top: "conv3_2/in/pw_new" 974 | } 975 | layer { 976 | name: "conv3_2/dw_new" 977 | type: "ConvolutionDepthwise" 978 | bottom: "conv3_2/in/pw_new" 979 | top: "conv3_2/dw_new" 980 | param { 981 | lr_mult: 1 982 | decay_mult: 1 983 | } 984 | convolution_param { 985 | num_output: 192 986 | bias_term: false 987 | pad: 1 988 | kernel_size: 3 989 | engine: CAFFE 990 | stride: 1 991 | weight_filler { 992 | type: "msra" 993 | } 994 | } 995 | } 996 | layer { 997 | name: "conv3_2/dw/bn_new" 998 | type: "BatchNorm" 999 | bottom: "conv3_2/dw_new" 1000 | top: "conv3_2/dw_new" 1001 | param { 1002 | lr_mult: 0 1003 | decay_mult: 0 1004 | } 1005 | param { 1006 | lr_mult: 0 1007 | decay_mult: 0 1008 | } 1009 | param { 1010 | lr_mult: 0 1011 | decay_mult: 0 1012 | } 1013 | } 1014 | layer { 1015 | name: "conv3_2/dw/scale_new" 1016 | type: "Scale" 1017 | bottom: "conv3_2/dw_new" 1018 | top: "conv3_2/dw_new" 1019 | param { 1020 | lr_mult: 1 1021 | decay_mult: 0 1022 | } 1023 | param { 1024 | lr_mult: 1 1025 | decay_mult: 0 1026 | } 1027 | scale_param { 1028 | filler { 1029 | value: 1 1030 | } 1031 | bias_term: true 1032 | bias_filler { 1033 | value: 0 1034 | } 1035 | } 1036 | } 1037 | layer { 1038 | name: "relu3_2/dw_new" 1039 | type: "ReLU" 1040 | bottom: "conv3_2/dw_new" 1041 | top: "conv3_2/dw_new" 1042 | } 1043 | layer { 1044 | name: "conv3_2/out/pw_new" 1045 | type: "Convolution" 1046 | bottom: "conv3_2/dw_new" 1047 | top: "conv3_2/out/pw_new" 1048 | param { 1049 | lr_mult: 1 1050 | decay_mult: 1 1051 | } 1052 | convolution_param { 1053 | num_output: 32 1054 | bias_term: false 1055 | pad: 0 1056 | kernel_size: 1 1057 | engine: CAFFE 1058 | stride: 1 1059 | weight_filler { 1060 | type: "msra" 1061 | } 1062 | } 1063 | } 1064 | layer { 1065 | name: "conv3_2/out/pw/bn_new" 1066 | type: "BatchNorm" 1067 | bottom: "conv3_2/out/pw_new" 1068 | top: "conv3_2/out/pw_new" 1069 | param { 1070 | lr_mult: 0 1071 | decay_mult: 0 1072 | } 1073 | param { 1074 | lr_mult: 0 1075 | decay_mult: 0 1076 | } 1077 | param { 1078 | lr_mult: 0 1079 | decay_mult: 0 1080 | } 1081 | } 1082 | layer { 1083 | name: "conv3_2/out/pw/scale_new" 1084 | type: "Scale" 1085 | bottom: "conv3_2/out/pw_new" 1086 | top: "conv3_2/out/pw_new" 1087 | param { 1088 | lr_mult: 1 1089 | decay_mult: 0 1090 | } 1091 | param { 1092 | lr_mult: 1 1093 | decay_mult: 0 1094 | } 1095 | scale_param { 1096 | filler { 1097 | value: 1 1098 | } 1099 | bias_term: true 1100 | bias_filler { 1101 | value: 0 1102 | } 1103 | } 1104 | } 1105 | layer { 1106 | name: "fuse_conv3_2" 1107 | type: "Eltwise" 1108 | bottom: "conv3_1/out/pw_new" 1109 | bottom: "conv3_2/out/pw_new" 1110 | top: "fuse_conv3_2" 1111 | eltwise_param { 1112 | operation: SUM 1113 | } 1114 | } 1115 | layer { 1116 | name: "conv3_3/in/pw_new" 1117 | type: "Convolution" 1118 | bottom: "fuse_conv3_2" 1119 | top: "conv3_3/in/pw_new" 1120 | param { 1121 | lr_mult: 1 1122 | decay_mult: 1 1123 | } 1124 | convolution_param { 1125 | num_output: 192 1126 | bias_term: false 1127 | pad: 0 1128 | kernel_size: 1 1129 | engine: CAFFE 1130 | stride: 1 1131 | weight_filler { 1132 | type: "msra" 1133 | } 1134 | } 1135 | } 1136 | layer { 1137 | name: "conv3_3/in/pw/bn_new" 1138 | type: "BatchNorm" 1139 | bottom: "conv3_3/in/pw_new" 1140 | top: "conv3_3/in/pw_new" 1141 | param { 1142 | lr_mult: 0 1143 | decay_mult: 0 1144 | } 1145 | param { 1146 | lr_mult: 0 1147 | decay_mult: 0 1148 | } 1149 | param { 1150 | lr_mult: 0 1151 | decay_mult: 0 1152 | } 1153 | } 1154 | layer { 1155 | name: "conv3_3/in/pw/scale_new" 1156 | type: "Scale" 1157 | bottom: "conv3_3/in/pw_new" 1158 | top: "conv3_3/in/pw_new" 1159 | param { 1160 | lr_mult: 1 1161 | decay_mult: 0 1162 | } 1163 | param { 1164 | lr_mult: 1 1165 | decay_mult: 0 1166 | } 1167 | scale_param { 1168 | filler { 1169 | value: 1 1170 | } 1171 | bias_term: true 1172 | bias_filler { 1173 | value: 0 1174 | } 1175 | } 1176 | } 1177 | layer { 1178 | name: "relu3_3/in/pw_new" 1179 | type: "ReLU" 1180 | bottom: "conv3_3/in/pw_new" 1181 | top: "conv3_3/in/pw_new" 1182 | } 1183 | layer { 1184 | name: "conv3_3/dw_new" 1185 | type: "ConvolutionDepthwise" 1186 | bottom: "conv3_3/in/pw_new" 1187 | top: "conv3_3/dw_new" 1188 | param { 1189 | lr_mult: 1 1190 | decay_mult: 1 1191 | } 1192 | convolution_param { 1193 | num_output: 192 1194 | bias_term: false 1195 | pad: 1 1196 | kernel_size: 3 1197 | engine: CAFFE 1198 | stride: 1 1199 | weight_filler { 1200 | type: "msra" 1201 | } 1202 | } 1203 | } 1204 | layer { 1205 | name: "conv3_3/dw/bn_new" 1206 | type: "BatchNorm" 1207 | bottom: "conv3_3/dw_new" 1208 | top: "conv3_3/dw_new" 1209 | param { 1210 | lr_mult: 0 1211 | decay_mult: 0 1212 | } 1213 | param { 1214 | lr_mult: 0 1215 | decay_mult: 0 1216 | } 1217 | param { 1218 | lr_mult: 0 1219 | decay_mult: 0 1220 | } 1221 | } 1222 | layer { 1223 | name: "conv3_3/dw/scale_new" 1224 | type: "Scale" 1225 | bottom: "conv3_3/dw_new" 1226 | top: "conv3_3/dw_new" 1227 | param { 1228 | lr_mult: 1 1229 | decay_mult: 0 1230 | } 1231 | param { 1232 | lr_mult: 1 1233 | decay_mult: 0 1234 | } 1235 | scale_param { 1236 | filler { 1237 | value: 1 1238 | } 1239 | bias_term: true 1240 | bias_filler { 1241 | value: 0 1242 | } 1243 | } 1244 | } 1245 | layer { 1246 | name: "relu3_3/dw_new" 1247 | type: "ReLU" 1248 | bottom: "conv3_3/dw_new" 1249 | top: "conv3_3/dw_new" 1250 | } 1251 | layer { 1252 | name: "conv3_3/out/pw_new" 1253 | type: "Convolution" 1254 | bottom: "conv3_3/dw_new" 1255 | top: "conv3_3/out/pw_new" 1256 | param { 1257 | lr_mult: 1 1258 | decay_mult: 1 1259 | } 1260 | convolution_param { 1261 | num_output: 32 1262 | bias_term: false 1263 | pad: 0 1264 | kernel_size: 1 1265 | engine: CAFFE 1266 | stride: 1 1267 | weight_filler { 1268 | type: "msra" 1269 | } 1270 | } 1271 | } 1272 | layer { 1273 | name: "conv3_3/out/pw/bn_new" 1274 | type: "BatchNorm" 1275 | bottom: "conv3_3/out/pw_new" 1276 | top: "conv3_3/out/pw_new" 1277 | param { 1278 | lr_mult: 0 1279 | decay_mult: 0 1280 | } 1281 | param { 1282 | lr_mult: 0 1283 | decay_mult: 0 1284 | } 1285 | param { 1286 | lr_mult: 0 1287 | decay_mult: 0 1288 | } 1289 | } 1290 | layer { 1291 | name: "conv3_3/out/pw/scale_new" 1292 | type: "Scale" 1293 | bottom: "conv3_3/out/pw_new" 1294 | top: "conv3_3/out/pw_new" 1295 | param { 1296 | lr_mult: 1 1297 | decay_mult: 0 1298 | } 1299 | param { 1300 | lr_mult: 1 1301 | decay_mult: 0 1302 | } 1303 | scale_param { 1304 | filler { 1305 | value: 1 1306 | } 1307 | bias_term: true 1308 | bias_filler { 1309 | value: 0 1310 | } 1311 | } 1312 | } 1313 | layer { 1314 | name: "fuse_conv3_3" 1315 | type: "Eltwise" 1316 | bottom: "fuse_conv3_2" 1317 | bottom: "conv3_3/out/pw_new" 1318 | top: "fuse_conv3_3" 1319 | eltwise_param { 1320 | operation: SUM 1321 | } 1322 | } 1323 | 1324 | ############################################### 1325 | 1326 | layer { 1327 | name: "conv4_1/in/pw_new" 1328 | type: "Convolution" 1329 | bottom: "fuse_conv3_3" 1330 | top: "conv4_1/in/pw_new" 1331 | param { 1332 | lr_mult: 1 1333 | decay_mult: 1 1334 | } 1335 | convolution_param { 1336 | num_output: 192 1337 | bias_term: false 1338 | pad: 0 1339 | kernel_size: 1 1340 | engine: CAFFE 1341 | stride: 1 1342 | weight_filler { 1343 | type: "msra" 1344 | } 1345 | } 1346 | } 1347 | layer { 1348 | name: "conv4_1/in/pw/bn_new" 1349 | type: "BatchNorm" 1350 | bottom: "conv4_1/in/pw_new" 1351 | top: "conv4_1/in/pw_new" 1352 | param { 1353 | lr_mult: 0 1354 | decay_mult: 0 1355 | } 1356 | param { 1357 | lr_mult: 0 1358 | decay_mult: 0 1359 | } 1360 | param { 1361 | lr_mult: 0 1362 | decay_mult: 0 1363 | } 1364 | } 1365 | layer { 1366 | name: "conv4_1/in/pw/scale_new" 1367 | type: "Scale" 1368 | bottom: "conv4_1/in/pw_new" 1369 | top: "conv4_1/in/pw_new" 1370 | param { 1371 | lr_mult: 1 1372 | decay_mult: 0 1373 | } 1374 | param { 1375 | lr_mult: 1 1376 | decay_mult: 0 1377 | } 1378 | scale_param { 1379 | filler { 1380 | value: 1 1381 | } 1382 | bias_term: true 1383 | bias_filler { 1384 | value: 0 1385 | } 1386 | } 1387 | } 1388 | layer { 1389 | name: "relu4_1/in/pw_new" 1390 | type: "ReLU" 1391 | bottom: "conv4_1/in/pw_new" 1392 | top: "conv4_1/in/pw_new" 1393 | } 1394 | layer { 1395 | name: "conv4_1/dw_new" 1396 | type: "ConvolutionDepthwise" 1397 | bottom: "conv4_1/in/pw_new" 1398 | top: "conv4_1/dw_new" 1399 | param { 1400 | lr_mult: 1 1401 | decay_mult: 1 1402 | } 1403 | convolution_param { 1404 | num_output: 192 1405 | bias_term: false 1406 | pad: 1 1407 | kernel_size: 3 1408 | engine: CAFFE 1409 | stride: 1 1410 | weight_filler { 1411 | type: "msra" 1412 | } 1413 | } 1414 | } 1415 | layer { 1416 | name: "conv4_1/dw/bn_new" 1417 | type: "BatchNorm" 1418 | bottom: "conv4_1/dw_new" 1419 | top: "conv4_1/dw_new" 1420 | param { 1421 | lr_mult: 0 1422 | decay_mult: 0 1423 | } 1424 | param { 1425 | lr_mult: 0 1426 | decay_mult: 0 1427 | } 1428 | param { 1429 | lr_mult: 0 1430 | decay_mult: 0 1431 | } 1432 | } 1433 | layer { 1434 | name: "conv4_1/dw/scale_new" 1435 | type: "Scale" 1436 | bottom: "conv4_1/dw_new" 1437 | top: "conv4_1/dw_new" 1438 | param { 1439 | lr_mult: 1 1440 | decay_mult: 0 1441 | } 1442 | param { 1443 | lr_mult: 1 1444 | decay_mult: 0 1445 | } 1446 | scale_param { 1447 | filler { 1448 | value: 1 1449 | } 1450 | bias_term: true 1451 | bias_filler { 1452 | value: 0 1453 | } 1454 | } 1455 | } 1456 | layer { 1457 | name: "relu4_1/dw_new" 1458 | type: "ReLU" 1459 | bottom: "conv4_1/dw_new" 1460 | top: "conv4_1/dw_new" 1461 | } 1462 | layer { 1463 | name: "conv4_1/out/pw_new" 1464 | type: "Convolution" 1465 | bottom: "conv4_1/dw_new" 1466 | top: "conv4_1/out/pw_new" 1467 | param { 1468 | lr_mult: 1 1469 | decay_mult: 1 1470 | } 1471 | convolution_param { 1472 | num_output: 64 1473 | bias_term: false 1474 | pad: 0 1475 | kernel_size: 1 1476 | engine: CAFFE 1477 | stride: 1 1478 | weight_filler { 1479 | type: "msra" 1480 | } 1481 | } 1482 | } 1483 | layer { 1484 | name: "conv4_1/out/pw/bn_new" 1485 | type: "BatchNorm" 1486 | bottom: "conv4_1/out/pw_new" 1487 | top: "conv4_1/out/pw_new" 1488 | param { 1489 | lr_mult: 0 1490 | decay_mult: 0 1491 | } 1492 | param { 1493 | lr_mult: 0 1494 | decay_mult: 0 1495 | } 1496 | param { 1497 | lr_mult: 0 1498 | decay_mult: 0 1499 | } 1500 | } 1501 | layer { 1502 | name: "conv4_1/out/pw/scale_new" 1503 | type: "Scale" 1504 | bottom: "conv4_1/out/pw_new" 1505 | top: "conv4_1/out/pw_new" 1506 | param { 1507 | lr_mult: 1 1508 | decay_mult: 0 1509 | } 1510 | param { 1511 | lr_mult: 1 1512 | decay_mult: 0 1513 | } 1514 | scale_param { 1515 | filler { 1516 | value: 1 1517 | } 1518 | bias_term: true 1519 | bias_filler { 1520 | value: 0 1521 | } 1522 | } 1523 | } 1524 | layer { 1525 | name: "conv4_2/in/pw_new" 1526 | type: "Convolution" 1527 | bottom: "conv4_1/out/pw_new" 1528 | top: "conv4_2/in/pw_new" 1529 | param { 1530 | lr_mult: 1 1531 | decay_mult: 1 1532 | } 1533 | convolution_param { 1534 | num_output: 384 1535 | bias_term: false 1536 | pad: 0 1537 | kernel_size: 1 1538 | engine: CAFFE 1539 | stride: 1 1540 | weight_filler { 1541 | type: "msra" 1542 | } 1543 | } 1544 | } 1545 | layer { 1546 | name: "conv4_2/in/pw/bn_new" 1547 | type: "BatchNorm" 1548 | bottom: "conv4_2/in/pw_new" 1549 | top: "conv4_2/in/pw_new" 1550 | param { 1551 | lr_mult: 0 1552 | decay_mult: 0 1553 | } 1554 | param { 1555 | lr_mult: 0 1556 | decay_mult: 0 1557 | } 1558 | param { 1559 | lr_mult: 0 1560 | decay_mult: 0 1561 | } 1562 | } 1563 | layer { 1564 | name: "conv4_2/in/pw/scale_new" 1565 | type: "Scale" 1566 | bottom: "conv4_2/in/pw_new" 1567 | top: "conv4_2/in/pw_new" 1568 | param { 1569 | lr_mult: 1 1570 | decay_mult: 0 1571 | } 1572 | param { 1573 | lr_mult: 1 1574 | decay_mult: 0 1575 | } 1576 | scale_param { 1577 | filler { 1578 | value: 1 1579 | } 1580 | bias_term: true 1581 | bias_filler { 1582 | value: 0 1583 | } 1584 | } 1585 | } 1586 | layer { 1587 | name: "relu4_2/in/pw_new" 1588 | type: "ReLU" 1589 | bottom: "conv4_2/in/pw_new" 1590 | top: "conv4_2/in/pw_new" 1591 | } 1592 | layer { 1593 | name: "conv4_2/dw_new" 1594 | type: "ConvolutionDepthwise" 1595 | bottom: "conv4_2/in/pw_new" 1596 | top: "conv4_2/dw_new" 1597 | param { 1598 | lr_mult: 1 1599 | decay_mult: 1 1600 | } 1601 | convolution_param { 1602 | num_output: 384 1603 | bias_term: false 1604 | pad: 1 1605 | kernel_size: 3 1606 | engine: CAFFE 1607 | stride: 1 1608 | weight_filler { 1609 | type: "msra" 1610 | } 1611 | } 1612 | } 1613 | layer { 1614 | name: "conv4_2/dw/bn_new" 1615 | type: "BatchNorm" 1616 | bottom: "conv4_2/dw_new" 1617 | top: "conv4_2/dw_new" 1618 | param { 1619 | lr_mult: 0 1620 | decay_mult: 0 1621 | } 1622 | param { 1623 | lr_mult: 0 1624 | decay_mult: 0 1625 | } 1626 | param { 1627 | lr_mult: 0 1628 | decay_mult: 0 1629 | } 1630 | } 1631 | layer { 1632 | name: "conv4_2/dw/scale_new" 1633 | type: "Scale" 1634 | bottom: "conv4_2/dw_new" 1635 | top: "conv4_2/dw_new" 1636 | param { 1637 | lr_mult: 1 1638 | decay_mult: 0 1639 | } 1640 | param { 1641 | lr_mult: 1 1642 | decay_mult: 0 1643 | } 1644 | scale_param { 1645 | filler { 1646 | value: 1 1647 | } 1648 | bias_term: true 1649 | bias_filler { 1650 | value: 0 1651 | } 1652 | } 1653 | } 1654 | layer { 1655 | name: "relu4_2/dw_new" 1656 | type: "ReLU" 1657 | bottom: "conv4_2/dw_new" 1658 | top: "conv4_2/dw_new" 1659 | } 1660 | layer { 1661 | name: "conv4_2/out/pw_new" 1662 | type: "Convolution" 1663 | bottom: "conv4_2/dw_new" 1664 | top: "conv4_2/out/pw_new" 1665 | param { 1666 | lr_mult: 1 1667 | decay_mult: 1 1668 | } 1669 | convolution_param { 1670 | num_output: 64 1671 | bias_term: false 1672 | pad: 0 1673 | kernel_size: 1 1674 | engine: CAFFE 1675 | stride: 1 1676 | weight_filler { 1677 | type: "msra" 1678 | } 1679 | } 1680 | } 1681 | layer { 1682 | name: "conv4_2/out/pw/bn_new" 1683 | type: "BatchNorm" 1684 | bottom: "conv4_2/out/pw_new" 1685 | top: "conv4_2/out/pw_new" 1686 | param { 1687 | lr_mult: 0 1688 | decay_mult: 0 1689 | } 1690 | param { 1691 | lr_mult: 0 1692 | decay_mult: 0 1693 | } 1694 | param { 1695 | lr_mult: 0 1696 | decay_mult: 0 1697 | } 1698 | } 1699 | layer { 1700 | name: "conv4_2/out/pw/scale_new" 1701 | type: "Scale" 1702 | bottom: "conv4_2/out/pw_new" 1703 | top: "conv4_2/out/pw_new" 1704 | param { 1705 | lr_mult: 1 1706 | decay_mult: 0 1707 | } 1708 | param { 1709 | lr_mult: 1 1710 | decay_mult: 0 1711 | } 1712 | scale_param { 1713 | filler { 1714 | value: 1 1715 | } 1716 | bias_term: true 1717 | bias_filler { 1718 | value: 0 1719 | } 1720 | } 1721 | } 1722 | layer { 1723 | name: "fuse_conv4_2" 1724 | type: "Eltwise" 1725 | bottom: "conv4_1/out/pw_new" 1726 | bottom: "conv4_2/out/pw_new" 1727 | top: "fuse_conv4_2" 1728 | eltwise_param { 1729 | operation: SUM 1730 | } 1731 | } 1732 | layer { 1733 | name: "conv4_3/in/pw_new" 1734 | type: "Convolution" 1735 | bottom: "fuse_conv4_2" 1736 | top: "conv4_3/in/pw_new" 1737 | param { 1738 | lr_mult: 1 1739 | decay_mult: 1 1740 | } 1741 | convolution_param { 1742 | num_output: 384 1743 | bias_term: false 1744 | pad: 0 1745 | kernel_size: 1 1746 | engine: CAFFE 1747 | stride: 1 1748 | weight_filler { 1749 | type: "msra" 1750 | } 1751 | } 1752 | } 1753 | layer { 1754 | name: "conv4_3/in/pw/bn_new" 1755 | type: "BatchNorm" 1756 | bottom: "conv4_3/in/pw_new" 1757 | top: "conv4_3/in/pw_new" 1758 | param { 1759 | lr_mult: 0 1760 | decay_mult: 0 1761 | } 1762 | param { 1763 | lr_mult: 0 1764 | decay_mult: 0 1765 | } 1766 | param { 1767 | lr_mult: 0 1768 | decay_mult: 0 1769 | } 1770 | } 1771 | layer { 1772 | name: "conv4_3/in/pw/scale_new" 1773 | type: "Scale" 1774 | bottom: "conv4_3/in/pw_new" 1775 | top: "conv4_3/in/pw_new" 1776 | param { 1777 | lr_mult: 1 1778 | decay_mult: 0 1779 | } 1780 | param { 1781 | lr_mult: 1 1782 | decay_mult: 0 1783 | } 1784 | scale_param { 1785 | filler { 1786 | value: 1 1787 | } 1788 | bias_term: true 1789 | bias_filler { 1790 | value: 0 1791 | } 1792 | } 1793 | } 1794 | layer { 1795 | name: "relu4_3/in/pw_new" 1796 | type: "ReLU" 1797 | bottom: "conv4_3/in/pw_new" 1798 | top: "conv4_3/in/pw_new" 1799 | } 1800 | layer { 1801 | name: "conv4_3/dw_new" 1802 | type: "ConvolutionDepthwise" 1803 | bottom: "conv4_3/in/pw_new" 1804 | top: "conv4_3/dw_new" 1805 | param { 1806 | lr_mult: 1 1807 | decay_mult: 1 1808 | } 1809 | convolution_param { 1810 | num_output: 384 1811 | bias_term: false 1812 | pad: 1 1813 | kernel_size: 3 1814 | engine: CAFFE 1815 | stride: 1 1816 | weight_filler { 1817 | type: "msra" 1818 | } 1819 | } 1820 | } 1821 | layer { 1822 | name: "conv4_3/dw/bn_new" 1823 | type: "BatchNorm" 1824 | bottom: "conv4_3/dw_new" 1825 | top: "conv4_3/dw_new" 1826 | param { 1827 | lr_mult: 0 1828 | decay_mult: 0 1829 | } 1830 | param { 1831 | lr_mult: 0 1832 | decay_mult: 0 1833 | } 1834 | param { 1835 | lr_mult: 0 1836 | decay_mult: 0 1837 | } 1838 | } 1839 | layer { 1840 | name: "conv4_3/dw/scale_new" 1841 | type: "Scale" 1842 | bottom: "conv4_3/dw_new" 1843 | top: "conv4_3/dw_new" 1844 | param { 1845 | lr_mult: 1 1846 | decay_mult: 0 1847 | } 1848 | param { 1849 | lr_mult: 1 1850 | decay_mult: 0 1851 | } 1852 | scale_param { 1853 | filler { 1854 | value: 1 1855 | } 1856 | bias_term: true 1857 | bias_filler { 1858 | value: 0 1859 | } 1860 | } 1861 | } 1862 | layer { 1863 | name: "relu4_3/dw_new" 1864 | type: "ReLU" 1865 | bottom: "conv4_3/dw_new" 1866 | top: "conv4_3/dw_new" 1867 | } 1868 | layer { 1869 | name: "conv4_3/out/pw_new" 1870 | type: "Convolution" 1871 | bottom: "conv4_3/dw_new" 1872 | top: "conv4_3/out/pw_new" 1873 | param { 1874 | lr_mult: 1 1875 | decay_mult: 1 1876 | } 1877 | convolution_param { 1878 | num_output: 64 1879 | bias_term: false 1880 | pad: 0 1881 | kernel_size: 1 1882 | engine: CAFFE 1883 | stride: 1 1884 | weight_filler { 1885 | type: "msra" 1886 | } 1887 | } 1888 | } 1889 | layer { 1890 | name: "conv4_3/out/pw/bn_new" 1891 | type: "BatchNorm" 1892 | bottom: "conv4_3/out/pw_new" 1893 | top: "conv4_3/out/pw_new" 1894 | param { 1895 | lr_mult: 0 1896 | decay_mult: 0 1897 | } 1898 | param { 1899 | lr_mult: 0 1900 | decay_mult: 0 1901 | } 1902 | param { 1903 | lr_mult: 0 1904 | decay_mult: 0 1905 | } 1906 | } 1907 | layer { 1908 | name: "conv4_3/out/pw/scale_new" 1909 | type: "Scale" 1910 | bottom: "conv4_3/out/pw_new" 1911 | top: "conv4_3/out/pw_new" 1912 | param { 1913 | lr_mult: 1 1914 | decay_mult: 0 1915 | } 1916 | param { 1917 | lr_mult: 1 1918 | decay_mult: 0 1919 | } 1920 | scale_param { 1921 | filler { 1922 | value: 1 1923 | } 1924 | bias_term: true 1925 | bias_filler { 1926 | value: 0 1927 | } 1928 | } 1929 | } 1930 | layer { 1931 | name: "fuse_conv4_3" 1932 | type: "Eltwise" 1933 | bottom: "fuse_conv4_2" 1934 | bottom: "conv4_3/out/pw_new" 1935 | top: "fuse_conv4_3" 1936 | eltwise_param { 1937 | operation: SUM 1938 | } 1939 | } 1940 | layer { 1941 | name: "conv4_4/in/pw_new" 1942 | type: "Convolution" 1943 | bottom: "fuse_conv4_3" 1944 | top: "conv4_4/in/pw_new" 1945 | param { 1946 | lr_mult: 1 1947 | decay_mult: 1 1948 | } 1949 | convolution_param { 1950 | num_output: 384 1951 | bias_term: false 1952 | pad: 0 1953 | kernel_size: 1 1954 | engine: CAFFE 1955 | stride: 1 1956 | weight_filler { 1957 | type: "msra" 1958 | } 1959 | } 1960 | } 1961 | layer { 1962 | name: "conv4_4/in/pw/bn_new" 1963 | type: "BatchNorm" 1964 | bottom: "conv4_4/in/pw_new" 1965 | top: "conv4_4/in/pw_new" 1966 | param { 1967 | lr_mult: 0 1968 | decay_mult: 0 1969 | } 1970 | param { 1971 | lr_mult: 0 1972 | decay_mult: 0 1973 | } 1974 | param { 1975 | lr_mult: 0 1976 | decay_mult: 0 1977 | } 1978 | } 1979 | layer { 1980 | name: "conv4_4/in/pw/scale_new" 1981 | type: "Scale" 1982 | bottom: "conv4_4/in/pw_new" 1983 | top: "conv4_4/in/pw_new" 1984 | param { 1985 | lr_mult: 1 1986 | decay_mult: 0 1987 | } 1988 | param { 1989 | lr_mult: 1 1990 | decay_mult: 0 1991 | } 1992 | scale_param { 1993 | filler { 1994 | value: 1 1995 | } 1996 | bias_term: true 1997 | bias_filler { 1998 | value: 0 1999 | } 2000 | } 2001 | } 2002 | layer { 2003 | name: "relu4_4/in/pw_new" 2004 | type: "ReLU" 2005 | bottom: "conv4_4/in/pw_new" 2006 | top: "conv4_4/in/pw_new" 2007 | } 2008 | layer { 2009 | name: "conv4_4/dw_new" 2010 | type: "ConvolutionDepthwise" 2011 | bottom: "conv4_4/in/pw_new" 2012 | top: "conv4_4/dw_new" 2013 | param { 2014 | lr_mult: 1 2015 | decay_mult: 1 2016 | } 2017 | convolution_param { 2018 | num_output: 384 2019 | bias_term: false 2020 | pad: 1 2021 | kernel_size: 3 2022 | engine: CAFFE 2023 | stride: 1 2024 | weight_filler { 2025 | type: "msra" 2026 | } 2027 | } 2028 | } 2029 | layer { 2030 | name: "conv4_4/dw/bn_new" 2031 | type: "BatchNorm" 2032 | bottom: "conv4_4/dw_new" 2033 | top: "conv4_4/dw_new" 2034 | param { 2035 | lr_mult: 0 2036 | decay_mult: 0 2037 | } 2038 | param { 2039 | lr_mult: 0 2040 | decay_mult: 0 2041 | } 2042 | param { 2043 | lr_mult: 0 2044 | decay_mult: 0 2045 | } 2046 | } 2047 | layer { 2048 | name: "conv4_4/dw/scale_new" 2049 | type: "Scale" 2050 | bottom: "conv4_4/dw_new" 2051 | top: "conv4_4/dw_new" 2052 | param { 2053 | lr_mult: 1 2054 | decay_mult: 0 2055 | } 2056 | param { 2057 | lr_mult: 1 2058 | decay_mult: 0 2059 | } 2060 | scale_param { 2061 | filler { 2062 | value: 1 2063 | } 2064 | bias_term: true 2065 | bias_filler { 2066 | value: 0 2067 | } 2068 | } 2069 | } 2070 | layer { 2071 | name: "relu4_4/dw_new" 2072 | type: "ReLU" 2073 | bottom: "conv4_4/dw_new" 2074 | top: "conv4_4/dw_new" 2075 | } 2076 | layer { 2077 | name: "conv4_4/out/pw_new" 2078 | type: "Convolution" 2079 | bottom: "conv4_4/dw_new" 2080 | top: "conv4_4/out/pw_new" 2081 | param { 2082 | lr_mult: 1 2083 | decay_mult: 1 2084 | } 2085 | convolution_param { 2086 | num_output: 64 2087 | bias_term: false 2088 | pad: 0 2089 | kernel_size: 1 2090 | engine: CAFFE 2091 | stride: 1 2092 | weight_filler { 2093 | type: "msra" 2094 | } 2095 | } 2096 | } 2097 | layer { 2098 | name: "conv4_4/out/pw/bn_new" 2099 | type: "BatchNorm" 2100 | bottom: "conv4_4/out/pw_new" 2101 | top: "conv4_4/out/pw_new" 2102 | param { 2103 | lr_mult: 0 2104 | decay_mult: 0 2105 | } 2106 | param { 2107 | lr_mult: 0 2108 | decay_mult: 0 2109 | } 2110 | param { 2111 | lr_mult: 0 2112 | decay_mult: 0 2113 | } 2114 | } 2115 | layer { 2116 | name: "conv4_4/out/pw/scale_new" 2117 | type: "Scale" 2118 | bottom: "conv4_4/out/pw_new" 2119 | top: "conv4_4/out/pw_new" 2120 | param { 2121 | lr_mult: 1 2122 | decay_mult: 0 2123 | } 2124 | param { 2125 | lr_mult: 1 2126 | decay_mult: 0 2127 | } 2128 | scale_param { 2129 | filler { 2130 | value: 1 2131 | } 2132 | bias_term: true 2133 | bias_filler { 2134 | value: 0 2135 | } 2136 | } 2137 | } 2138 | layer { 2139 | name: "fuse_conv4_4" 2140 | type: "Eltwise" 2141 | bottom: "fuse_conv4_3" 2142 | bottom: "conv4_4/out/pw_new" 2143 | top: "fuse_conv4_4" 2144 | eltwise_param { 2145 | operation: SUM 2146 | } 2147 | } 2148 | ############################################### 2149 | 2150 | layer { 2151 | name: "conv5_1/in/pw_new" 2152 | type: "Convolution" 2153 | bottom: "fuse_conv4_4" 2154 | top: "conv5_1/in/pw_new" 2155 | param { 2156 | lr_mult: 1 2157 | decay_mult: 1 2158 | } 2159 | convolution_param { 2160 | num_output: 384 2161 | bias_term: false 2162 | pad: 0 2163 | kernel_size: 1 2164 | engine: CAFFE 2165 | stride: 1 2166 | weight_filler { 2167 | type: "msra" 2168 | } 2169 | } 2170 | } 2171 | layer { 2172 | name: "conv5_1/in/pw/bn_new" 2173 | type: "BatchNorm" 2174 | bottom: "conv5_1/in/pw_new" 2175 | top: "conv5_1/in/pw_new" 2176 | param { 2177 | lr_mult: 0 2178 | decay_mult: 0 2179 | } 2180 | param { 2181 | lr_mult: 0 2182 | decay_mult: 0 2183 | } 2184 | param { 2185 | lr_mult: 0 2186 | decay_mult: 0 2187 | } 2188 | } 2189 | layer { 2190 | name: "conv5_1/in/pw/scale_new" 2191 | type: "Scale" 2192 | bottom: "conv5_1/in/pw_new" 2193 | top: "conv5_1/in/pw_new" 2194 | param { 2195 | lr_mult: 1 2196 | decay_mult: 0 2197 | } 2198 | param { 2199 | lr_mult: 1 2200 | decay_mult: 0 2201 | } 2202 | scale_param { 2203 | filler { 2204 | value: 1 2205 | } 2206 | bias_term: true 2207 | bias_filler { 2208 | value: 0 2209 | } 2210 | } 2211 | } 2212 | layer { 2213 | name: "relu5_1/in/pw_new" 2214 | type: "ReLU" 2215 | bottom: "conv5_1/in/pw_new" 2216 | top: "conv5_1/in/pw_new" 2217 | } 2218 | layer { 2219 | name: "conv5_1/dw_new" 2220 | type: "ConvolutionDepthwise" 2221 | bottom: "conv5_1/in/pw_new" 2222 | top: "conv5_1/dw_new" 2223 | param { 2224 | lr_mult: 1 2225 | decay_mult: 1 2226 | } 2227 | convolution_param { 2228 | num_output: 384 2229 | bias_term: false 2230 | pad: 1 2231 | kernel_size: 3 2232 | engine: CAFFE 2233 | stride: 2 2234 | weight_filler { 2235 | type: "msra" 2236 | } 2237 | } 2238 | } 2239 | layer { 2240 | name: "conv5_1/dw/bn_new" 2241 | type: "BatchNorm" 2242 | bottom: "conv5_1/dw_new" 2243 | top: "conv5_1/dw_new" 2244 | param { 2245 | lr_mult: 0 2246 | decay_mult: 0 2247 | } 2248 | param { 2249 | lr_mult: 0 2250 | decay_mult: 0 2251 | } 2252 | param { 2253 | lr_mult: 0 2254 | decay_mult: 0 2255 | } 2256 | } 2257 | layer { 2258 | name: "conv5_1/dw/scale_new" 2259 | type: "Scale" 2260 | bottom: "conv5_1/dw_new" 2261 | top: "conv5_1/dw_new" 2262 | param { 2263 | lr_mult: 1 2264 | decay_mult: 0 2265 | } 2266 | param { 2267 | lr_mult: 1 2268 | decay_mult: 0 2269 | } 2270 | scale_param { 2271 | filler { 2272 | value: 1 2273 | } 2274 | bias_term: true 2275 | bias_filler { 2276 | value: 0 2277 | } 2278 | } 2279 | } 2280 | layer { 2281 | name: "relu5_1/dw_new" 2282 | type: "ReLU" 2283 | bottom: "conv5_1/dw_new" 2284 | top: "conv5_1/dw_new" 2285 | } 2286 | layer { 2287 | name: "conv5_1/out/pw_new" 2288 | type: "Convolution" 2289 | bottom: "conv5_1/dw_new" 2290 | top: "conv5_1/out/pw_new" 2291 | param { 2292 | lr_mult: 1 2293 | decay_mult: 1 2294 | } 2295 | convolution_param { 2296 | num_output: 96 2297 | bias_term: false 2298 | pad: 0 2299 | kernel_size: 1 2300 | engine: CAFFE 2301 | stride: 1 2302 | weight_filler { 2303 | type: "msra" 2304 | } 2305 | } 2306 | } 2307 | layer { 2308 | name: "conv5_1/out/pw/bn_new" 2309 | type: "BatchNorm" 2310 | bottom: "conv5_1/out/pw_new" 2311 | top: "conv5_1/out/pw_new" 2312 | param { 2313 | lr_mult: 0 2314 | decay_mult: 0 2315 | } 2316 | param { 2317 | lr_mult: 0 2318 | decay_mult: 0 2319 | } 2320 | param { 2321 | lr_mult: 0 2322 | decay_mult: 0 2323 | } 2324 | } 2325 | layer { 2326 | name: "conv5_1/out/pw/scale_new" 2327 | type: "Scale" 2328 | bottom: "conv5_1/out/pw_new" 2329 | top: "conv5_1/out/pw_new" 2330 | param { 2331 | lr_mult: 1 2332 | decay_mult: 0 2333 | } 2334 | param { 2335 | lr_mult: 1 2336 | decay_mult: 0 2337 | } 2338 | scale_param { 2339 | filler { 2340 | value: 1 2341 | } 2342 | bias_term: true 2343 | bias_filler { 2344 | value: 0 2345 | } 2346 | } 2347 | } 2348 | layer { 2349 | name: "conv5_2/in/pw_new" 2350 | type: "Convolution" 2351 | bottom: "conv5_1/out/pw_new" 2352 | top: "conv5_2/in/pw_new" 2353 | param { 2354 | lr_mult: 1 2355 | decay_mult: 1 2356 | } 2357 | convolution_param { 2358 | num_output: 576 2359 | bias_term: false 2360 | pad: 0 2361 | kernel_size: 1 2362 | engine: CAFFE 2363 | stride: 1 2364 | weight_filler { 2365 | type: "msra" 2366 | } 2367 | } 2368 | } 2369 | layer { 2370 | name: "conv5_2/in/pw/bn_new" 2371 | type: "BatchNorm" 2372 | bottom: "conv5_2/in/pw_new" 2373 | top: "conv5_2/in/pw_new" 2374 | param { 2375 | lr_mult: 0 2376 | decay_mult: 0 2377 | } 2378 | param { 2379 | lr_mult: 0 2380 | decay_mult: 0 2381 | } 2382 | param { 2383 | lr_mult: 0 2384 | decay_mult: 0 2385 | } 2386 | } 2387 | layer { 2388 | name: "conv5_2/in/pw/scale_new" 2389 | type: "Scale" 2390 | bottom: "conv5_2/in/pw_new" 2391 | top: "conv5_2/in/pw_new" 2392 | param { 2393 | lr_mult: 1 2394 | decay_mult: 0 2395 | } 2396 | param { 2397 | lr_mult: 1 2398 | decay_mult: 0 2399 | } 2400 | scale_param { 2401 | filler { 2402 | value: 1 2403 | } 2404 | bias_term: true 2405 | bias_filler { 2406 | value: 0 2407 | } 2408 | } 2409 | } 2410 | layer { 2411 | name: "relu5_2/in/pw_new" 2412 | type: "ReLU" 2413 | bottom: "conv5_2/in/pw_new" 2414 | top: "conv5_2/in/pw_new" 2415 | } 2416 | layer { 2417 | name: "conv5_2/dw_new" 2418 | type: "ConvolutionDepthwise" 2419 | bottom: "conv5_2/in/pw_new" 2420 | top: "conv5_2/dw_new" 2421 | param { 2422 | lr_mult: 1 2423 | decay_mult: 1 2424 | } 2425 | convolution_param { 2426 | num_output: 576 2427 | bias_term: false 2428 | pad: 1 2429 | kernel_size: 3 2430 | engine: CAFFE 2431 | stride: 1 2432 | weight_filler { 2433 | type: "msra" 2434 | } 2435 | } 2436 | } 2437 | layer { 2438 | name: "conv5_2/dw/bn_new" 2439 | type: "BatchNorm" 2440 | bottom: "conv5_2/dw_new" 2441 | top: "conv5_2/dw_new" 2442 | param { 2443 | lr_mult: 0 2444 | decay_mult: 0 2445 | } 2446 | param { 2447 | lr_mult: 0 2448 | decay_mult: 0 2449 | } 2450 | param { 2451 | lr_mult: 0 2452 | decay_mult: 0 2453 | } 2454 | } 2455 | layer { 2456 | name: "conv5_2/dw/scale_new" 2457 | type: "Scale" 2458 | bottom: "conv5_2/dw_new" 2459 | top: "conv5_2/dw_new" 2460 | param { 2461 | lr_mult: 1 2462 | decay_mult: 0 2463 | } 2464 | param { 2465 | lr_mult: 1 2466 | decay_mult: 0 2467 | } 2468 | scale_param { 2469 | filler { 2470 | value: 1 2471 | } 2472 | bias_term: true 2473 | bias_filler { 2474 | value: 0 2475 | } 2476 | } 2477 | } 2478 | layer { 2479 | name: "relu5_2/dw_new" 2480 | type: "ReLU" 2481 | bottom: "conv5_2/dw_new" 2482 | top: "conv5_2/dw_new" 2483 | } 2484 | layer { 2485 | name: "conv5_2/out/pw_new" 2486 | type: "Convolution" 2487 | bottom: "conv5_2/dw_new" 2488 | top: "conv5_2/out/pw_new" 2489 | param { 2490 | lr_mult: 1 2491 | decay_mult: 1 2492 | } 2493 | convolution_param { 2494 | num_output: 96 2495 | bias_term: false 2496 | pad: 0 2497 | kernel_size: 1 2498 | engine: CAFFE 2499 | stride: 1 2500 | weight_filler { 2501 | type: "msra" 2502 | } 2503 | } 2504 | } 2505 | layer { 2506 | name: "conv5_2/out/pw/bn_new" 2507 | type: "BatchNorm" 2508 | bottom: "conv5_2/out/pw_new" 2509 | top: "conv5_2/out/pw_new" 2510 | param { 2511 | lr_mult: 0 2512 | decay_mult: 0 2513 | } 2514 | param { 2515 | lr_mult: 0 2516 | decay_mult: 0 2517 | } 2518 | param { 2519 | lr_mult: 0 2520 | decay_mult: 0 2521 | } 2522 | } 2523 | layer { 2524 | name: "conv5_2/out/pw/scale_new" 2525 | type: "Scale" 2526 | bottom: "conv5_2/out/pw_new" 2527 | top: "conv5_2/out/pw_new" 2528 | param { 2529 | lr_mult: 1 2530 | decay_mult: 0 2531 | } 2532 | param { 2533 | lr_mult: 1 2534 | decay_mult: 0 2535 | } 2536 | scale_param { 2537 | filler { 2538 | value: 1 2539 | } 2540 | bias_term: true 2541 | bias_filler { 2542 | value: 0 2543 | } 2544 | } 2545 | } 2546 | layer { 2547 | name: "fuse_conv5_2" 2548 | type: "Eltwise" 2549 | bottom: "conv5_1/out/pw_new" 2550 | bottom: "conv5_2/out/pw_new" 2551 | top: "fuse_conv5_2" 2552 | eltwise_param { 2553 | operation: SUM 2554 | } 2555 | } 2556 | layer { 2557 | name: "conv5_3/in/pw_new" 2558 | type: "Convolution" 2559 | bottom: "fuse_conv5_2" 2560 | top: "conv5_3/in/pw_new" 2561 | param { 2562 | lr_mult: 1 2563 | decay_mult: 1 2564 | } 2565 | convolution_param { 2566 | num_output: 576 2567 | bias_term: false 2568 | pad: 0 2569 | kernel_size: 1 2570 | engine: CAFFE 2571 | stride: 1 2572 | weight_filler { 2573 | type: "msra" 2574 | } 2575 | } 2576 | } 2577 | layer { 2578 | name: "conv5_3/in/pw/bn_new" 2579 | type: "BatchNorm" 2580 | bottom: "conv5_3/in/pw_new" 2581 | top: "conv5_3/in/pw_new" 2582 | param { 2583 | lr_mult: 0 2584 | decay_mult: 0 2585 | } 2586 | param { 2587 | lr_mult: 0 2588 | decay_mult: 0 2589 | } 2590 | param { 2591 | lr_mult: 0 2592 | decay_mult: 0 2593 | } 2594 | } 2595 | layer { 2596 | name: "conv5_3/in/pw/scale_new" 2597 | type: "Scale" 2598 | bottom: "conv5_3/in/pw_new" 2599 | top: "conv5_3/in/pw_new" 2600 | param { 2601 | lr_mult: 1 2602 | decay_mult: 0 2603 | } 2604 | param { 2605 | lr_mult: 1 2606 | decay_mult: 0 2607 | } 2608 | scale_param { 2609 | filler { 2610 | value: 1 2611 | } 2612 | bias_term: true 2613 | bias_filler { 2614 | value: 0 2615 | } 2616 | } 2617 | } 2618 | layer { 2619 | name: "relu5_3/in/pw_new" 2620 | type: "ReLU" 2621 | bottom: "conv5_3/in/pw_new" 2622 | top: "conv5_3/in/pw_new" 2623 | } 2624 | layer { 2625 | name: "conv5_3/dw_new" 2626 | type: "ConvolutionDepthwise" 2627 | bottom: "conv5_3/in/pw_new" 2628 | top: "conv5_3/dw_new" 2629 | param { 2630 | lr_mult: 1 2631 | decay_mult: 1 2632 | } 2633 | convolution_param { 2634 | num_output: 576 2635 | bias_term: false 2636 | pad: 1 2637 | kernel_size: 3 2638 | engine: CAFFE 2639 | stride: 1 2640 | weight_filler { 2641 | type: "msra" 2642 | } 2643 | } 2644 | } 2645 | layer { 2646 | name: "conv5_3/dw/bn_new" 2647 | type: "BatchNorm" 2648 | bottom: "conv5_3/dw_new" 2649 | top: "conv5_3/dw_new" 2650 | param { 2651 | lr_mult: 0 2652 | decay_mult: 0 2653 | } 2654 | param { 2655 | lr_mult: 0 2656 | decay_mult: 0 2657 | } 2658 | param { 2659 | lr_mult: 0 2660 | decay_mult: 0 2661 | } 2662 | } 2663 | layer { 2664 | name: "conv5_3/dw/scale_new" 2665 | type: "Scale" 2666 | bottom: "conv5_3/dw_new" 2667 | top: "conv5_3/dw_new" 2668 | param { 2669 | lr_mult: 1 2670 | decay_mult: 0 2671 | } 2672 | param { 2673 | lr_mult: 1 2674 | decay_mult: 0 2675 | } 2676 | scale_param { 2677 | filler { 2678 | value: 1 2679 | } 2680 | bias_term: true 2681 | bias_filler { 2682 | value: 0 2683 | } 2684 | } 2685 | } 2686 | layer { 2687 | name: "relu5_3/dw_new" 2688 | type: "ReLU" 2689 | bottom: "conv5_3/dw_new" 2690 | top: "conv5_3/dw_new" 2691 | } 2692 | layer { 2693 | name: "conv5_3/out/pw_new" 2694 | type: "Convolution" 2695 | bottom: "conv5_3/dw_new" 2696 | top: "conv5_3/out/pw_new" 2697 | param { 2698 | lr_mult: 1 2699 | decay_mult: 1 2700 | } 2701 | convolution_param { 2702 | num_output: 96 2703 | bias_term: false 2704 | pad: 0 2705 | kernel_size: 1 2706 | engine: CAFFE 2707 | stride: 1 2708 | weight_filler { 2709 | type: "msra" 2710 | } 2711 | } 2712 | } 2713 | layer { 2714 | name: "conv5_3/out/pw/bn_new" 2715 | type: "BatchNorm" 2716 | bottom: "conv5_3/out/pw_new" 2717 | top: "conv5_3/out/pw_new" 2718 | param { 2719 | lr_mult: 0 2720 | decay_mult: 0 2721 | } 2722 | param { 2723 | lr_mult: 0 2724 | decay_mult: 0 2725 | } 2726 | param { 2727 | lr_mult: 0 2728 | decay_mult: 0 2729 | } 2730 | } 2731 | layer { 2732 | name: "conv5_3/out/pw/scale_new" 2733 | type: "Scale" 2734 | bottom: "conv5_3/out/pw_new" 2735 | top: "conv5_3/out/pw_new" 2736 | param { 2737 | lr_mult: 1 2738 | decay_mult: 0 2739 | } 2740 | param { 2741 | lr_mult: 1 2742 | decay_mult: 0 2743 | } 2744 | scale_param { 2745 | filler { 2746 | value: 1 2747 | } 2748 | bias_term: true 2749 | bias_filler { 2750 | value: 0 2751 | } 2752 | } 2753 | } 2754 | layer { 2755 | name: "fuse_conv5_3" 2756 | type: "Eltwise" 2757 | bottom: "fuse_conv5_2" 2758 | bottom: "conv5_3/out/pw_new" 2759 | top: "fuse_conv5_3" 2760 | eltwise_param { 2761 | operation: SUM 2762 | } 2763 | } 2764 | ############################################### 2765 | 2766 | layer { 2767 | name: "conv6_1/in/pw_new" 2768 | type: "Convolution" 2769 | bottom: "fuse_conv5_3" 2770 | top: "conv6_1/in/pw_new" 2771 | param { 2772 | lr_mult: 1 2773 | decay_mult: 1 2774 | } 2775 | convolution_param { 2776 | num_output: 576 2777 | bias_term: false 2778 | pad: 0 2779 | kernel_size: 1 2780 | engine: CAFFE 2781 | stride: 1 2782 | weight_filler { 2783 | type: "msra" 2784 | } 2785 | } 2786 | } 2787 | layer { 2788 | name: "conv6_1/in/pw/bn_new" 2789 | type: "BatchNorm" 2790 | bottom: "conv6_1/in/pw_new" 2791 | top: "conv6_1/in/pw_new" 2792 | param { 2793 | lr_mult: 0 2794 | decay_mult: 0 2795 | } 2796 | param { 2797 | lr_mult: 0 2798 | decay_mult: 0 2799 | } 2800 | param { 2801 | lr_mult: 0 2802 | decay_mult: 0 2803 | } 2804 | } 2805 | layer { 2806 | name: "conv6_1/in/pw/scale_new" 2807 | type: "Scale" 2808 | bottom: "conv6_1/in/pw_new" 2809 | top: "conv6_1/in/pw_new" 2810 | param { 2811 | lr_mult: 1 2812 | decay_mult: 0 2813 | } 2814 | param { 2815 | lr_mult: 1 2816 | decay_mult: 0 2817 | } 2818 | scale_param { 2819 | filler { 2820 | value: 1 2821 | } 2822 | bias_term: true 2823 | bias_filler { 2824 | value: 0 2825 | } 2826 | } 2827 | } 2828 | layer { 2829 | name: "relu6_1/in/pw_new" 2830 | type: "ReLU" 2831 | bottom: "conv6_1/in/pw_new" 2832 | top: "conv6_1/in/pw_new" 2833 | } 2834 | layer { 2835 | name: "conv6_1/dw_new" 2836 | type: "ConvolutionDepthwise" 2837 | bottom: "conv6_1/in/pw_new" 2838 | top: "conv6_1/dw_new" 2839 | param { 2840 | lr_mult: 1 2841 | decay_mult: 1 2842 | } 2843 | convolution_param { 2844 | num_output: 576 2845 | bias_term: false 2846 | pad: 1 2847 | kernel_size: 3 2848 | engine: CAFFE 2849 | stride: 2 2850 | weight_filler { 2851 | type: "msra" 2852 | } 2853 | } 2854 | } 2855 | layer { 2856 | name: "conv6_1/dw/bn_new" 2857 | type: "BatchNorm" 2858 | bottom: "conv6_1/dw_new" 2859 | top: "conv6_1/dw_new" 2860 | param { 2861 | lr_mult: 0 2862 | decay_mult: 0 2863 | } 2864 | param { 2865 | lr_mult: 0 2866 | decay_mult: 0 2867 | } 2868 | param { 2869 | lr_mult: 0 2870 | decay_mult: 0 2871 | } 2872 | } 2873 | layer { 2874 | name: "conv6_1/dw/scale_new" 2875 | type: "Scale" 2876 | bottom: "conv6_1/dw_new" 2877 | top: "conv6_1/dw_new" 2878 | param { 2879 | lr_mult: 1 2880 | decay_mult: 0 2881 | } 2882 | param { 2883 | lr_mult: 1 2884 | decay_mult: 0 2885 | } 2886 | scale_param { 2887 | filler { 2888 | value: 1 2889 | } 2890 | bias_term: true 2891 | bias_filler { 2892 | value: 0 2893 | } 2894 | } 2895 | } 2896 | layer { 2897 | name: "relu6_1/dw_new" 2898 | type: "ReLU" 2899 | bottom: "conv6_1/dw_new" 2900 | top: "conv6_1/dw_new" 2901 | } 2902 | layer { 2903 | name: "conv6_1/out/pw_new" 2904 | type: "Convolution" 2905 | bottom: "conv6_1/dw_new" 2906 | top: "conv6_1/out/pw_new" 2907 | param { 2908 | lr_mult: 1 2909 | decay_mult: 1 2910 | } 2911 | convolution_param { 2912 | num_output: 160 2913 | bias_term: false 2914 | pad: 0 2915 | kernel_size: 1 2916 | engine: CAFFE 2917 | stride: 1 2918 | weight_filler { 2919 | type: "msra" 2920 | } 2921 | } 2922 | } 2923 | layer { 2924 | name: "conv6_1/out/pw/bn_new" 2925 | type: "BatchNorm" 2926 | bottom: "conv6_1/out/pw_new" 2927 | top: "conv6_1/out/pw_new" 2928 | param { 2929 | lr_mult: 0 2930 | decay_mult: 0 2931 | } 2932 | param { 2933 | lr_mult: 0 2934 | decay_mult: 0 2935 | } 2936 | param { 2937 | lr_mult: 0 2938 | decay_mult: 0 2939 | } 2940 | } 2941 | layer { 2942 | name: "conv6_1/out/pw/scale_new" 2943 | type: "Scale" 2944 | bottom: "conv6_1/out/pw_new" 2945 | top: "conv6_1/out/pw_new" 2946 | param { 2947 | lr_mult: 1 2948 | decay_mult: 0 2949 | } 2950 | param { 2951 | lr_mult: 1 2952 | decay_mult: 0 2953 | } 2954 | scale_param { 2955 | filler { 2956 | value: 1 2957 | } 2958 | bias_term: true 2959 | bias_filler { 2960 | value: 0 2961 | } 2962 | } 2963 | } 2964 | layer { 2965 | name: "conv6_2/in/pw_new" 2966 | type: "Convolution" 2967 | bottom: "conv6_1/out/pw_new" 2968 | top: "conv6_2/in/pw_new" 2969 | param { 2970 | lr_mult: 1 2971 | decay_mult: 1 2972 | } 2973 | convolution_param { 2974 | num_output: 960 2975 | bias_term: false 2976 | pad: 0 2977 | kernel_size: 1 2978 | engine: CAFFE 2979 | stride: 1 2980 | weight_filler { 2981 | type: "msra" 2982 | } 2983 | } 2984 | } 2985 | layer { 2986 | name: "conv6_2/in/pw/bn_new" 2987 | type: "BatchNorm" 2988 | bottom: "conv6_2/in/pw_new" 2989 | top: "conv6_2/in/pw_new" 2990 | param { 2991 | lr_mult: 0 2992 | decay_mult: 0 2993 | } 2994 | param { 2995 | lr_mult: 0 2996 | decay_mult: 0 2997 | } 2998 | param { 2999 | lr_mult: 0 3000 | decay_mult: 0 3001 | } 3002 | } 3003 | layer { 3004 | name: "conv6_2/in/pw/scale_new" 3005 | type: "Scale" 3006 | bottom: "conv6_2/in/pw_new" 3007 | top: "conv6_2/in/pw_new" 3008 | param { 3009 | lr_mult: 1 3010 | decay_mult: 0 3011 | } 3012 | param { 3013 | lr_mult: 1 3014 | decay_mult: 0 3015 | } 3016 | scale_param { 3017 | filler { 3018 | value: 1 3019 | } 3020 | bias_term: true 3021 | bias_filler { 3022 | value: 0 3023 | } 3024 | } 3025 | } 3026 | layer { 3027 | name: "relu6_2/in/pw_new" 3028 | type: "ReLU" 3029 | bottom: "conv6_2/in/pw_new" 3030 | top: "conv6_2/in/pw_new" 3031 | } 3032 | layer { 3033 | name: "conv6_2/dw_new" 3034 | type: "ConvolutionDepthwise" 3035 | bottom: "conv6_2/in/pw_new" 3036 | top: "conv6_2/dw_new" 3037 | param { 3038 | lr_mult: 1 3039 | decay_mult: 1 3040 | } 3041 | convolution_param { 3042 | num_output: 960 3043 | bias_term: false 3044 | pad: 1 3045 | kernel_size: 3 3046 | engine: CAFFE 3047 | stride: 1 3048 | weight_filler { 3049 | type: "msra" 3050 | } 3051 | } 3052 | } 3053 | layer { 3054 | name: "conv6_2/dw/bn_new" 3055 | type: "BatchNorm" 3056 | bottom: "conv6_2/dw_new" 3057 | top: "conv6_2/dw_new" 3058 | param { 3059 | lr_mult: 0 3060 | decay_mult: 0 3061 | } 3062 | param { 3063 | lr_mult: 0 3064 | decay_mult: 0 3065 | } 3066 | param { 3067 | lr_mult: 0 3068 | decay_mult: 0 3069 | } 3070 | } 3071 | layer { 3072 | name: "conv6_2/dw/scale_new" 3073 | type: "Scale" 3074 | bottom: "conv6_2/dw_new" 3075 | top: "conv6_2/dw_new" 3076 | param { 3077 | lr_mult: 1 3078 | decay_mult: 0 3079 | } 3080 | param { 3081 | lr_mult: 1 3082 | decay_mult: 0 3083 | } 3084 | scale_param { 3085 | filler { 3086 | value: 1 3087 | } 3088 | bias_term: true 3089 | bias_filler { 3090 | value: 0 3091 | } 3092 | } 3093 | } 3094 | layer { 3095 | name: "relu6_2/dw_new" 3096 | type: "ReLU" 3097 | bottom: "conv6_2/dw_new" 3098 | top: "conv6_2/dw_new" 3099 | } 3100 | layer { 3101 | name: "conv6_2/out/pw_new" 3102 | type: "Convolution" 3103 | bottom: "conv6_2/dw_new" 3104 | top: "conv6_2/out/pw_new" 3105 | param { 3106 | lr_mult: 1 3107 | decay_mult: 1 3108 | } 3109 | convolution_param { 3110 | num_output: 160 3111 | bias_term: false 3112 | pad: 0 3113 | kernel_size: 1 3114 | engine: CAFFE 3115 | stride: 1 3116 | weight_filler { 3117 | type: "msra" 3118 | } 3119 | } 3120 | } 3121 | layer { 3122 | name: "conv6_2/out/pw/bn_new" 3123 | type: "BatchNorm" 3124 | bottom: "conv6_2/out/pw_new" 3125 | top: "conv6_2/out/pw_new" 3126 | param { 3127 | lr_mult: 0 3128 | decay_mult: 0 3129 | } 3130 | param { 3131 | lr_mult: 0 3132 | decay_mult: 0 3133 | } 3134 | param { 3135 | lr_mult: 0 3136 | decay_mult: 0 3137 | } 3138 | } 3139 | layer { 3140 | name: "conv6_2/out/pw/scale_new" 3141 | type: "Scale" 3142 | bottom: "conv6_2/out/pw_new" 3143 | top: "conv6_2/out/pw_new" 3144 | param { 3145 | lr_mult: 1 3146 | decay_mult: 0 3147 | } 3148 | param { 3149 | lr_mult: 1 3150 | decay_mult: 0 3151 | } 3152 | scale_param { 3153 | filler { 3154 | value: 1 3155 | } 3156 | bias_term: true 3157 | bias_filler { 3158 | value: 0 3159 | } 3160 | } 3161 | } 3162 | layer { 3163 | name: "fuse_conv6_2" 3164 | type: "Eltwise" 3165 | bottom: "conv6_1/out/pw_new" 3166 | bottom: "conv6_2/out/pw_new" 3167 | top: "fuse_conv6_2" 3168 | eltwise_param { 3169 | operation: SUM 3170 | } 3171 | } 3172 | layer { 3173 | name: "conv6_3/in/pw_new" 3174 | type: "Convolution" 3175 | bottom: "fuse_conv6_2" 3176 | top: "conv6_3/in/pw_new" 3177 | param { 3178 | lr_mult: 1 3179 | decay_mult: 1 3180 | } 3181 | convolution_param { 3182 | num_output: 960 3183 | bias_term: false 3184 | pad: 0 3185 | kernel_size: 1 3186 | engine: CAFFE 3187 | stride: 1 3188 | weight_filler { 3189 | type: "msra" 3190 | } 3191 | } 3192 | } 3193 | layer { 3194 | name: "conv6_3/in/pw/bn_new" 3195 | type: "BatchNorm" 3196 | bottom: "conv6_3/in/pw_new" 3197 | top: "conv6_3/in/pw_new" 3198 | param { 3199 | lr_mult: 0 3200 | decay_mult: 0 3201 | } 3202 | param { 3203 | lr_mult: 0 3204 | decay_mult: 0 3205 | } 3206 | param { 3207 | lr_mult: 0 3208 | decay_mult: 0 3209 | } 3210 | } 3211 | layer { 3212 | name: "conv6_3/in/pw/scale_new" 3213 | type: "Scale" 3214 | bottom: "conv6_3/in/pw_new" 3215 | top: "conv6_3/in/pw_new" 3216 | param { 3217 | lr_mult: 1 3218 | decay_mult: 0 3219 | } 3220 | param { 3221 | lr_mult: 1 3222 | decay_mult: 0 3223 | } 3224 | scale_param { 3225 | filler { 3226 | value: 1 3227 | } 3228 | bias_term: true 3229 | bias_filler { 3230 | value: 0 3231 | } 3232 | } 3233 | } 3234 | layer { 3235 | name: "relu6_3/in/pw_new" 3236 | type: "ReLU" 3237 | bottom: "conv6_3/in/pw_new" 3238 | top: "conv6_3/in/pw_new" 3239 | } 3240 | layer { 3241 | name: "conv6_3/dw_new" 3242 | type: "ConvolutionDepthwise" 3243 | bottom: "conv6_3/in/pw_new" 3244 | top: "conv6_3/dw_new" 3245 | param { 3246 | lr_mult: 1 3247 | decay_mult: 1 3248 | } 3249 | convolution_param { 3250 | num_output: 960 3251 | bias_term: false 3252 | pad: 1 3253 | kernel_size: 3 3254 | engine: CAFFE 3255 | stride: 1 3256 | weight_filler { 3257 | type: "msra" 3258 | } 3259 | } 3260 | } 3261 | layer { 3262 | name: "conv6_3/dw/bn_new" 3263 | type: "BatchNorm" 3264 | bottom: "conv6_3/dw_new" 3265 | top: "conv6_3/dw_new" 3266 | param { 3267 | lr_mult: 0 3268 | decay_mult: 0 3269 | } 3270 | param { 3271 | lr_mult: 0 3272 | decay_mult: 0 3273 | } 3274 | param { 3275 | lr_mult: 0 3276 | decay_mult: 0 3277 | } 3278 | } 3279 | layer { 3280 | name: "conv6_3/dw/scale_new" 3281 | type: "Scale" 3282 | bottom: "conv6_3/dw_new" 3283 | top: "conv6_3/dw_new" 3284 | param { 3285 | lr_mult: 1 3286 | decay_mult: 0 3287 | } 3288 | param { 3289 | lr_mult: 1 3290 | decay_mult: 0 3291 | } 3292 | scale_param { 3293 | filler { 3294 | value: 1 3295 | } 3296 | bias_term: true 3297 | bias_filler { 3298 | value: 0 3299 | } 3300 | } 3301 | } 3302 | layer { 3303 | name: "relu6_3/dw_new" 3304 | type: "ReLU" 3305 | bottom: "conv6_3/dw_new" 3306 | top: "conv6_3/dw_new" 3307 | } 3308 | layer { 3309 | name: "conv6_3/out/pw_new" 3310 | type: "Convolution" 3311 | bottom: "conv6_3/dw_new" 3312 | top: "conv6_3/out/pw_new" 3313 | param { 3314 | lr_mult: 1 3315 | decay_mult: 1 3316 | } 3317 | convolution_param { 3318 | num_output: 160 3319 | bias_term: false 3320 | pad: 0 3321 | kernel_size: 1 3322 | engine: CAFFE 3323 | stride: 1 3324 | weight_filler { 3325 | type: "msra" 3326 | } 3327 | } 3328 | } 3329 | layer { 3330 | name: "conv6_3/out/pw/bn_new" 3331 | type: "BatchNorm" 3332 | bottom: "conv6_3/out/pw_new" 3333 | top: "conv6_3/out/pw_new" 3334 | param { 3335 | lr_mult: 0 3336 | decay_mult: 0 3337 | } 3338 | param { 3339 | lr_mult: 0 3340 | decay_mult: 0 3341 | } 3342 | param { 3343 | lr_mult: 0 3344 | decay_mult: 0 3345 | } 3346 | } 3347 | layer { 3348 | name: "conv6_3/out/pw/scale_new" 3349 | type: "Scale" 3350 | bottom: "conv6_3/out/pw_new" 3351 | top: "conv6_3/out/pw_new" 3352 | param { 3353 | lr_mult: 1 3354 | decay_mult: 0 3355 | } 3356 | param { 3357 | lr_mult: 1 3358 | decay_mult: 0 3359 | } 3360 | scale_param { 3361 | filler { 3362 | value: 1 3363 | } 3364 | bias_term: true 3365 | bias_filler { 3366 | value: 0 3367 | } 3368 | } 3369 | } 3370 | layer { 3371 | name: "fuse_conv6_3" 3372 | type: "Eltwise" 3373 | bottom: "fuse_conv6_2" 3374 | bottom: "conv6_3/out/pw_new" 3375 | top: "fuse_conv6_3" 3376 | eltwise_param { 3377 | operation: SUM 3378 | } 3379 | } 3380 | ############################################### 3381 | 3382 | layer { 3383 | name: "conv7_1/in/pw_new" 3384 | type: "Convolution" 3385 | bottom: "fuse_conv6_3" 3386 | top: "conv7_1/in/pw_new" 3387 | param { 3388 | lr_mult: 1 3389 | decay_mult: 1 3390 | } 3391 | convolution_param { 3392 | num_output: 960 3393 | bias_term: false 3394 | pad: 0 3395 | kernel_size: 1 3396 | engine: CAFFE 3397 | stride: 1 3398 | weight_filler { 3399 | type: "msra" 3400 | } 3401 | } 3402 | } 3403 | layer { 3404 | name: "conv7_1/in/pw/bn_new" 3405 | type: "BatchNorm" 3406 | bottom: "conv7_1/in/pw_new" 3407 | top: "conv7_1/in/pw_new" 3408 | param { 3409 | lr_mult: 0 3410 | decay_mult: 0 3411 | } 3412 | param { 3413 | lr_mult: 0 3414 | decay_mult: 0 3415 | } 3416 | param { 3417 | lr_mult: 0 3418 | decay_mult: 0 3419 | } 3420 | } 3421 | layer { 3422 | name: "conv7_1/in/pw/scale_new" 3423 | type: "Scale" 3424 | bottom: "conv7_1/in/pw_new" 3425 | top: "conv7_1/in/pw_new" 3426 | param { 3427 | lr_mult: 1 3428 | decay_mult: 0 3429 | } 3430 | param { 3431 | lr_mult: 1 3432 | decay_mult: 0 3433 | } 3434 | scale_param { 3435 | filler { 3436 | value: 1 3437 | } 3438 | bias_term: true 3439 | bias_filler { 3440 | value: 0 3441 | } 3442 | } 3443 | } 3444 | layer { 3445 | name: "relu7_1/in/pw_new" 3446 | type: "ReLU" 3447 | bottom: "conv7_1/in/pw_new" 3448 | top: "conv7_1/in/pw_new" 3449 | } 3450 | layer { 3451 | name: "conv7_1/dw_new" 3452 | type: "ConvolutionDepthwise" 3453 | bottom: "conv7_1/in/pw_new" 3454 | top: "conv7_1/dw_new" 3455 | param { 3456 | lr_mult: 1 3457 | decay_mult: 1 3458 | } 3459 | convolution_param { 3460 | num_output: 960 3461 | bias_term: false 3462 | pad: 1 3463 | kernel_size: 3 3464 | engine: CAFFE 3465 | stride: 1 3466 | weight_filler { 3467 | type: "msra" 3468 | } 3469 | } 3470 | } 3471 | layer { 3472 | name: "conv7_1/dw/bn_new" 3473 | type: "BatchNorm" 3474 | bottom: "conv7_1/dw_new" 3475 | top: "conv7_1/dw_new" 3476 | param { 3477 | lr_mult: 0 3478 | decay_mult: 0 3479 | } 3480 | param { 3481 | lr_mult: 0 3482 | decay_mult: 0 3483 | } 3484 | param { 3485 | lr_mult: 0 3486 | decay_mult: 0 3487 | } 3488 | } 3489 | layer { 3490 | name: "conv7_1/dw/scale_new" 3491 | type: "Scale" 3492 | bottom: "conv7_1/dw_new" 3493 | top: "conv7_1/dw_new" 3494 | param { 3495 | lr_mult: 1 3496 | decay_mult: 0 3497 | } 3498 | param { 3499 | lr_mult: 1 3500 | decay_mult: 0 3501 | } 3502 | scale_param { 3503 | filler { 3504 | value: 1 3505 | } 3506 | bias_term: true 3507 | bias_filler { 3508 | value: 0 3509 | } 3510 | } 3511 | } 3512 | layer { 3513 | name: "relu7_1/dw_new" 3514 | type: "ReLU" 3515 | bottom: "conv7_1/dw_new" 3516 | top: "conv7_1/dw_new" 3517 | } 3518 | layer { 3519 | name: "conv7_1/out/pw_new" 3520 | type: "Convolution" 3521 | bottom: "conv7_1/dw_new" 3522 | top: "conv7_1/out/pw_new" 3523 | param { 3524 | lr_mult: 1 3525 | decay_mult: 1 3526 | } 3527 | convolution_param { 3528 | num_output: 320 3529 | bias_term: false 3530 | pad: 0 3531 | kernel_size: 1 3532 | engine: CAFFE 3533 | stride: 1 3534 | weight_filler { 3535 | type: "msra" 3536 | } 3537 | } 3538 | } 3539 | layer { 3540 | name: "conv7_1/out/pw/bn_new" 3541 | type: "BatchNorm" 3542 | bottom: "conv7_1/out/pw_new" 3543 | top: "conv7_1/out/pw_new" 3544 | param { 3545 | lr_mult: 0 3546 | decay_mult: 0 3547 | } 3548 | param { 3549 | lr_mult: 0 3550 | decay_mult: 0 3551 | } 3552 | param { 3553 | lr_mult: 0 3554 | decay_mult: 0 3555 | } 3556 | } 3557 | layer { 3558 | name: "conv7_1/out/pw/scale_new" 3559 | type: "Scale" 3560 | bottom: "conv7_1/out/pw_new" 3561 | top: "conv7_1/out/pw_new" 3562 | param { 3563 | lr_mult: 1 3564 | decay_mult: 0 3565 | } 3566 | param { 3567 | lr_mult: 1 3568 | decay_mult: 0 3569 | } 3570 | scale_param { 3571 | filler { 3572 | value: 1 3573 | } 3574 | bias_term: true 3575 | bias_filler { 3576 | value: 0 3577 | } 3578 | } 3579 | } 3580 | layer { 3581 | name: "conv8_new" 3582 | type: "Convolution" 3583 | bottom: "conv7_1/out/pw_new" 3584 | top: "conv8_new" 3585 | param { 3586 | lr_mult: 1 3587 | decay_mult: 1 3588 | } 3589 | convolution_param { 3590 | num_output: 1280 3591 | bias_term: false 3592 | pad: 0 3593 | kernel_size: 1 3594 | stride: 1 3595 | weight_filler { 3596 | type: "msra" 3597 | } 3598 | } 3599 | } 3600 | layer { 3601 | name: "conv8/bn_new" 3602 | type: "BatchNorm" 3603 | bottom: "conv8_new" 3604 | top: "conv8_new" 3605 | param { 3606 | lr_mult: 0 3607 | decay_mult: 0 3608 | } 3609 | param { 3610 | lr_mult: 0 3611 | decay_mult: 0 3612 | } 3613 | param { 3614 | lr_mult: 0 3615 | decay_mult: 0 3616 | } 3617 | } 3618 | layer { 3619 | name: "conv8/scale_new" 3620 | type: "Scale" 3621 | bottom: "conv8_new" 3622 | top: "conv8_new" 3623 | param { 3624 | lr_mult: 1 3625 | decay_mult: 0 3626 | } 3627 | param { 3628 | lr_mult: 1 3629 | decay_mult: 0 3630 | } 3631 | scale_param { 3632 | filler { 3633 | value: 1 3634 | } 3635 | bias_term: true 3636 | bias_filler { 3637 | value: 0 3638 | } 3639 | } 3640 | } 3641 | layer { 3642 | name: "relu8_new" 3643 | type: "ReLU" 3644 | bottom: "conv8_new" 3645 | top: "conv8_new" 3646 | } 3647 | layer { 3648 | name: "pool8_new" 3649 | type: "Pooling" 3650 | bottom: "conv8_new" 3651 | top: "pool8_new" 3652 | pooling_param { 3653 | pool: AVE 3654 | global_pooling: true 3655 | } 3656 | } 3657 | layer { 3658 | name: "fc8_new" 3659 | type: "Convolution" 3660 | bottom: "pool8_new" 3661 | top: "fc8_new" 3662 | param { 3663 | lr_mult: 1 3664 | decay_mult: 1 3665 | } 3666 | param { 3667 | lr_mult: 2 3668 | decay_mult: 0 3669 | } 3670 | convolution_param { 3671 | num_output: 1000 3672 | kernel_size: 1 3673 | weight_filler { 3674 | type: "msra" 3675 | } 3676 | bias_filler { 3677 | type: "constant" 3678 | value: 0 3679 | } 3680 | } 3681 | } 3682 | 3683 | layer { 3684 | name: "accuracy/top1" 3685 | type: "Accuracy" 3686 | bottom: "fc8_new" 3687 | bottom: "label" 3688 | top: "accuracy@1" 3689 | include: { phase: TEST } 3690 | accuracy_param { 3691 | top_k: 1 3692 | } 3693 | } 3694 | layer { 3695 | name: "accuracy/top5" 3696 | type: "Accuracy" 3697 | bottom: "fc8_new" 3698 | bottom: "label" 3699 | top: "accuracy@5" 3700 | include: { phase: TEST } 3701 | accuracy_param { 3702 | top_k: 5 3703 | } 3704 | } 3705 | 3706 | -------------------------------------------------------------------------------- /.gitignore/benchmark_mobilenetv2.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ./build/tools/caffe test \ 4 | --model=****/MobileNetV2_deploy.prototxt \ 5 | --weights=****/mobilenet_v2_new.caffemodel \ 6 | --gpu=0 --iterations=2000 7 | -------------------------------------------------------------------------------- /.gitignore/conv_dw_layer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include "caffe/filler.hpp" 4 | #include "caffe/layers/conv_dw_layer.hpp" 5 | 6 | namespace caffe { 7 | 8 | template 9 | void ConvolutionDepthwiseLayer::LayerSetUp(const vector*>& bottom, 10 | const vector*>& top) { 11 | ConvolutionParameter conv_param = this->layer_param_.convolution_param(); 12 | if (conv_param.has_kernel_h() && conv_param.has_kernel_w()) { 13 | kernel_h_ = conv_param.kernel_h(); 14 | kernel_w_ = conv_param.kernel_w(); 15 | } else { 16 | if (conv_param.kernel_size_size() == 1) 17 | { 18 | kernel_h_ = conv_param.kernel_size(0); 19 | kernel_w_ = conv_param.kernel_size(0); 20 | } 21 | else 22 | { 23 | kernel_h_ = conv_param.kernel_size(0); 24 | kernel_w_ = conv_param.kernel_size(1); 25 | } 26 | } 27 | if (conv_param.has_stride_h() && conv_param.has_stride_w()) { 28 | stride_h_ = conv_param.stride_h(); 29 | stride_w_ = conv_param.stride_w(); 30 | } else { 31 | if (conv_param.stride_size() == 1) 32 | { 33 | stride_h_ = conv_param.stride(0); 34 | stride_w_ = conv_param.stride(0); 35 | } 36 | else 37 | { 38 | stride_h_ = conv_param.stride(0); 39 | stride_w_ = conv_param.stride(1); 40 | } 41 | } 42 | if (conv_param.has_pad_h() && conv_param.has_pad_w()) { 43 | pad_h_ = conv_param.pad_h(); 44 | pad_w_ = conv_param.pad_w(); 45 | } else { 46 | if (conv_param.pad_size() == 1) 47 | { 48 | pad_h_ = conv_param.pad(0); 49 | pad_w_ = conv_param.pad(0); 50 | } 51 | else 52 | { 53 | pad_h_ = conv_param.pad(0); 54 | pad_w_ = conv_param.pad(1); 55 | } 56 | } 57 | if (conv_param.dilation_size() > 0) 58 | { 59 | if (conv_param.dilation_size() == 1) 60 | { 61 | dilation_h_ = conv_param.dilation(0); 62 | dilation_w_ = conv_param.dilation(0); 63 | } 64 | else 65 | { 66 | dilation_h_ = conv_param.dilation(0); 67 | dilation_w_ = conv_param.dilation(1); 68 | } 69 | } 70 | else 71 | { 72 | dilation_h_ = 1; 73 | dilation_w_ = 1; 74 | } 75 | vector weight_shape(4); 76 | weight_shape[0] = bottom[0]->channels(); 77 | weight_shape[1] = 1; 78 | weight_shape[2] = kernel_h_; 79 | weight_shape[3] = kernel_w_; 80 | vector bias_shape; 81 | if (conv_param.bias_term()) 82 | { 83 | bias_shape.push_back(bottom[0]->channels()); 84 | } 85 | if (this->blobs_.size() == 0) { 86 | if (conv_param.bias_term()) { 87 | this->blobs_.resize(2); 88 | } else { 89 | this->blobs_.resize(1); 90 | } 91 | this->blobs_[0].reset(new Blob(weight_shape)); 92 | shared_ptr > weight_filler(GetFiller(conv_param.weight_filler())); 93 | weight_filler->Fill(this->blobs_[0].get()); 94 | if (conv_param.bias_term()) { 95 | this->blobs_[1].reset(new Blob(bias_shape)); 96 | shared_ptr > bias_filler(GetFiller(conv_param.bias_filler())); 97 | bias_filler->Fill(this->blobs_[1].get()); 98 | } 99 | } 100 | this->param_propagate_down_.resize(this->blobs_.size(), true); 101 | } 102 | 103 | template 104 | void ConvolutionDepthwiseLayer::Reshape(const vector*>& bottom, 105 | const vector*>& top) { 106 | vector top_shape; 107 | top_shape.push_back(bottom[0]->num()); 108 | top_shape.push_back(bottom[0]->channels()); 109 | top_shape.push_back((bottom[0]->height() + 2 * pad_h_ - (dilation_h_ * (kernel_h_ - 1) + 1)) / stride_h_ + 1); 110 | top_shape.push_back((bottom[0]->width() + 2 * pad_w_ - (dilation_w_ * (kernel_w_ - 1) + 1)) / stride_w_ + 1); 111 | top[0]->Reshape(top_shape); 112 | vector weight_buffer_shape; 113 | weight_buffer_shape.push_back(bottom[0]->channels()); 114 | weight_buffer_shape.push_back(kernel_h_); 115 | weight_buffer_shape.push_back(kernel_w_); 116 | weight_buffer_shape.push_back(bottom[0]->num()); 117 | weight_buffer_shape.push_back(top[0]->height()); 118 | weight_buffer_shape.push_back(top[0]->width()); 119 | weight_buffer_.Reshape(weight_buffer_shape); 120 | vector weight_multiplier_shape; 121 | weight_multiplier_shape.push_back(bottom[0]->num()); 122 | weight_multiplier_shape.push_back(top[0]->height()); 123 | weight_multiplier_shape.push_back(top[0]->width()); 124 | weight_multiplier_.Reshape(weight_multiplier_shape); 125 | caffe_gpu_set(weight_multiplier_.count(), Dtype(1), weight_multiplier_.mutable_gpu_data()); 126 | if (this->layer_param_.convolution_param().bias_term()) 127 | { 128 | vector bias_buffer_shape; 129 | bias_buffer_shape.push_back(bottom[0]->channels()); 130 | bias_buffer_shape.push_back(bottom[0]->num()); 131 | bias_buffer_shape.push_back(top[0]->height()); 132 | bias_buffer_shape.push_back(top[0]->width()); 133 | bias_buffer_.Reshape(bias_buffer_shape); 134 | vector bias_multiplier_shape; 135 | bias_multiplier_shape.push_back(bottom[0]->num()); 136 | bias_multiplier_shape.push_back(top[0]->height()); 137 | bias_multiplier_shape.push_back(top[0]->width()); 138 | bias_multiplier_.Reshape(bias_multiplier_shape); 139 | caffe_gpu_set(bias_multiplier_.count(), Dtype(1), bias_multiplier_.mutable_gpu_data()); 140 | } 141 | } 142 | 143 | template 144 | void ConvolutionDepthwiseLayer::Forward_cpu(const vector*>& bottom, 145 | const vector*>& top) 146 | { 147 | const int num = top[0]->num(); 148 | const int channels = top[0]->channels(); 149 | const int top_height = top[0]->height(); 150 | const int top_width = top[0]->width(); 151 | const int bottom_height = bottom[0]->height(); 152 | const int bottom_width = bottom[0]->width(); 153 | const Dtype* bottom_data = bottom[0]->cpu_data(); 154 | const Dtype* weight_data_base = this->blobs_[0]->cpu_data(); 155 | Dtype* top_data = top[0]->mutable_cpu_data(); 156 | for (int n = 0; n < num; ++n) 157 | { 158 | for (int c = 0; c < channels; ++c) 159 | { 160 | for (int h = 0; h < top_height; ++h) 161 | { 162 | for (int w = 0; w < top_width; ++w) 163 | { 164 | const Dtype* weight_data = weight_data_base + c * kernel_h_ * kernel_w_; 165 | Dtype value = 0; 166 | for (int kh = 0; kh < kernel_h_; ++kh) 167 | { 168 | for (int kw = 0; kw < kernel_w_; ++kw) 169 | { 170 | int h_in = -pad_h_ + h * stride_h_ + kh * dilation_h_; 171 | int w_in = -pad_w_ + w * stride_w_ + kw * dilation_w_; 172 | if ((h_in >= 0) && (h_in < bottom_height) && (w_in >= 0) && (w_in < bottom_width)) 173 | { 174 | int offset = ((n * channels + c) * bottom_height + h_in) * bottom_width + w_in; 175 | value += (*weight_data) * bottom_data[offset]; 176 | } 177 | ++weight_data; 178 | } 179 | } 180 | *top_data++ = value; 181 | } 182 | } 183 | } 184 | } 185 | if (this->layer_param_.convolution_param().bias_term()) 186 | { 187 | top_data = top[0]->mutable_cpu_data(); 188 | for (int n = 0; n < num; ++n) 189 | { 190 | const Dtype* bias_data = this->blobs_[1]->cpu_data(); 191 | for (int c = 0; c < channels; ++c) 192 | { 193 | for (int h = 0; h < top_height; ++h) 194 | { 195 | for (int w = 0; w < top_width; ++w) 196 | { 197 | *top_data += *bias_data; 198 | ++top_data; 199 | } 200 | } 201 | ++bias_data; 202 | } 203 | } 204 | } 205 | } 206 | 207 | template 208 | void ConvolutionDepthwiseLayer::Backward_cpu(const vector*>& top, 209 | const vector& propagate_down, const vector*>& bottom) 210 | { 211 | const int num = top[0]->num(); 212 | const int channels = top[0]->channels(); 213 | const int top_height = top[0]->height(); 214 | const int top_width = top[0]->width(); 215 | const int bottom_height = bottom[0]->height(); 216 | const int bottom_width = bottom[0]->width(); 217 | caffe_set(bottom[0]->count(), Dtype(0), bottom[0]->mutable_cpu_diff()); 218 | if (this->layer_param_.convolution_param().bias_term() && this->param_propagate_down_[1]) 219 | { 220 | const Dtype* top_diff = top[0]->cpu_diff(); 221 | for (int n = 0; n < num; ++n) 222 | { 223 | Dtype* bias_diff = this->blobs_[1]->mutable_cpu_diff(); 224 | for (int c = 0; c < channels; ++c) 225 | { 226 | for (int h = 0; h < top_height; ++h) 227 | { 228 | for (int w = 0; w < top_width; ++w) 229 | { 230 | *bias_diff += *top_diff; 231 | ++top_diff; 232 | } 233 | } 234 | ++bias_diff; 235 | } 236 | } 237 | } 238 | if (this->param_propagate_down_[0]) 239 | { 240 | const Dtype* top_diff = top[0]->cpu_diff(); 241 | const Dtype* bottom_data = bottom[0]->cpu_data(); 242 | Dtype* weight_diff_base = this->blobs_[0]->mutable_cpu_diff(); 243 | for (int n = 0; n < num; ++n) 244 | { 245 | for (int c = 0; c < channels; ++c) 246 | { 247 | for (int h = 0; h < top_height; ++h) 248 | { 249 | for (int w = 0; w < top_width; ++w) 250 | { 251 | Dtype* weight_diff = weight_diff_base + c * kernel_h_ * kernel_w_; 252 | for (int kh = 0; kh < kernel_h_; ++kh) 253 | { 254 | for (int kw = 0; kw < kernel_w_; ++kw) 255 | { 256 | int h_in = -pad_h_ + h * stride_h_ + kh * dilation_h_; 257 | int w_in = -pad_w_ + w * stride_w_ + kw * dilation_w_; 258 | if ((h_in >= 0) && (h_in < bottom_height) && (w_in >= 0) && (w_in < bottom_width)) 259 | { 260 | int offset = ((n * channels + c) * bottom_height + h_in) * bottom_width + w_in; 261 | *weight_diff += bottom_data[offset] * (*top_diff); 262 | } 263 | ++weight_diff; 264 | } 265 | } 266 | ++top_diff; 267 | } 268 | } 269 | } 270 | } 271 | } 272 | if (propagate_down[0]) 273 | { 274 | const Dtype* top_diff = top[0]->cpu_diff(); 275 | const Dtype* weight_data_base = this->blobs_[0]->cpu_data(); 276 | Dtype* bottom_diff = bottom[0]->mutable_cpu_diff(); 277 | for (int n = 0; n < num; ++n) 278 | { 279 | for (int c = 0; c < channels; ++c) 280 | { 281 | for (int h = 0; h < top_height; ++h) 282 | { 283 | for (int w = 0; w < top_width; ++w) 284 | { 285 | const Dtype* weight_data = weight_data_base + c * kernel_h_ * kernel_w_; 286 | for (int kh = 0; kh < kernel_h_; ++kh) 287 | { 288 | for (int kw = 0; kw < kernel_w_; ++kw) 289 | { 290 | int h_in = -pad_h_ + h * stride_h_ + kh * dilation_h_; 291 | int w_in = -pad_w_ + w * stride_w_ + kw * dilation_w_; 292 | if ((h_in >= 0) && (h_in < bottom_height) && (w_in >= 0) && (w_in < bottom_width)) 293 | { 294 | int offset = ((n * channels + c) * bottom_height + h_in) * bottom_width + w_in; 295 | bottom_diff[offset] += (*weight_data) * (*top_diff); 296 | } 297 | ++weight_data; 298 | } 299 | } 300 | ++top_diff; 301 | } 302 | } 303 | } 304 | } 305 | } 306 | } 307 | 308 | #ifdef CPU_ONLY 309 | STUB_GPU(ConvolutionDepthwiseLayer); 310 | #endif 311 | 312 | INSTANTIATE_CLASS(ConvolutionDepthwiseLayer); 313 | REGISTER_LAYER_CLASS(ConvolutionDepthwise); 314 | 315 | } // namespace caffe 316 | -------------------------------------------------------------------------------- /.gitignore/conv_dw_layer.cu: -------------------------------------------------------------------------------- 1 | #include 2 | #include "caffe/layers/conv_dw_layer.hpp" 3 | #include "caffe/util/gpu_util.cuh" 4 | 5 | namespace caffe { 6 | 7 | template 8 | __global__ void ConvolutionDepthwiseWeightForward(const int nthreads, 9 | const Dtype* const bottom_data, const Dtype* const weight_data, const int num, const int channels, 10 | const int top_height, const int top_width, const int bottom_height, const int bottom_width, 11 | const int kernel_h, const int kernel_w, const int stride_h, const int stride_w, 12 | const int pad_h, const int pad_w, const int dilation_h, const int dilation_w, 13 | Dtype* const top_data) { 14 | CUDA_KERNEL_LOOP(index, nthreads) { 15 | const int n = index / channels / top_height / top_width; 16 | const int c = (index / top_height / top_width) % channels; 17 | const int h = (index / top_width) % top_height; 18 | const int w = index % top_width; 19 | const Dtype* weight = weight_data + c * kernel_h * kernel_w; 20 | Dtype value = 0; 21 | for (int kh = 0; kh < kernel_h; ++kh) 22 | { 23 | for (int kw = 0; kw < kernel_w; ++kw) 24 | { 25 | const int h_in = -pad_h + h * stride_h + kh * dilation_h; 26 | const int w_in = -pad_w + w * stride_w + kw * dilation_w; 27 | if ((h_in >= 0) && (h_in < bottom_height) && (w_in >= 0) && (w_in < bottom_width)) 28 | { 29 | const int offset = ((n * channels + c) * bottom_height + h_in) * bottom_width + w_in; 30 | value += (*weight) * bottom_data[offset]; 31 | } 32 | ++weight; 33 | } 34 | } 35 | top_data[index] = value; 36 | } 37 | } 38 | 39 | template 40 | __global__ void ConvolutionDepthwiseBiasForward(const int nthreads, 41 | const Dtype* const bias_data, const int num, const int channels, 42 | const int top_height, const int top_width, Dtype* const top_data) { 43 | CUDA_KERNEL_LOOP(index, nthreads) { 44 | const int c = (index / top_height / top_width) % channels; 45 | top_data[index] += bias_data[c]; 46 | } 47 | } 48 | 49 | template 50 | void ConvolutionDepthwiseLayer::Forward_gpu(const vector*>& bottom, 51 | const vector*>& top) { 52 | const Dtype* bottom_data = bottom[0]->gpu_data(); 53 | Dtype* top_data = top[0]->mutable_gpu_data(); 54 | const Dtype* weight_data = this->blobs_[0]->gpu_data(); 55 | const int count = top[0]->count(); 56 | const int num = top[0]->num(); 57 | const int channels = top[0]->channels(); 58 | const int top_height = top[0]->height(); 59 | const int top_width = top[0]->width(); 60 | const int bottom_height = bottom[0]->height(); 61 | const int bottom_width = bottom[0]->width(); 62 | ConvolutionDepthwiseWeightForward<<>>( 63 | count, bottom_data, weight_data, num, channels, 64 | top_height, top_width, bottom_height, bottom_width, 65 | kernel_h_, kernel_w_, stride_h_, stride_w_, 66 | pad_h_, pad_w_, dilation_h_, dilation_w_, top_data); 67 | if (this->layer_param_.convolution_param().bias_term()) 68 | { 69 | const Dtype* bias_data = this->blobs_[1]->gpu_data(); 70 | ConvolutionDepthwiseBiasForward<<>>( 71 | count, bias_data, num, channels, 72 | top_height, top_width, top_data); 73 | } 74 | } 75 | 76 | template 77 | __global__ void ConvolutionDepthwiseWeightBackward(const int nthreads, 78 | const Dtype* const top_diff, const Dtype* const bottom_data, const int num, const int channels, 79 | const int top_height, const int top_width, const int bottom_height, const int bottom_width, 80 | const int kernel_h, const int kernel_w, const int stride_h, const int stride_w, 81 | const int pad_h, const int pad_w, const int dilation_h, const int dilation_w, 82 | Dtype* const buffer_data) { 83 | CUDA_KERNEL_LOOP(index, nthreads) { 84 | const int h = (index / top_width) % top_height; 85 | const int w = index % top_width; 86 | const int kh = (index / kernel_w / num / top_height / top_width) % kernel_h; 87 | const int kw = (index / num / top_height / top_width) % kernel_w; 88 | const int h_in = -pad_h + h * stride_h + kh * dilation_h; 89 | const int w_in = -pad_w + w * stride_w + kw * dilation_w; 90 | if ((h_in >= 0) && (h_in < bottom_height) && (w_in >= 0) && (w_in < bottom_width)) 91 | { 92 | const int c = index / kernel_h / kernel_w / num / top_height / top_width; 93 | const int n = (index / top_height / top_width) % num; 94 | const int top_offset = ((n * channels + c) * top_height + h) * top_width + w; 95 | const int bottom_offset = ((n * channels + c) * bottom_height + h_in) * bottom_width + w_in; 96 | buffer_data[index] = top_diff[top_offset] * bottom_data[bottom_offset]; 97 | } 98 | else 99 | { 100 | buffer_data[index] = 0; 101 | } 102 | } 103 | } 104 | 105 | template 106 | __global__ void ConvolutionDepthwiseBottomBackward(const int nthreads, 107 | const Dtype* const top_diff, const Dtype* const weight_data, const int num, const int channels, 108 | const int top_height, const int top_width, const int bottom_height, const int bottom_width, 109 | const int kernel_h, const int kernel_w, const int stride_h, const int stride_w, 110 | const int pad_h, const int pad_w, const int dilation_h, const int dilation_w, 111 | Dtype* const bottom_diff) { 112 | CUDA_KERNEL_LOOP(index, nthreads) { 113 | const int n = index / channels / bottom_height / bottom_width; 114 | const int c = (index / bottom_height / bottom_width) % channels; 115 | const int h = (index / bottom_width) % bottom_height; 116 | const int w = index % bottom_width; 117 | const Dtype* weight = weight_data + c * kernel_h * kernel_w; 118 | Dtype value = 0; 119 | for (int kh = 0; kh < kernel_h; ++kh) 120 | { 121 | for (int kw = 0; kw < kernel_w; ++kw) 122 | { 123 | const int h_out_s = h + pad_h - kh * dilation_h; 124 | const int w_out_s = w + pad_w - kw * dilation_w; 125 | if (((h_out_s % stride_h) == 0) && ((w_out_s % stride_w) == 0)) 126 | { 127 | const int h_out = h_out_s / stride_h; 128 | const int w_out = w_out_s / stride_w; 129 | if ((h_out >= 0) && (h_out < top_height) && (w_out >= 0) && (w_out < top_width)) 130 | { 131 | const int offset = ((n * channels + c) * top_height + h_out) * top_width + w_out; 132 | value += (*weight) * top_diff[offset]; 133 | } 134 | } 135 | ++weight; 136 | } 137 | } 138 | bottom_diff[index] += value; 139 | } 140 | } 141 | 142 | template 143 | __global__ void ConvolutionDepthwiseBiasBackward(const int nthreads, 144 | const Dtype* const top_diff, const int num, const int channels, 145 | const int top_height, const int top_width, Dtype* const buffer_data) { 146 | CUDA_KERNEL_LOOP(index, nthreads) { 147 | const int c = index / num / top_height / top_width; 148 | const int n = (index / top_height / top_width) % num; 149 | const int h = (index / top_width) % top_height; 150 | const int w = index % top_width; 151 | const int offset = ((n * channels + c) * top_height + h) * top_width + w; 152 | buffer_data[index] = top_diff[offset]; 153 | } 154 | } 155 | 156 | template 157 | void ConvolutionDepthwiseLayer::Backward_gpu(const vector*>& top, 158 | const vector& propagate_down, const vector*>& bottom) { 159 | const Dtype* top_diff = top[0]->gpu_diff(); 160 | const int bottom_count = bottom[0]->count(); 161 | const int num = top[0]->num(); 162 | const int channels = top[0]->channels(); 163 | const int top_height = top[0]->height(); 164 | const int top_width = top[0]->width(); 165 | const int bottom_height = bottom[0]->height(); 166 | const int bottom_width = bottom[0]->width(); 167 | const int length = num * top_height * top_width; 168 | caffe_gpu_set(bottom_count, Dtype(0), bottom[0]->mutable_gpu_diff()); 169 | if (this->layer_param_.convolution_param().bias_term() && this->param_propagate_down_[1]) 170 | { 171 | const int bias_buffer_count = bias_buffer_.count(); 172 | Dtype* bias_buffer_mutable_data = bias_buffer_.mutable_gpu_data(); 173 | ConvolutionDepthwiseBiasBackward<<>>( 174 | bias_buffer_count, top_diff, num, channels, 175 | top_height, top_width, bias_buffer_mutable_data); 176 | const int bias_count = this->blobs_[1]->count(); 177 | const Dtype* bias_buffer_data = bias_buffer_.gpu_data(); 178 | Dtype* bias_diff = this->blobs_[1]->mutable_gpu_diff(); 179 | const Dtype* bias_multiplier_data = bias_multiplier_.gpu_data(); 180 | caffe_gpu_gemv(CblasNoTrans, bias_count, length, Dtype(1), bias_buffer_data, bias_multiplier_data, Dtype(1), bias_diff); 181 | } 182 | if (this->param_propagate_down_[0]) 183 | { 184 | const int weight_buffer_count = weight_buffer_.count(); 185 | const Dtype* bottom_data = bottom[0]->gpu_data(); 186 | Dtype* weight_buffer_mutable_data = weight_buffer_.mutable_gpu_data(); 187 | ConvolutionDepthwiseWeightBackward<<>>( 188 | weight_buffer_count, top_diff, bottom_data, num, channels, 189 | top_height, top_width, bottom_height, bottom_width, 190 | kernel_h_, kernel_w_, stride_h_, stride_w_, 191 | pad_h_, pad_w_, dilation_h_, dilation_w_, weight_buffer_mutable_data); 192 | const int weight_count = this->blobs_[0]->count(); 193 | const Dtype* weight_buffer_data = weight_buffer_.gpu_data(); 194 | Dtype* weight_diff = this->blobs_[0]->mutable_gpu_diff(); 195 | const Dtype* weight_multiplier_data = weight_multiplier_.gpu_data(); 196 | caffe_gpu_gemv(CblasNoTrans, weight_count, length, Dtype(1), weight_buffer_data, weight_multiplier_data, Dtype(1), weight_diff); 197 | } 198 | if (propagate_down[0]) 199 | { 200 | const Dtype* weight_data = this->blobs_[0]->gpu_data(); 201 | Dtype* bottom_diff = bottom[0]->mutable_gpu_diff(); 202 | ConvolutionDepthwiseBottomBackward<<>>( 203 | bottom_count, top_diff, weight_data, num, channels, 204 | top_height, top_width, bottom_height, bottom_width, 205 | kernel_h_, kernel_w_, stride_h_, stride_w_, 206 | pad_h_, pad_w_, dilation_h_, dilation_w_, bottom_diff); 207 | } 208 | } 209 | 210 | INSTANTIATE_LAYER_GPU_FUNCS(ConvolutionDepthwiseLayer); 211 | 212 | } // namespace caffe 213 | -------------------------------------------------------------------------------- /.gitignore/conv_dw_layer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CAFFE_CONV_DW_LAYER_HPP_ 2 | #define CAFFE_CONV_DW_LAYER_HPP_ 3 | 4 | #include 5 | #include "caffe/blob.hpp" 6 | #include "caffe/layer.hpp" 7 | #include "caffe/proto/caffe.pb.h" 8 | 9 | namespace caffe { 10 | 11 | template 12 | class ConvolutionDepthwiseLayer : public Layer { 13 | public: 14 | explicit ConvolutionDepthwiseLayer(const LayerParameter& param) 15 | : Layer(param) {} 16 | virtual void LayerSetUp(const vector*>& bottom, 17 | const vector*>& top); 18 | virtual void Reshape(const vector*>& bottom, 19 | const vector*>& top); 20 | virtual inline int ExactNumBottomBlobs() const { return 1; } 21 | virtual inline int ExactNumTopBlobs() const { return 1; } 22 | virtual inline const char* type() const { return "ConvolutionDepthwise"; } 23 | protected: 24 | virtual void Forward_cpu(const vector*>& bottom, 25 | const vector*>& top); 26 | virtual void Forward_gpu(const vector*>& bottom, 27 | const vector*>& top); 28 | virtual void Backward_cpu(const vector*>& top, 29 | const vector& propagate_down, const vector*>& bottom); 30 | virtual void Backward_gpu(const vector*>& top, 31 | const vector& propagate_down, const vector*>& bottom); 32 | unsigned int kernel_h_; 33 | unsigned int kernel_w_; 34 | unsigned int stride_h_; 35 | unsigned int stride_w_; 36 | unsigned int pad_h_; 37 | unsigned int pad_w_; 38 | unsigned int dilation_h_; 39 | unsigned int dilation_w_; 40 | Blob weight_buffer_; 41 | Blob weight_multiplier_; 42 | Blob bias_buffer_; 43 | Blob bias_multiplier_; 44 | }; 45 | 46 | } // namespace caffe 47 | 48 | #endif // CAFFE_CONV_DW_LAYER_HPP_ 49 | -------------------------------------------------------------------------------- /.gitignore/mobilenet_v2_new.caffemodel: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/suzhenghang/MobileNetv2/abe0e3ddfd8bed0900eb7238c49d3adcc180f7f2/.gitignore/mobilenet_v2_new.caffemodel -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | BSD 3-Clause License 2 | 3 | Copyright (c) 2018, suzhenghang 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are met: 8 | 9 | * Redistributions of source code must retain the above copyright notice, this 10 | list of conditions and the following disclaimer. 11 | 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | 16 | * Neither the name of the copyright holder nor the names of its 17 | contributors may be used to endorse or promote products derived from 18 | this software without specific prior written permission. 19 | 20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | -------------------------------------------------------------------------------- /MobileUnet1by2.prototxt: -------------------------------------------------------------------------------- 1 | name: "MOBILENET1by2_hp_Set24_AUX" 2 | # transform_param { 3 | # scale: 0.017 4 | # mirror: false 5 | # crop_size: 224 6 | # mean_value: [103.94,116.78,123.68] 7 | # } 8 | #input: "data" 9 | #input_shape { 10 | # dim: 1 11 | # dim: 3 12 | # dim: 224 13 | # dim: 224 14 | #} 15 | 16 | layer { 17 | name: "train_data" 18 | type: "ImageSegData" 19 | top: "data" 20 | top: "label" 21 | image_data_param { 22 | root_folder: "" 23 | source: "trainlist.txt" 24 | label_type: PIXEL 25 | batch_size: 16 26 | shuffle: true 27 | ignore_label: 255 28 | new_width: 400 29 | new_height: 400 30 | } 31 | transform_param { 32 | mirror: true 33 | crop_size: 320 34 | mean_value: 103.52 35 | mean_value: 116.28 36 | mean_value: 123.675 37 | scale: 0.017 38 | #### multi-scale #### 39 | # scale_factors: 0.75 40 | # scale_factors: 1 41 | # scale_factors: 1.25 42 | # scale_factors: 1.5 43 | # scale_factors: 2.0 44 | #### rolation #### 45 | max_rotation_angle: 10 46 | #### max_color_shift #### 47 | max_color_shift: 20 48 | #### brightness #### 49 | contrast_brightness_adjustment: true 50 | min_contrast: 0.5 51 | max_contrast: 2.5 52 | #### smooth #### 53 | smooth_filtering: true 54 | max_smooth: 6 55 | 56 | apply_probability: 0.5 57 | debug_params: false 58 | 59 | } 60 | include: { phase: TRAIN } 61 | } 62 | layer { 63 | name: "test_data" 64 | type: "ImageSegData" 65 | top: "data" 66 | top: "label" 67 | image_data_param { 68 | root_folder: "" 69 | source: "vallist.txt" 70 | label_type: PIXEL 71 | batch_size: 1 72 | shuffle: true 73 | ignore_label: 255 74 | new_width: 400 75 | new_height: 400 76 | } 77 | transform_param { 78 | mean_value: 103.94 79 | mean_value: 116.78 80 | mean_value: 123.68 81 | crop_size: 320 82 | scale: 0.017 83 | mirror: false 84 | } 85 | include: { phase: TEST } 86 | } 87 | 88 | layer { 89 | name: "conv1_1by2" 90 | type: "Convolution" 91 | bottom: "data" 92 | top: "conv1_1by2" 93 | param { 94 | lr_mult: 1 95 | decay_mult: 1 96 | } 97 | convolution_param { 98 | num_output: 16 99 | bias_term: false 100 | pad: 1 101 | kernel_size: 3 102 | stride: 2 103 | engine: CAFFE 104 | weight_filler { 105 | type: "msra" 106 | } 107 | } 108 | } 109 | layer { 110 | name: "conv1/bn_1by2" 111 | type: "BatchNorm" 112 | bottom: "conv1_1by2" 113 | top: "conv1_1by2" 114 | param { 115 | lr_mult: 0 116 | decay_mult: 0 117 | } 118 | param { 119 | lr_mult: 0 120 | decay_mult: 0 121 | } 122 | param { 123 | lr_mult: 0 124 | decay_mult: 0 125 | } 126 | } 127 | layer { 128 | name: "conv1/scale_1by2" 129 | type: "Scale" 130 | bottom: "conv1_1by2" 131 | top: "conv1_1by2" 132 | scale_param { 133 | filler { 134 | value: 1 135 | } 136 | bias_term: true 137 | bias_filler { 138 | value: 0 139 | } 140 | } 141 | } 142 | layer { 143 | name: "relu1_1by2" 144 | type: "ReLU" 145 | bottom: "conv1_1by2" 146 | top: "conv1_1by2" 147 | } 148 | layer { 149 | name: "conv2_1/dw_1by2" 150 | type: "ConvolutionDepthwise" 151 | bottom: "conv1_1by2" 152 | top: "conv2_1/dw_1by2" 153 | param { 154 | lr_mult: 1 155 | decay_mult: 1 156 | } 157 | convolution_param { 158 | num_output: 16 159 | bias_term: false 160 | pad: 1 161 | kernel_size: 3 162 | stride: 1 163 | engine: CAFFE 164 | weight_filler { 165 | type: "msra" 166 | } 167 | } 168 | } 169 | layer { 170 | name: "conv2_1/dw/bn_1by2" 171 | type: "BatchNorm" 172 | bottom: "conv2_1/dw_1by2" 173 | top: "conv2_1/dw_1by2" 174 | param { 175 | lr_mult: 0 176 | decay_mult: 0 177 | } 178 | param { 179 | lr_mult: 0 180 | decay_mult: 0 181 | } 182 | param { 183 | lr_mult: 0 184 | decay_mult: 0 185 | } 186 | } 187 | layer { 188 | name: "conv2_1/dw/scale_1by2" 189 | type: "Scale" 190 | bottom: "conv2_1/dw_1by2" 191 | top: "conv2_1/dw_1by2" 192 | scale_param { 193 | filler { 194 | value: 1 195 | } 196 | bias_term: true 197 | bias_filler { 198 | value: 0 199 | } 200 | } 201 | } 202 | layer { 203 | name: "relu2_1/dw_1by2" 204 | type: "ReLU" 205 | bottom: "conv2_1/dw_1by2" 206 | top: "conv2_1/dw_1by2" 207 | } 208 | layer { 209 | name: "conv2_1/sep_1by2" 210 | type: "Convolution" 211 | bottom: "conv2_1/dw_1by2" 212 | top: "conv2_1/sep_1by2" 213 | param { 214 | lr_mult: 1 215 | decay_mult: 1 216 | } 217 | convolution_param { 218 | num_output: 32 219 | bias_term: false 220 | pad: 0 221 | kernel_size: 1 222 | stride: 1 223 | engine: CAFFE 224 | weight_filler { 225 | type: "msra" 226 | } 227 | } 228 | } 229 | layer { 230 | name: "conv2_1/sep/bn_1by2" 231 | type: "BatchNorm" 232 | bottom: "conv2_1/sep_1by2" 233 | top: "conv2_1/sep_1by2" 234 | param { 235 | lr_mult: 0 236 | decay_mult: 0 237 | } 238 | param { 239 | lr_mult: 0 240 | decay_mult: 0 241 | } 242 | param { 243 | lr_mult: 0 244 | decay_mult: 0 245 | } 246 | } 247 | layer { 248 | name: "conv2_1/sep/scale_1by2" 249 | type: "Scale" 250 | bottom: "conv2_1/sep_1by2" 251 | top: "conv2_1/sep_1by2" 252 | scale_param { 253 | filler { 254 | value: 1 255 | } 256 | bias_term: true 257 | bias_filler { 258 | value: 0 259 | } 260 | } 261 | } 262 | layer { 263 | name: "relu2_1/sep_1by2" 264 | type: "ReLU" 265 | bottom: "conv2_1/sep_1by2" 266 | top: "conv2_1/sep_1by2" 267 | } 268 | layer { 269 | name: "conv2_2/dw_1by2" 270 | type: "ConvolutionDepthwise" 271 | bottom: "conv2_1/sep_1by2" 272 | top: "conv2_2/dw_1by2" 273 | param { 274 | lr_mult: 1 275 | decay_mult: 1 276 | } 277 | convolution_param { 278 | num_output: 32 279 | bias_term: false 280 | pad: 1 281 | kernel_size: 3 282 | stride: 2 283 | engine: CAFFE 284 | weight_filler { 285 | type: "msra" 286 | } 287 | } 288 | } 289 | layer { 290 | name: "conv2_2/dw/bn_1by2" 291 | type: "BatchNorm" 292 | bottom: "conv2_2/dw_1by2" 293 | top: "conv2_2/dw_1by2" 294 | param { 295 | lr_mult: 0 296 | decay_mult: 0 297 | } 298 | param { 299 | lr_mult: 0 300 | decay_mult: 0 301 | } 302 | param { 303 | lr_mult: 0 304 | decay_mult: 0 305 | } 306 | } 307 | layer { 308 | name: "conv2_2/dw/scale_1by2" 309 | type: "Scale" 310 | bottom: "conv2_2/dw_1by2" 311 | top: "conv2_2/dw_1by2" 312 | scale_param { 313 | filler { 314 | value: 1 315 | } 316 | bias_term: true 317 | bias_filler { 318 | value: 0 319 | } 320 | } 321 | } 322 | layer { 323 | name: "relu2_2/dw_1by2" 324 | type: "ReLU" 325 | bottom: "conv2_2/dw_1by2" 326 | top: "conv2_2/dw_1by2" 327 | } 328 | layer { 329 | name: "conv2_2/sep_1by2" 330 | type: "Convolution" 331 | bottom: "conv2_2/dw_1by2" 332 | top: "conv2_2/sep_1by2" 333 | param { 334 | lr_mult: 1 335 | decay_mult: 1 336 | } 337 | convolution_param { 338 | num_output: 64 339 | bias_term: false 340 | pad: 0 341 | kernel_size: 1 342 | stride: 1 343 | engine: CAFFE 344 | weight_filler { 345 | type: "msra" 346 | } 347 | } 348 | } 349 | layer { 350 | name: "conv2_2/sep/bn_1by2" 351 | type: "BatchNorm" 352 | bottom: "conv2_2/sep_1by2" 353 | top: "conv2_2/sep_1by2" 354 | param { 355 | lr_mult: 0 356 | decay_mult: 0 357 | } 358 | param { 359 | lr_mult: 0 360 | decay_mult: 0 361 | } 362 | param { 363 | lr_mult: 0 364 | decay_mult: 0 365 | } 366 | } 367 | layer { 368 | name: "conv2_2/sep/scale_1by2" 369 | type: "Scale" 370 | bottom: "conv2_2/sep_1by2" 371 | top: "conv2_2/sep_1by2" 372 | scale_param { 373 | filler { 374 | value: 1 375 | } 376 | bias_term: true 377 | bias_filler { 378 | value: 0 379 | } 380 | } 381 | } 382 | layer { 383 | name: "relu2_2/sep_1by2" 384 | type: "ReLU" 385 | bottom: "conv2_2/sep_1by2" 386 | top: "conv2_2/sep_1by2" 387 | } 388 | layer { 389 | name: "conv3_1/dw_1by2" 390 | type: "ConvolutionDepthwise" 391 | bottom: "conv2_2/sep_1by2" 392 | top: "conv3_1/dw_1by2" 393 | param { 394 | lr_mult: 1 395 | decay_mult: 1 396 | } 397 | convolution_param { 398 | num_output: 64 399 | bias_term: false 400 | pad: 1 401 | kernel_size: 3 402 | stride: 1 403 | engine: CAFFE 404 | weight_filler { 405 | type: "msra" 406 | } 407 | } 408 | } 409 | layer { 410 | name: "conv3_1/dw/bn_1by2" 411 | type: "BatchNorm" 412 | bottom: "conv3_1/dw_1by2" 413 | top: "conv3_1/dw_1by2" 414 | param { 415 | lr_mult: 0 416 | decay_mult: 0 417 | } 418 | param { 419 | lr_mult: 0 420 | decay_mult: 0 421 | } 422 | param { 423 | lr_mult: 0 424 | decay_mult: 0 425 | } 426 | } 427 | layer { 428 | name: "conv3_1/dw/scale_1by2" 429 | type: "Scale" 430 | bottom: "conv3_1/dw_1by2" 431 | top: "conv3_1/dw_1by2" 432 | scale_param { 433 | filler { 434 | value: 1 435 | } 436 | bias_term: true 437 | bias_filler { 438 | value: 0 439 | } 440 | } 441 | } 442 | layer { 443 | name: "relu3_1/dw_1by2" 444 | type: "ReLU" 445 | bottom: "conv3_1/dw_1by2" 446 | top: "conv3_1/dw_1by2" 447 | } 448 | layer { 449 | name: "conv3_1/sep_1by2" 450 | type: "Convolution" 451 | bottom: "conv3_1/dw_1by2" 452 | top: "conv3_1/sep_1by2" 453 | param { 454 | lr_mult: 1 455 | decay_mult: 1 456 | } 457 | convolution_param { 458 | num_output: 64 459 | bias_term: false 460 | pad: 0 461 | kernel_size: 1 462 | stride: 1 463 | engine: CAFFE 464 | weight_filler { 465 | type: "msra" 466 | } 467 | } 468 | } 469 | layer { 470 | name: "conv3_1/sep/bn_1by2" 471 | type: "BatchNorm" 472 | bottom: "conv3_1/sep_1by2" 473 | top: "conv3_1/sep_1by2" 474 | param { 475 | lr_mult: 0 476 | decay_mult: 0 477 | } 478 | param { 479 | lr_mult: 0 480 | decay_mult: 0 481 | } 482 | param { 483 | lr_mult: 0 484 | decay_mult: 0 485 | } 486 | } 487 | layer { 488 | name: "conv3_1/sep/scale_1by2" 489 | type: "Scale" 490 | bottom: "conv3_1/sep_1by2" 491 | top: "conv3_1/sep_1by2" 492 | scale_param { 493 | filler { 494 | value: 1 495 | } 496 | bias_term: true 497 | bias_filler { 498 | value: 0 499 | } 500 | } 501 | } 502 | layer { 503 | name: "relu3_1/sep_1by2" 504 | type: "ReLU" 505 | bottom: "conv3_1/sep_1by2" 506 | top: "conv3_1/sep_1by2" 507 | } 508 | layer { 509 | name: "conv3_2/dw_1by2" 510 | type: "ConvolutionDepthwise" 511 | bottom: "conv3_1/sep_1by2" 512 | top: "conv3_2/dw_1by2" 513 | param { 514 | lr_mult: 1 515 | decay_mult: 1 516 | } 517 | convolution_param { 518 | num_output: 64 519 | bias_term: false 520 | pad: 1 521 | kernel_size: 3 522 | stride: 2 523 | engine: CAFFE 524 | weight_filler { 525 | type: "msra" 526 | } 527 | } 528 | } 529 | layer { 530 | name: "conv3_2/dw/bn_1by2" 531 | type: "BatchNorm" 532 | bottom: "conv3_2/dw_1by2" 533 | top: "conv3_2/dw_1by2" 534 | param { 535 | lr_mult: 0 536 | decay_mult: 0 537 | } 538 | param { 539 | lr_mult: 0 540 | decay_mult: 0 541 | } 542 | param { 543 | lr_mult: 0 544 | decay_mult: 0 545 | } 546 | } 547 | layer { 548 | name: "conv3_2/dw/scale_1by2" 549 | type: "Scale" 550 | bottom: "conv3_2/dw_1by2" 551 | top: "conv3_2/dw_1by2" 552 | scale_param { 553 | filler { 554 | value: 1 555 | } 556 | bias_term: true 557 | bias_filler { 558 | value: 0 559 | } 560 | } 561 | } 562 | layer { 563 | name: "relu3_2/dw_1by2" 564 | type: "ReLU" 565 | bottom: "conv3_2/dw_1by2" 566 | top: "conv3_2/dw_1by2" 567 | } 568 | layer { 569 | name: "conv3_2/sep_1by2" 570 | type: "Convolution" 571 | bottom: "conv3_2/dw_1by2" 572 | top: "conv3_2/sep_1by2" 573 | param { 574 | lr_mult: 1 575 | decay_mult: 1 576 | } 577 | convolution_param { 578 | num_output: 128 579 | bias_term: false 580 | pad: 0 581 | kernel_size: 1 582 | stride: 1 583 | engine: CAFFE 584 | weight_filler { 585 | type: "msra" 586 | } 587 | } 588 | } 589 | layer { 590 | name: "conv3_2/sep/bn_1by2" 591 | type: "BatchNorm" 592 | bottom: "conv3_2/sep_1by2" 593 | top: "conv3_2/sep_1by2" 594 | param { 595 | lr_mult: 0 596 | decay_mult: 0 597 | } 598 | param { 599 | lr_mult: 0 600 | decay_mult: 0 601 | } 602 | param { 603 | lr_mult: 0 604 | decay_mult: 0 605 | } 606 | } 607 | layer { 608 | name: "conv3_2/sep/scale_1by2" 609 | type: "Scale" 610 | bottom: "conv3_2/sep_1by2" 611 | top: "conv3_2/sep_1by2" 612 | scale_param { 613 | filler { 614 | value: 1 615 | } 616 | bias_term: true 617 | bias_filler { 618 | value: 0 619 | } 620 | } 621 | } 622 | layer { 623 | name: "relu3_2/sep_1by2" 624 | type: "ReLU" 625 | bottom: "conv3_2/sep_1by2" 626 | top: "conv3_2/sep_1by2" 627 | } 628 | layer { 629 | name: "conv4_1/dw_1by2" 630 | type: "ConvolutionDepthwise" 631 | bottom: "conv3_2/sep_1by2" 632 | top: "conv4_1/dw_1by2" 633 | param { 634 | lr_mult: 1 635 | decay_mult: 1 636 | } 637 | convolution_param { 638 | num_output: 128 639 | bias_term: false 640 | pad: 1 641 | kernel_size: 3 642 | stride: 1 643 | engine: CAFFE 644 | weight_filler { 645 | type: "msra" 646 | } 647 | } 648 | } 649 | layer { 650 | name: "conv4_1/dw/bn_1by2" 651 | type: "BatchNorm" 652 | bottom: "conv4_1/dw_1by2" 653 | top: "conv4_1/dw_1by2" 654 | param { 655 | lr_mult: 0 656 | decay_mult: 0 657 | } 658 | param { 659 | lr_mult: 0 660 | decay_mult: 0 661 | } 662 | param { 663 | lr_mult: 0 664 | decay_mult: 0 665 | } 666 | } 667 | layer { 668 | name: "conv4_1/dw/scale_1by2" 669 | type: "Scale" 670 | bottom: "conv4_1/dw_1by2" 671 | top: "conv4_1/dw_1by2" 672 | scale_param { 673 | filler { 674 | value: 1 675 | } 676 | bias_term: true 677 | bias_filler { 678 | value: 0 679 | } 680 | } 681 | } 682 | layer { 683 | name: "relu4_1/dw_1by2" 684 | type: "ReLU" 685 | bottom: "conv4_1/dw_1by2" 686 | top: "conv4_1/dw_1by2" 687 | } 688 | layer { 689 | name: "conv4_1/sep_1by2" 690 | type: "Convolution" 691 | bottom: "conv4_1/dw_1by2" 692 | top: "conv4_1/sep_1by2" 693 | param { 694 | lr_mult: 1 695 | decay_mult: 1 696 | } 697 | convolution_param { 698 | num_output: 128 699 | bias_term: false 700 | pad: 0 701 | kernel_size: 1 702 | engine: CAFFE 703 | stride: 1 704 | weight_filler { 705 | type: "msra" 706 | } 707 | } 708 | } 709 | layer { 710 | name: "conv4_1/sep/bn_1by2" 711 | type: "BatchNorm" 712 | bottom: "conv4_1/sep_1by2" 713 | top: "conv4_1/sep_1by2" 714 | param { 715 | lr_mult: 0 716 | decay_mult: 0 717 | } 718 | param { 719 | lr_mult: 0 720 | decay_mult: 0 721 | } 722 | param { 723 | lr_mult: 0 724 | decay_mult: 0 725 | } 726 | } 727 | layer { 728 | name: "conv4_1/sep/scale_1by2" 729 | type: "Scale" 730 | bottom: "conv4_1/sep_1by2" 731 | top: "conv4_1/sep_1by2" 732 | scale_param { 733 | filler { 734 | value: 1 735 | } 736 | bias_term: true 737 | bias_filler { 738 | value: 0 739 | } 740 | } 741 | } 742 | layer { 743 | name: "relu4_1/sep_1by2" 744 | type: "ReLU" 745 | bottom: "conv4_1/sep_1by2" 746 | top: "conv4_1/sep_1by2" 747 | } 748 | layer { 749 | name: "conv4_2/dw_1by2" 750 | type: "ConvolutionDepthwise" 751 | bottom: "conv4_1/sep_1by2" 752 | top: "conv4_2/dw_1by2" 753 | param { 754 | lr_mult: 1 755 | decay_mult: 1 756 | } 757 | convolution_param { 758 | num_output: 128 759 | bias_term: false 760 | pad: 1 761 | kernel_size: 3 762 | stride: 2 763 | engine: CAFFE 764 | weight_filler { 765 | type: "msra" 766 | } 767 | } 768 | } 769 | layer { 770 | name: "conv4_2/dw/bn_1by2" 771 | type: "BatchNorm" 772 | bottom: "conv4_2/dw_1by2" 773 | top: "conv4_2/dw_1by2" 774 | param { 775 | lr_mult: 0 776 | decay_mult: 0 777 | } 778 | param { 779 | lr_mult: 0 780 | decay_mult: 0 781 | } 782 | param { 783 | lr_mult: 0 784 | decay_mult: 0 785 | } 786 | } 787 | layer { 788 | name: "conv4_2/dw/scale_1by2" 789 | type: "Scale" 790 | bottom: "conv4_2/dw_1by2" 791 | top: "conv4_2/dw_1by2" 792 | scale_param { 793 | filler { 794 | value: 1 795 | } 796 | bias_term: true 797 | bias_filler { 798 | value: 0 799 | } 800 | } 801 | } 802 | layer { 803 | name: "relu4_2/dw_1by2" 804 | type: "ReLU" 805 | bottom: "conv4_2/dw_1by2" 806 | top: "conv4_2/dw_1by2" 807 | } 808 | layer { 809 | name: "conv4_2/sep_1by2" 810 | type: "Convolution" 811 | bottom: "conv4_2/dw_1by2" 812 | top: "conv4_2/sep_1by2" 813 | param { 814 | lr_mult: 1 815 | decay_mult: 1 816 | } 817 | convolution_param { 818 | num_output: 128 819 | bias_term: false 820 | pad: 0 821 | kernel_size: 1 822 | stride: 1 823 | engine: CAFFE 824 | weight_filler { 825 | type: "msra" 826 | } 827 | } 828 | } 829 | layer { 830 | name: "conv4_2/sep/bn_1by2" 831 | type: "BatchNorm" 832 | bottom: "conv4_2/sep_1by2" 833 | top: "conv4_2/sep_1by2" 834 | param { 835 | lr_mult: 0 836 | decay_mult: 0 837 | } 838 | param { 839 | lr_mult: 0 840 | decay_mult: 0 841 | } 842 | param { 843 | lr_mult: 0 844 | decay_mult: 0 845 | } 846 | } 847 | layer { 848 | name: "conv4_2/sep/scale_1by2" 849 | type: "Scale" 850 | bottom: "conv4_2/sep_1by2" 851 | top: "conv4_2/sep_1by2" 852 | scale_param { 853 | filler { 854 | value: 1 855 | } 856 | bias_term: true 857 | bias_filler { 858 | value: 0 859 | } 860 | } 861 | } 862 | layer { 863 | name: "relu4_2/sep_1by2" 864 | type: "ReLU" 865 | bottom: "conv4_2/sep_1by2" 866 | top: "conv4_2/sep_1by2" 867 | } 868 | layer { 869 | name: "conv5_1/dw_1by2" 870 | type: "ConvolutionDepthwise" 871 | bottom: "conv4_2/sep_1by2" 872 | top: "conv5_1/dw_1by2" 873 | param { 874 | lr_mult: 1 875 | decay_mult: 1 876 | } 877 | convolution_param { 878 | num_output: 128 879 | bias_term: false 880 | pad: 1 881 | kernel_size: 3 882 | stride: 1 883 | engine: CAFFE 884 | dilation: 1 885 | weight_filler { 886 | type: "msra" 887 | } 888 | } 889 | } 890 | layer { 891 | name: "conv5_1/dw/bn_1by2" 892 | type: "BatchNorm" 893 | bottom: "conv5_1/dw_1by2" 894 | top: "conv5_1/dw_1by2" 895 | param { 896 | lr_mult: 0 897 | decay_mult: 0 898 | } 899 | param { 900 | lr_mult: 0 901 | decay_mult: 0 902 | } 903 | param { 904 | lr_mult: 0 905 | decay_mult: 0 906 | } 907 | } 908 | layer { 909 | name: "conv5_1/dw/scale_1by2" 910 | type: "Scale" 911 | bottom: "conv5_1/dw_1by2" 912 | top: "conv5_1/dw_1by2" 913 | scale_param { 914 | filler { 915 | value: 1 916 | } 917 | bias_term: true 918 | bias_filler { 919 | value: 0 920 | } 921 | } 922 | } 923 | layer { 924 | name: "relu5_1/dw_1by2" 925 | type: "ReLU" 926 | bottom: "conv5_1/dw_1by2" 927 | top: "conv5_1/dw_1by2" 928 | } 929 | layer { 930 | name: "conv5_1/sep_1by2" 931 | type: "Convolution" 932 | bottom: "conv5_1/dw_1by2" 933 | top: "conv5_1/sep_1by2" 934 | param { 935 | lr_mult: 1 936 | decay_mult: 1 937 | } 938 | convolution_param { 939 | num_output: 128 940 | bias_term: false 941 | pad: 0 942 | kernel_size: 1 943 | engine: CAFFE 944 | stride: 1 945 | weight_filler { 946 | type: "msra" 947 | } 948 | } 949 | } 950 | layer { 951 | name: "conv5_1/sep/bn_1by2" 952 | type: "BatchNorm" 953 | bottom: "conv5_1/sep_1by2" 954 | top: "conv5_1/sep_1by2" 955 | param { 956 | lr_mult: 0 957 | decay_mult: 0 958 | } 959 | param { 960 | lr_mult: 0 961 | decay_mult: 0 962 | } 963 | param { 964 | lr_mult: 0 965 | decay_mult: 0 966 | } 967 | } 968 | layer { 969 | name: "conv5_1/sep/scale_1by2" 970 | type: "Scale" 971 | bottom: "conv5_1/sep_1by2" 972 | top: "conv5_1/sep_1by2" 973 | scale_param { 974 | filler { 975 | value: 1 976 | } 977 | bias_term: true 978 | bias_filler { 979 | value: 0 980 | } 981 | } 982 | } 983 | layer { 984 | name: "relu5_1/sep_1by2" 985 | type: "ReLU" 986 | bottom: "conv5_1/sep_1by2" 987 | top: "conv5_1/sep_1by2" 988 | } 989 | layer { 990 | name: "conv5_2/dw_1by2" 991 | type: "ConvolutionDepthwise" 992 | bottom: "conv5_1/sep_1by2" 993 | top: "conv5_2/dw_1by2" 994 | param { 995 | lr_mult: 1 996 | decay_mult: 1 997 | } 998 | convolution_param { 999 | num_output: 128 1000 | bias_term: false 1001 | pad: 2 1002 | kernel_size: 3 1003 | stride: 1 1004 | engine: CAFFE 1005 | dilation: 2 1006 | weight_filler { 1007 | type: "msra" 1008 | } 1009 | } 1010 | } 1011 | layer { 1012 | name: "conv5_2/dw/bn_1by2" 1013 | type: "BatchNorm" 1014 | bottom: "conv5_2/dw_1by2" 1015 | top: "conv5_2/dw_1by2" 1016 | param { 1017 | lr_mult: 0 1018 | decay_mult: 0 1019 | } 1020 | param { 1021 | lr_mult: 0 1022 | decay_mult: 0 1023 | } 1024 | param { 1025 | lr_mult: 0 1026 | decay_mult: 0 1027 | } 1028 | } 1029 | layer { 1030 | name: "conv5_2/dw/scale_1by2" 1031 | type: "Scale" 1032 | bottom: "conv5_2/dw_1by2" 1033 | top: "conv5_2/dw_1by2" 1034 | scale_param { 1035 | filler { 1036 | value: 1 1037 | } 1038 | bias_term: true 1039 | bias_filler { 1040 | value: 0 1041 | } 1042 | } 1043 | } 1044 | layer { 1045 | name: "relu5_2/dw_1by2" 1046 | type: "ReLU" 1047 | bottom: "conv5_2/dw_1by2" 1048 | top: "conv5_2/dw_1by2" 1049 | } 1050 | layer { 1051 | name: "conv5_2/sep_1by2" 1052 | type: "Convolution" 1053 | bottom: "conv5_2/dw_1by2" 1054 | top: "conv5_2/sep_1by2" 1055 | param { 1056 | lr_mult: 1 1057 | decay_mult: 1 1058 | } 1059 | convolution_param { 1060 | num_output: 128 1061 | bias_term: false 1062 | pad: 0 1063 | kernel_size: 1 1064 | stride: 1 1065 | engine: CAFFE 1066 | weight_filler { 1067 | type: "msra" 1068 | } 1069 | } 1070 | } 1071 | layer { 1072 | name: "conv5_2/sep/bn_1by2" 1073 | type: "BatchNorm" 1074 | bottom: "conv5_2/sep_1by2" 1075 | top: "conv5_2/sep_1by2" 1076 | param { 1077 | lr_mult: 0 1078 | decay_mult: 0 1079 | } 1080 | param { 1081 | lr_mult: 0 1082 | decay_mult: 0 1083 | } 1084 | param { 1085 | lr_mult: 0 1086 | decay_mult: 0 1087 | } 1088 | } 1089 | layer { 1090 | name: "conv5_2/sep/scale_1by2" 1091 | type: "Scale" 1092 | bottom: "conv5_2/sep_1by2" 1093 | top: "conv5_2/sep_1by2" 1094 | scale_param { 1095 | filler { 1096 | value: 1 1097 | } 1098 | bias_term: true 1099 | bias_filler { 1100 | value: 0 1101 | } 1102 | } 1103 | } 1104 | layer { 1105 | name: "relu5_2/sep_1by2" 1106 | type: "ReLU" 1107 | bottom: "conv5_2/sep_1by2" 1108 | top: "conv5_2/sep_1by2" 1109 | } 1110 | layer { 1111 | name: "conv5_3/dw_1by2" 1112 | type: "ConvolutionDepthwise" 1113 | bottom: "conv5_2/sep_1by2" 1114 | top: "conv5_3/dw_1by2" 1115 | param { 1116 | lr_mult: 1 1117 | decay_mult: 1 1118 | } 1119 | convolution_param { 1120 | num_output: 128 1121 | bias_term: false 1122 | pad: 5 1123 | kernel_size: 3 1124 | stride: 1 1125 | engine: CAFFE 1126 | dilation: 5 1127 | weight_filler { 1128 | type: "msra" 1129 | } 1130 | } 1131 | } 1132 | layer { 1133 | name: "conv5_3/dw/bn_1by2" 1134 | type: "BatchNorm" 1135 | bottom: "conv5_3/dw_1by2" 1136 | top: "conv5_3/dw_1by2" 1137 | param { 1138 | lr_mult: 0 1139 | decay_mult: 0 1140 | } 1141 | param { 1142 | lr_mult: 0 1143 | decay_mult: 0 1144 | } 1145 | param { 1146 | lr_mult: 0 1147 | decay_mult: 0 1148 | } 1149 | } 1150 | layer { 1151 | name: "conv5_3/dw/scale_1by2" 1152 | type: "Scale" 1153 | bottom: "conv5_3/dw_1by2" 1154 | top: "conv5_3/dw_1by2" 1155 | scale_param { 1156 | filler { 1157 | value: 1 1158 | } 1159 | bias_term: true 1160 | bias_filler { 1161 | value: 0 1162 | } 1163 | } 1164 | } 1165 | layer { 1166 | name: "relu5_3/dw_1by2" 1167 | type: "ReLU" 1168 | bottom: "conv5_3/dw_1by2" 1169 | top: "conv5_3/dw_1by2" 1170 | } 1171 | layer { 1172 | name: "conv5_3/sep_1by2" 1173 | type: "Convolution" 1174 | bottom: "conv5_3/dw_1by2" 1175 | top: "conv5_3/sep_1by2" 1176 | param { 1177 | lr_mult: 1 1178 | decay_mult: 1 1179 | } 1180 | convolution_param { 1181 | num_output: 128 1182 | bias_term: false 1183 | pad: 0 1184 | kernel_size: 1 1185 | stride: 1 1186 | engine: CAFFE 1187 | weight_filler { 1188 | type: "msra" 1189 | } 1190 | } 1191 | } 1192 | layer { 1193 | name: "conv5_3/sep/bn_1by2" 1194 | type: "BatchNorm" 1195 | bottom: "conv5_3/sep_1by2" 1196 | top: "conv5_3/sep_1by2" 1197 | param { 1198 | lr_mult: 0 1199 | decay_mult: 0 1200 | } 1201 | param { 1202 | lr_mult: 0 1203 | decay_mult: 0 1204 | } 1205 | param { 1206 | lr_mult: 0 1207 | decay_mult: 0 1208 | } 1209 | } 1210 | layer { 1211 | name: "conv5_3/sep/scale_1by2" 1212 | type: "Scale" 1213 | bottom: "conv5_3/sep_1by2" 1214 | top: "conv5_3/sep_1by2" 1215 | scale_param { 1216 | filler { 1217 | value: 1 1218 | } 1219 | bias_term: true 1220 | bias_filler { 1221 | value: 0 1222 | } 1223 | } 1224 | } 1225 | layer { 1226 | name: "relu5_3/sep_1by2" 1227 | type: "ReLU" 1228 | bottom: "conv5_3/sep_1by2" 1229 | top: "conv5_3/sep_1by2" 1230 | } 1231 | layer { 1232 | name: "conv5_4/dw_1by2" 1233 | type: "ConvolutionDepthwise" 1234 | bottom: "conv5_3/sep_1by2" 1235 | top: "conv5_4/dw_1by2" 1236 | param { 1237 | lr_mult: 1 1238 | decay_mult: 1 1239 | } 1240 | convolution_param { 1241 | num_output: 128 1242 | bias_term: false 1243 | pad: 7 1244 | kernel_size: 3 1245 | stride: 1 1246 | engine: CAFFE 1247 | dilation: 7 1248 | weight_filler { 1249 | type: "msra" 1250 | } 1251 | } 1252 | } 1253 | layer { 1254 | name: "conv5_4/dw/bn_1by2" 1255 | type: "BatchNorm" 1256 | bottom: "conv5_4/dw_1by2" 1257 | top: "conv5_4/dw_1by2" 1258 | param { 1259 | lr_mult: 0 1260 | decay_mult: 0 1261 | } 1262 | param { 1263 | lr_mult: 0 1264 | decay_mult: 0 1265 | } 1266 | param { 1267 | lr_mult: 0 1268 | decay_mult: 0 1269 | } 1270 | } 1271 | layer { 1272 | name: "conv5_4/dw/scale_1by2" 1273 | type: "Scale" 1274 | bottom: "conv5_4/dw_1by2" 1275 | top: "conv5_4/dw_1by2" 1276 | scale_param { 1277 | filler { 1278 | value: 1 1279 | } 1280 | bias_term: true 1281 | bias_filler { 1282 | value: 0 1283 | } 1284 | } 1285 | } 1286 | layer { 1287 | name: "relu5_4/dw_1by2" 1288 | type: "ReLU" 1289 | bottom: "conv5_4/dw_1by2" 1290 | top: "conv5_4/dw_1by2" 1291 | } 1292 | layer { 1293 | name: "conv5_4/sep_1by2" 1294 | type: "Convolution" 1295 | bottom: "conv5_4/dw_1by2" 1296 | top: "conv5_4/sep_1by2" 1297 | param { 1298 | lr_mult: 1 1299 | decay_mult: 1 1300 | } 1301 | convolution_param { 1302 | num_output: 128 1303 | bias_term: false 1304 | pad: 0 1305 | kernel_size: 1 1306 | stride: 1 1307 | engine: CAFFE 1308 | weight_filler { 1309 | type: "msra" 1310 | } 1311 | } 1312 | } 1313 | layer { 1314 | name: "conv5_4/sep/bn_1by2" 1315 | type: "BatchNorm" 1316 | bottom: "conv5_4/sep_1by2" 1317 | top: "conv5_4/sep_1by2" 1318 | param { 1319 | lr_mult: 0 1320 | decay_mult: 0 1321 | } 1322 | param { 1323 | lr_mult: 0 1324 | decay_mult: 0 1325 | } 1326 | param { 1327 | lr_mult: 0 1328 | decay_mult: 0 1329 | } 1330 | } 1331 | layer { 1332 | name: "conv5_4/sep/scale_1by2" 1333 | type: "Scale" 1334 | bottom: "conv5_4/sep_1by2" 1335 | top: "conv5_4/sep_1by2" 1336 | scale_param { 1337 | filler { 1338 | value: 1 1339 | } 1340 | bias_term: true 1341 | bias_filler { 1342 | value: 0 1343 | } 1344 | } 1345 | } 1346 | layer { 1347 | name: "relu5_4/sep_1by2" 1348 | type: "ReLU" 1349 | bottom: "conv5_4/sep_1by2" 1350 | top: "conv5_4/sep_1by2" 1351 | } 1352 | layer { 1353 | name: "conv5_5/dw_1by2" 1354 | type: "ConvolutionDepthwise" 1355 | bottom: "conv5_4/sep_1by2" 1356 | top: "conv5_5/dw_1by2" 1357 | param { 1358 | lr_mult: 1 1359 | decay_mult: 1 1360 | } 1361 | convolution_param { 1362 | num_output: 128 1363 | bias_term: false 1364 | pad: 1 1365 | kernel_size: 3 1366 | engine: CAFFE 1367 | stride: 1 1368 | dilation: 1 1369 | weight_filler { 1370 | type: "msra" 1371 | } 1372 | } 1373 | } 1374 | layer { 1375 | name: "conv5_5/dw/bn_1by2" 1376 | type: "BatchNorm" 1377 | bottom: "conv5_5/dw_1by2" 1378 | top: "conv5_5/dw_1by2" 1379 | param { 1380 | lr_mult: 0 1381 | decay_mult: 0 1382 | } 1383 | param { 1384 | lr_mult: 0 1385 | decay_mult: 0 1386 | } 1387 | param { 1388 | lr_mult: 0 1389 | decay_mult: 0 1390 | } 1391 | } 1392 | layer { 1393 | name: "conv5_5/dw/scale_1by2" 1394 | type: "Scale" 1395 | bottom: "conv5_5/dw_1by2" 1396 | top: "conv5_5/dw_1by2" 1397 | scale_param { 1398 | filler { 1399 | value: 1 1400 | } 1401 | bias_term: true 1402 | bias_filler { 1403 | value: 0 1404 | } 1405 | } 1406 | } 1407 | layer { 1408 | name: "relu5_5/dw_1by2" 1409 | type: "ReLU" 1410 | bottom: "conv5_5/dw_1by2" 1411 | top: "conv5_5/dw_1by2" 1412 | } 1413 | layer { 1414 | name: "conv5_5/sep_1by2" 1415 | type: "Convolution" 1416 | bottom: "conv5_5/dw_1by2" 1417 | top: "conv5_5/sep_1by2" 1418 | param { 1419 | lr_mult: 1 1420 | decay_mult: 1 1421 | } 1422 | convolution_param { 1423 | num_output: 128 1424 | bias_term: false 1425 | pad: 0 1426 | engine: CAFFE 1427 | kernel_size: 1 1428 | stride: 1 1429 | weight_filler { 1430 | type: "msra" 1431 | } 1432 | } 1433 | } 1434 | layer { 1435 | name: "conv5_5/sep/bn_1by2" 1436 | type: "BatchNorm" 1437 | bottom: "conv5_5/sep_1by2" 1438 | top: "conv5_5/sep_1by2" 1439 | param { 1440 | lr_mult: 0 1441 | decay_mult: 0 1442 | } 1443 | param { 1444 | lr_mult: 0 1445 | decay_mult: 0 1446 | } 1447 | param { 1448 | lr_mult: 0 1449 | decay_mult: 0 1450 | } 1451 | } 1452 | layer { 1453 | name: "conv5_5/sep/scale_1by2" 1454 | type: "Scale" 1455 | bottom: "conv5_5/sep_1by2" 1456 | top: "conv5_5/sep_1by2" 1457 | scale_param { 1458 | filler { 1459 | value: 1 1460 | } 1461 | bias_term: true 1462 | bias_filler { 1463 | value: 0 1464 | } 1465 | } 1466 | } 1467 | layer { 1468 | name: "relu5_5/sep_1by2" 1469 | type: "ReLU" 1470 | bottom: "conv5_5/sep_1by2" 1471 | top: "conv5_5/sep_1by2" 1472 | } 1473 | layer { 1474 | name: "conv5_6/dw_1by2" 1475 | type: "ConvolutionDepthwise" 1476 | bottom: "conv5_5/sep_1by2" 1477 | top: "conv5_6/dw_1by2" 1478 | param { 1479 | lr_mult: 1 1480 | decay_mult: 1 1481 | } 1482 | convolution_param { 1483 | num_output: 128 1484 | bias_term: false 1485 | pad: 2 1486 | engine: CAFFE 1487 | kernel_size: 3 1488 | stride: 1 1489 | dilation: 2 1490 | weight_filler { 1491 | type: "msra" 1492 | } 1493 | } 1494 | } 1495 | layer { 1496 | name: "conv5_6/dw/bn_1by2" 1497 | type: "BatchNorm" 1498 | bottom: "conv5_6/dw_1by2" 1499 | top: "conv5_6/dw_1by2" 1500 | param { 1501 | lr_mult: 0 1502 | decay_mult: 0 1503 | } 1504 | param { 1505 | lr_mult: 0 1506 | decay_mult: 0 1507 | } 1508 | param { 1509 | lr_mult: 0 1510 | decay_mult: 0 1511 | } 1512 | } 1513 | layer { 1514 | name: "conv5_6/dw/scale_1by2" 1515 | type: "Scale" 1516 | bottom: "conv5_6/dw_1by2" 1517 | top: "conv5_6/dw_1by2" 1518 | scale_param { 1519 | filler { 1520 | value: 1 1521 | } 1522 | bias_term: true 1523 | bias_filler { 1524 | value: 0 1525 | } 1526 | } 1527 | } 1528 | layer { 1529 | name: "relu5_6/dw_1by2" 1530 | type: "ReLU" 1531 | bottom: "conv5_6/dw_1by2" 1532 | top: "conv5_6/dw_1by2" 1533 | } 1534 | layer { 1535 | name: "conv5_6/sep_1by2" 1536 | type: "Convolution" 1537 | bottom: "conv5_6/dw_1by2" 1538 | top: "conv5_6/sep_1by2" 1539 | param { 1540 | lr_mult: 1 1541 | decay_mult: 1 1542 | } 1543 | convolution_param { 1544 | num_output: 128 1545 | bias_term: false 1546 | pad: 0 1547 | engine: CAFFE 1548 | kernel_size: 1 1549 | stride: 1 1550 | weight_filler { 1551 | type: "msra" 1552 | } 1553 | } 1554 | } 1555 | layer { 1556 | name: "conv5_6/sep/bn_1by2" 1557 | type: "BatchNorm" 1558 | bottom: "conv5_6/sep_1by2" 1559 | top: "conv5_6/sep_1by2" 1560 | param { 1561 | lr_mult: 0 1562 | decay_mult: 0 1563 | } 1564 | param { 1565 | lr_mult: 0 1566 | decay_mult: 0 1567 | } 1568 | param { 1569 | lr_mult: 0 1570 | decay_mult: 0 1571 | } 1572 | } 1573 | layer { 1574 | name: "conv5_6/sep/scale_1by2" 1575 | type: "Scale" 1576 | bottom: "conv5_6/sep_1by2" 1577 | top: "conv5_6/sep_1by2" 1578 | scale_param { 1579 | filler { 1580 | value: 1 1581 | } 1582 | bias_term: true 1583 | bias_filler { 1584 | value: 0 1585 | } 1586 | } 1587 | } 1588 | layer { 1589 | name: "relu5_6/sep_1by2" 1590 | type: "ReLU" 1591 | bottom: "conv5_6/sep_1by2" 1592 | top: "conv5_6/sep_1by2" 1593 | } 1594 | layer { 1595 | name: "conv6/dw_1by2" 1596 | type: "ConvolutionDepthwise" 1597 | bottom: "conv5_6/sep_1by2" 1598 | top: "conv6/dw_1by2" 1599 | param { 1600 | lr_mult: 1 1601 | decay_mult: 1 1602 | } 1603 | convolution_param { 1604 | num_output: 128 1605 | bias_term: false 1606 | pad: 5 1607 | kernel_size: 3 1608 | stride: 1 1609 | engine: CAFFE 1610 | dilation: 5 1611 | weight_filler { 1612 | type: "msra" 1613 | } 1614 | } 1615 | } 1616 | layer { 1617 | name: "conv6/dw/bn_1by2" 1618 | type: "BatchNorm" 1619 | bottom: "conv6/dw_1by2" 1620 | top: "conv6/dw_1by2" 1621 | param { 1622 | lr_mult: 0 1623 | decay_mult: 0 1624 | } 1625 | param { 1626 | lr_mult: 0 1627 | decay_mult: 0 1628 | } 1629 | param { 1630 | lr_mult: 0 1631 | decay_mult: 0 1632 | } 1633 | } 1634 | layer { 1635 | name: "conv6/dw/scale_1by2" 1636 | type: "Scale" 1637 | bottom: "conv6/dw_1by2" 1638 | top: "conv6/dw_1by2" 1639 | scale_param { 1640 | filler { 1641 | value: 1 1642 | } 1643 | bias_term: true 1644 | bias_filler { 1645 | value: 0 1646 | } 1647 | } 1648 | } 1649 | layer { 1650 | name: "relu6/dw_1by2" 1651 | type: "ReLU" 1652 | bottom: "conv6/dw_1by2" 1653 | top: "conv6/dw_1by2" 1654 | } 1655 | layer { 1656 | name: "conv6/sep_1by2" 1657 | type: "Convolution" 1658 | bottom: "conv6/dw_1by2" 1659 | top: "conv6/sep_1by2" 1660 | param { 1661 | lr_mult: 1 1662 | decay_mult: 1 1663 | } 1664 | convolution_param { 1665 | num_output: 128 1666 | bias_term: false 1667 | pad: 0 1668 | kernel_size: 1 1669 | stride: 1 1670 | engine: CAFFE 1671 | weight_filler { 1672 | type: "msra" 1673 | } 1674 | } 1675 | } 1676 | layer { 1677 | name: "conv6/sep/bn_1by2" 1678 | type: "BatchNorm" 1679 | bottom: "conv6/sep_1by2" 1680 | top: "conv6/sep_1by2" 1681 | param { 1682 | lr_mult: 0 1683 | decay_mult: 0 1684 | } 1685 | param { 1686 | lr_mult: 0 1687 | decay_mult: 0 1688 | } 1689 | param { 1690 | lr_mult: 0 1691 | decay_mult: 0 1692 | } 1693 | } 1694 | layer { 1695 | name: "conv6/sep/scale_1by2" 1696 | type: "Scale" 1697 | bottom: "conv6/sep_1by2" 1698 | top: "conv6/sep_1by2" 1699 | scale_param { 1700 | filler { 1701 | value: 1 1702 | } 1703 | bias_term: true 1704 | bias_filler { 1705 | value: 0 1706 | } 1707 | } 1708 | } 1709 | layer { 1710 | name: "relu6/sep_1by2" 1711 | type: "ReLU" 1712 | bottom: "conv6/sep_1by2" 1713 | top: "conv6/sep_1by2" 1714 | } 1715 | layer { 1716 | name: "concat1_1by2" 1717 | type: "Concat" 1718 | bottom: "conv6/sep_1by2" 1719 | bottom: "conv5_5/sep_1by2" 1720 | top: "concat1_1by2" 1721 | concat_param { 1722 | concat_dim:1 1723 | } 1724 | } 1725 | 1726 | 1727 | layer { 1728 | name: "concat1_1by2/dw" 1729 | type: "ConvolutionDepthwise" 1730 | bottom: "concat1_1by2" 1731 | top: "concat1_1by2/dw" 1732 | param { 1733 | lr_mult: 1 1734 | decay_mult: 0 1735 | } 1736 | convolution_param { 1737 | num_output: 256 1738 | bias_term: false 1739 | pad: 7 1740 | kernel_size: 3 1741 | stride: 1 1742 | dilation: 7 1743 | engine: CAFFE 1744 | weight_filler { 1745 | type: "msra" 1746 | } 1747 | } 1748 | } 1749 | layer { 1750 | name: "concat1_1by2/dw/bn" 1751 | type: "BatchNorm" 1752 | bottom: "concat1_1by2/dw" 1753 | top: "concat1_1by2/dw" 1754 | param { 1755 | lr_mult: 0 1756 | decay_mult: 0 1757 | } 1758 | param { 1759 | lr_mult: 0 1760 | decay_mult: 0 1761 | } 1762 | param { 1763 | lr_mult: 0 1764 | decay_mult: 0 1765 | } 1766 | } 1767 | layer { 1768 | name: "concat1_1by2/dw/scale" 1769 | type: "Scale" 1770 | bottom: "concat1_1by2/dw" 1771 | top: "concat1_1by2/dw" 1772 | scale_param { 1773 | filler { 1774 | value: 1 1775 | } 1776 | bias_term: true 1777 | bias_filler { 1778 | value: 0 1779 | } 1780 | } 1781 | } 1782 | layer { 1783 | name: "reluconcat1_1by2/dw" 1784 | type: "ReLU" 1785 | bottom: "concat1_1by2/dw" 1786 | top: "concat1_1by2/dw" 1787 | } 1788 | layer { 1789 | name: "concat1_1by2/sep" 1790 | type: "Convolution" 1791 | bottom: "concat1_1by2/dw" 1792 | top: "concat1_1by2/sep" 1793 | param { 1794 | lr_mult: 1 1795 | decay_mult: 1 1796 | } 1797 | convolution_param { 1798 | num_output: 128 1799 | bias_term: false 1800 | pad: 0 1801 | kernel_size: 1 1802 | stride: 1 1803 | engine: CAFFE 1804 | weight_filler { 1805 | type: "msra" 1806 | } 1807 | } 1808 | } 1809 | layer { 1810 | name: "concat1_1by2/sep/bn" 1811 | type: "BatchNorm" 1812 | bottom: "concat1_1by2/sep" 1813 | top: "concat1_1by2/sep" 1814 | param { 1815 | lr_mult: 0 1816 | decay_mult: 0 1817 | } 1818 | param { 1819 | lr_mult: 0 1820 | decay_mult: 0 1821 | } 1822 | param { 1823 | lr_mult: 0 1824 | decay_mult: 0 1825 | } 1826 | } 1827 | layer { 1828 | name: "concat1_1by2/sep/scale" 1829 | type: "Scale" 1830 | bottom: "concat1_1by2/sep" 1831 | top: "concat1_1by2/sep" 1832 | scale_param { 1833 | filler { 1834 | value: 1 1835 | } 1836 | bias_term: true 1837 | bias_filler { 1838 | value: 0 1839 | } 1840 | } 1841 | } 1842 | layer { 1843 | name: "reluconcat1_1by2/sep" 1844 | type: "ReLU" 1845 | bottom: "concat1_1by2/sep" 1846 | top: "concat1_1by2/sep" 1847 | } 1848 | layer { 1849 | name: "up2_1by2" 1850 | type: "Deconvolution" 1851 | bottom: "concat1_1by2/sep" 1852 | top: "up2_1by2" 1853 | param { 1854 | lr_mult: 0.1 1855 | decay_mult: 1 1856 | } 1857 | convolution_param { 1858 | weight_filler: { type: "bilinear" } 1859 | num_output: 128 1860 | group: 128 1861 | bias_term: false 1862 | kernel_size: 4 1863 | stride: 2 1864 | pad: 1 1865 | } 1866 | } 1867 | layer { 1868 | name: "concat2_1by2" 1869 | type: "Concat" 1870 | bottom: "up2_1by2" 1871 | bottom: "conv4_1/sep_1by2" 1872 | top: "concat2_1by2" 1873 | concat_param { 1874 | concat_dim:1 1875 | } 1876 | } 1877 | 1878 | 1879 | layer { 1880 | name: "concat2_1by2/dw" 1881 | type: "ConvolutionDepthwise" 1882 | bottom: "concat2_1by2" 1883 | top: "concat2_1by2/dw" 1884 | param { 1885 | lr_mult: 1 1886 | decay_mult: 0 1887 | } 1888 | convolution_param { 1889 | num_output: 256 1890 | bias_term: false 1891 | pad: 1 1892 | kernel_size: 3 1893 | stride: 1 1894 | dilation: 1 1895 | engine: CAFFE 1896 | weight_filler { 1897 | type: "msra" 1898 | } 1899 | } 1900 | } 1901 | layer { 1902 | name: "concat2_1by2/dw/bn" 1903 | type: "BatchNorm" 1904 | bottom: "concat2_1by2/dw" 1905 | top: "concat2_1by2/dw" 1906 | param { 1907 | lr_mult: 0 1908 | decay_mult: 0 1909 | } 1910 | param { 1911 | lr_mult: 0 1912 | decay_mult: 0 1913 | } 1914 | param { 1915 | lr_mult: 0 1916 | decay_mult: 0 1917 | } 1918 | } 1919 | layer { 1920 | name: "concat2_1by2/dw/scale" 1921 | type: "Scale" 1922 | bottom: "concat2_1by2/dw" 1923 | top: "concat2_1by2/dw" 1924 | scale_param { 1925 | filler { 1926 | value: 1 1927 | } 1928 | bias_term: true 1929 | bias_filler { 1930 | value: 0 1931 | } 1932 | } 1933 | } 1934 | layer { 1935 | name: "reluconcat2_1by2/dw" 1936 | type: "ReLU" 1937 | bottom: "concat2_1by2/dw" 1938 | top: "concat2_1by2/dw" 1939 | } 1940 | layer { 1941 | name: "concat2_1by2/sep" 1942 | type: "Convolution" 1943 | bottom: "concat2_1by2/dw" 1944 | top: "concat2_1by2/sep" 1945 | param { 1946 | lr_mult: 1 1947 | decay_mult: 1 1948 | } 1949 | convolution_param { 1950 | num_output: 128 1951 | bias_term: false 1952 | pad: 0 1953 | kernel_size: 1 1954 | stride: 1 1955 | engine: CAFFE 1956 | weight_filler { 1957 | type: "msra" 1958 | } 1959 | } 1960 | } 1961 | layer { 1962 | name: "concat2_1by2/sep/bn" 1963 | type: "BatchNorm" 1964 | bottom: "concat2_1by2/sep" 1965 | top: "concat2_1by2/sep" 1966 | param { 1967 | lr_mult: 0 1968 | decay_mult: 0 1969 | } 1970 | param { 1971 | lr_mult: 0 1972 | decay_mult: 0 1973 | } 1974 | param { 1975 | lr_mult: 0 1976 | decay_mult: 0 1977 | } 1978 | } 1979 | layer { 1980 | name: "concat2_1by2/sep/scale" 1981 | type: "Scale" 1982 | bottom: "concat2_1by2/sep" 1983 | top: "concat2_1by2/sep" 1984 | scale_param { 1985 | filler { 1986 | value: 1 1987 | } 1988 | bias_term: true 1989 | bias_filler { 1990 | value: 0 1991 | } 1992 | } 1993 | } 1994 | layer { 1995 | name: "reluconcat2_1by2/sep" 1996 | type: "ReLU" 1997 | bottom: "concat2_1by2/sep" 1998 | top: "concat2_1by2/sep" 1999 | } 2000 | layer { 2001 | name: "up3_1by2" 2002 | type: "Deconvolution" 2003 | bottom: "concat2_1by2/sep" 2004 | top: "up3_1by2" 2005 | param { 2006 | lr_mult: 0.1 2007 | decay_mult: 1 2008 | } 2009 | convolution_param { 2010 | weight_filler: { type: "bilinear" } 2011 | num_output: 64 2012 | group: 64 2013 | bias_term: false 2014 | kernel_size: 4 2015 | stride: 2 2016 | pad: 1 2017 | } 2018 | } 2019 | layer { 2020 | name: "concat3_1by2" 2021 | type: "Concat" 2022 | bottom: "up3_1by2" 2023 | bottom: "conv3_1/sep_1by2" 2024 | top: "concat3_1by2" 2025 | concat_param { 2026 | concat_dim:1 2027 | } 2028 | } 2029 | layer { 2030 | name: "concat3_1by2/dw" 2031 | type: "ConvolutionDepthwise" 2032 | bottom: "concat3_1by2" 2033 | top: "concat3_1by2/dw" 2034 | param { 2035 | lr_mult: 1 2036 | decay_mult: 0 2037 | } 2038 | convolution_param { 2039 | num_output: 128 2040 | bias_term: false 2041 | pad: 2 2042 | kernel_size: 3 2043 | stride: 1 2044 | dilation: 2 2045 | engine: CAFFE 2046 | weight_filler { 2047 | type: "msra" 2048 | } 2049 | } 2050 | } 2051 | layer { 2052 | name: "concat3_1by2/dw/bn" 2053 | type: "BatchNorm" 2054 | bottom: "concat3_1by2/dw" 2055 | top: "concat3_1by2/dw" 2056 | param { 2057 | lr_mult: 0 2058 | decay_mult: 0 2059 | } 2060 | param { 2061 | lr_mult: 0 2062 | decay_mult: 0 2063 | } 2064 | param { 2065 | lr_mult: 0 2066 | decay_mult: 0 2067 | } 2068 | } 2069 | layer { 2070 | name: "concat3_1by2/dw/scale" 2071 | type: "Scale" 2072 | bottom: "concat3_1by2/dw" 2073 | top: "concat3_1by2/dw" 2074 | scale_param { 2075 | filler { 2076 | value: 1 2077 | } 2078 | bias_term: true 2079 | bias_filler { 2080 | value: 0 2081 | } 2082 | } 2083 | } 2084 | layer { 2085 | name: "reluconcat3_1by2/dw" 2086 | type: "ReLU" 2087 | bottom: "concat3_1by2/dw" 2088 | top: "concat3_1by2/dw" 2089 | } 2090 | layer { 2091 | name: "concat3_1by2/sep" 2092 | type: "Convolution" 2093 | bottom: "concat3_1by2/dw" 2094 | top: "concat3_1by2/sep" 2095 | param { 2096 | lr_mult: 1 2097 | decay_mult: 1 2098 | } 2099 | convolution_param { 2100 | num_output: 64 2101 | bias_term: false 2102 | pad: 0 2103 | kernel_size: 1 2104 | stride: 1 2105 | engine: CAFFE 2106 | weight_filler { 2107 | type: "msra" 2108 | } 2109 | } 2110 | } 2111 | layer { 2112 | name: "concat3_1by2/sep/bn" 2113 | type: "BatchNorm" 2114 | bottom: "concat3_1by2/sep" 2115 | top: "concat3_1by2/sep" 2116 | param { 2117 | lr_mult: 0 2118 | decay_mult: 0 2119 | } 2120 | param { 2121 | lr_mult: 0 2122 | decay_mult: 0 2123 | } 2124 | param { 2125 | lr_mult: 0 2126 | decay_mult: 0 2127 | } 2128 | } 2129 | layer { 2130 | name: "concat3_1by2/sep/scale" 2131 | type: "Scale" 2132 | bottom: "concat3_1by2/sep" 2133 | top: "concat3_1by2/sep" 2134 | scale_param { 2135 | filler { 2136 | value: 1 2137 | } 2138 | bias_term: true 2139 | bias_filler { 2140 | value: 0 2141 | } 2142 | } 2143 | } 2144 | layer { 2145 | name: "reluconcat3_1by2/sep" 2146 | type: "ReLU" 2147 | bottom: "concat3_1by2/sep" 2148 | top: "concat3_1by2/sep" 2149 | } 2150 | layer { 2151 | name: "up4_1by2" 2152 | type: "Deconvolution" 2153 | bottom: "concat3_1by2/sep" 2154 | top: "up4_1by2" 2155 | param { 2156 | lr_mult: 0.1 2157 | decay_mult: 1 2158 | } 2159 | convolution_param { 2160 | weight_filler: { type: "bilinear" } 2161 | num_output: 32 2162 | group: 32 2163 | bias_term: false 2164 | kernel_size: 4 2165 | stride: 2 2166 | pad: 1 2167 | } 2168 | } 2169 | layer { 2170 | name: "concat4_1by2" 2171 | type: "Concat" 2172 | bottom: "up4_1by2" 2173 | bottom: "conv2_1/sep_1by2" 2174 | top: "concat4_1by2" 2175 | concat_param { 2176 | concat_dim:1 2177 | } 2178 | } 2179 | layer { 2180 | name: "concat4_1by2/dw" 2181 | type: "ConvolutionDepthwise" 2182 | bottom: "concat4_1by2" 2183 | top: "concat4_1by2/dw" 2184 | param { 2185 | lr_mult: 1 2186 | decay_mult: 0 2187 | } 2188 | convolution_param { 2189 | num_output: 64 2190 | bias_term: false 2191 | pad: 5 2192 | kernel_size: 3 2193 | stride: 1 2194 | dilation: 5 2195 | engine: CAFFE 2196 | weight_filler { 2197 | type: "msra" 2198 | } 2199 | } 2200 | } 2201 | layer { 2202 | name: "concat4_1by2/dw/bn" 2203 | type: "BatchNorm" 2204 | bottom: "concat4_1by2/dw" 2205 | top: "concat4_1by2/dw" 2206 | param { 2207 | lr_mult: 0 2208 | decay_mult: 0 2209 | } 2210 | param { 2211 | lr_mult: 0 2212 | decay_mult: 0 2213 | } 2214 | param { 2215 | lr_mult: 0 2216 | decay_mult: 0 2217 | } 2218 | } 2219 | layer { 2220 | name: "concat4_1by2/dw/scale" 2221 | type: "Scale" 2222 | bottom: "concat4_1by2/dw" 2223 | top: "concat4_1by2/dw" 2224 | scale_param { 2225 | filler { 2226 | value: 1 2227 | } 2228 | bias_term: true 2229 | bias_filler { 2230 | value: 0 2231 | } 2232 | } 2233 | } 2234 | layer { 2235 | name: "reluconcat4_1by2/dw" 2236 | type: "ReLU" 2237 | bottom: "concat4_1by2/dw" 2238 | top: "concat4_1by2/dw" 2239 | } 2240 | layer { 2241 | name: "concat4_1by2/sep" 2242 | type: "Convolution" 2243 | bottom: "concat4_1by2/dw" 2244 | top: "concat4_1by2/sep" 2245 | param { 2246 | lr_mult: 1 2247 | decay_mult: 1 2248 | } 2249 | convolution_param { 2250 | num_output: 32 2251 | bias_term: false 2252 | pad: 0 2253 | kernel_size: 1 2254 | stride: 1 2255 | engine: CAFFE 2256 | weight_filler { 2257 | type: "msra" 2258 | } 2259 | } 2260 | } 2261 | layer { 2262 | name: "concat4_1by2/sep/bn" 2263 | type: "BatchNorm" 2264 | bottom: "concat4_1by2/sep" 2265 | top: "concat4_1by2/sep" 2266 | param { 2267 | lr_mult: 0 2268 | decay_mult: 0 2269 | } 2270 | param { 2271 | lr_mult: 0 2272 | decay_mult: 0 2273 | } 2274 | param { 2275 | lr_mult: 0 2276 | decay_mult: 0 2277 | } 2278 | } 2279 | layer { 2280 | name: "concat4_1by2/sep/scale" 2281 | type: "Scale" 2282 | bottom: "concat4_1by2/sep" 2283 | top: "concat4_1by2/sep" 2284 | scale_param { 2285 | filler { 2286 | value: 1 2287 | } 2288 | bias_term: true 2289 | bias_filler { 2290 | value: 0 2291 | } 2292 | } 2293 | } 2294 | layer { 2295 | name: "reluconcat4_1by2/sep" 2296 | type: "ReLU" 2297 | bottom: "concat4_1by2/sep" 2298 | top: "concat4_1by2/sep" 2299 | } 2300 | layer { 2301 | name: "concat5_1by2" 2302 | type: "Concat" 2303 | bottom: "concat4_1by2/sep" 2304 | bottom: "conv1_1by2" 2305 | top: "concat5_1by2" 2306 | concat_param { 2307 | concat_dim:1 2308 | } 2309 | } 2310 | layer { 2311 | name: "conv_concat5_1by2" 2312 | type: "Convolution" 2313 | bottom: "concat5_1by2" 2314 | top: "conv_concat5_1by2" 2315 | param { 2316 | lr_mult: 1 2317 | decay_mult: 1 2318 | } 2319 | convolution_param { 2320 | num_output: 16 2321 | bias_term: false 2322 | pad: 7 2323 | kernel_size: 3 2324 | stride: 1 2325 | dilation: 7 2326 | engine: CAFFE 2327 | weight_filler { 2328 | type: "msra" 2329 | } 2330 | } 2331 | } 2332 | layer { 2333 | name: "conv_concat5_1by2/bn" 2334 | type: "BatchNorm" 2335 | bottom: "conv_concat5_1by2" 2336 | top: "conv_concat5_1by2" 2337 | param { 2338 | lr_mult: 0 2339 | decay_mult: 0 2340 | } 2341 | param { 2342 | lr_mult: 0 2343 | decay_mult: 0 2344 | } 2345 | param { 2346 | lr_mult: 0 2347 | decay_mult: 0 2348 | } 2349 | } 2350 | layer { 2351 | name: "conv_concat5_1by2/scale" 2352 | type: "Scale" 2353 | bottom: "conv_concat5_1by2" 2354 | top: "conv_concat5_1by2" 2355 | scale_param { 2356 | filler { 2357 | value: 1 2358 | } 2359 | bias_term: true 2360 | bias_filler { 2361 | value: 0 2362 | } 2363 | } 2364 | } 2365 | layer { 2366 | name: "reluconv_concat5_1by2" 2367 | type: "ReLU" 2368 | bottom: "conv_concat5_1by2" 2369 | top: "conv_concat5_1by2" 2370 | } 2371 | layer { 2372 | name: "score_fr_1by2" 2373 | type: "Convolution" 2374 | bottom: "conv_concat5_1by2" 2375 | top: "score_fr_1by2" 2376 | param { 2377 | lr_mult: 1 2378 | decay_mult: 1 2379 | } 2380 | param { 2381 | lr_mult: 2 2382 | decay_mult: 0 2383 | } 2384 | convolution_param { 2385 | num_output: 1 2386 | engine: CAFFE 2387 | pad: 0 2388 | kernel_size: 1 2389 | weight_filler { 2390 | type: "msra" 2391 | } 2392 | bias_filler { 2393 | type: "constant" 2394 | value: 0 2395 | } 2396 | } 2397 | } 2398 | layer { 2399 | name: "up5_1by2" 2400 | type: "Deconvolution" 2401 | bottom: "score_fr_1by2" 2402 | top: "up5_1by2" 2403 | param { 2404 | lr_mult: 0.1 2405 | decay_mult: 1 2406 | } 2407 | convolution_param { 2408 | weight_filler: { type: "bilinear" } 2409 | num_output: 1 2410 | group: 1 2411 | bias_term: false 2412 | kernel_size: 4 2413 | stride: 2 2414 | pad: 1 2415 | } 2416 | } 2417 | layer { 2418 | name: "sigmoid_1by2" 2419 | type: "Sigmoid" 2420 | bottom: "up5_1by2" 2421 | top: "up5_1by2" 2422 | } 2423 | layer { 2424 | name: "loss_1by2" 2425 | type: "DiceCoefLoss" 2426 | bottom: "up5_1by2" 2427 | bottom: "label" 2428 | top: "loss_1by2" 2429 | loss_weight: 1 2430 | include: { phase: TRAIN } 2431 | } 2432 | layer { 2433 | name: "accuracy_1by2" 2434 | type: "Accuracy" 2435 | bottom: "up5_1by2" 2436 | bottom: "label" 2437 | top: "IOU_test_1by2" 2438 | include { 2439 | phase: TEST 2440 | } 2441 | } 2442 | 2443 | #### auxi loss 16 #### 2444 | 2445 | layer { 2446 | name: "seg_scale1by2" 2447 | type: "Resize" 2448 | bottom: "label" 2449 | top: "seg_scale1by2" 2450 | resize_param { 2451 | function_type: FACTOR_GIVEN 2452 | intepolation_type: NEAREST 2453 | resize_factor: 0.5 2454 | } 2455 | include: { phase: TRAIN } 2456 | } 2457 | 2458 | layer { 2459 | name: "concat4_1by2_scale1by2/1x1" 2460 | type: "Convolution" 2461 | bottom: "concat4_1by2" 2462 | top: "concat4_1by2_scale1by2/1x1" 2463 | param { lr_mult: 1.0 decay_mult: 1.0} 2464 | param { lr_mult: 2.0 decay_mult: 0 } 2465 | convolution_param { 2466 | engine: CAFFE 2467 | num_output: 64 2468 | kernel_size: 1 pad: 0 stride: 1 2469 | weight_filler { type: "msra" } 2470 | bias_filler { type: "constant" value: 0 } 2471 | } 2472 | include: { phase: TRAIN } 2473 | } 2474 | layer { 2475 | name: "concat4_1by2_scale1by2/3x3" 2476 | type: "Convolution" 2477 | bottom: "concat4_1by2_scale1by2/1x1" 2478 | top: "concat4_1by2_scale1by2/3x3" 2479 | param { 2480 | lr_mult: 1 2481 | decay_mult: 1 2482 | } 2483 | param { 2484 | lr_mult: 2 2485 | decay_mult: 0 2486 | } 2487 | convolution_param { 2488 | engine: CAFFE 2489 | num_output: 1 2490 | pad: 1 2491 | kernel_size: 3 2492 | weight_filler { 2493 | type: "msra" 2494 | } 2495 | bias_filler { 2496 | type: "constant" 2497 | value: 0 2498 | } 2499 | } 2500 | include: { phase: TRAIN } 2501 | } 2502 | layer { 2503 | name: "loss_scale1by2" 2504 | type: "DiceCoefLoss" 2505 | bottom: "concat4_1by2_scale1by2/3x3" 2506 | bottom: "seg_scale1by2" 2507 | top: "loss_scale1by2" 2508 | loss_weight: 0.6 2509 | include: { phase: TRAIN } 2510 | } 2511 | 2512 | 2513 | #### auxi loss 8 #### 2514 | 2515 | layer { 2516 | name: "seg_scale1by4" 2517 | type: "Resize" 2518 | bottom: "label" 2519 | top: "seg_scale1by4" 2520 | resize_param { 2521 | function_type: FACTOR_GIVEN 2522 | intepolation_type: NEAREST 2523 | resize_factor: 0.25 2524 | } 2525 | include: { phase: TRAIN } 2526 | } 2527 | 2528 | layer { 2529 | name: "concat4_1by2_scale1by4/1x1" 2530 | type: "Convolution" 2531 | bottom: "concat3_1by2" 2532 | top: "concat4_1by2_scale1by4/1x1" 2533 | param { lr_mult: 1.0 decay_mult: 1.0} 2534 | param { lr_mult: 2.0 decay_mult: 0 } 2535 | convolution_param { 2536 | engine: CAFFE 2537 | num_output: 64 2538 | kernel_size: 1 pad: 0 stride: 1 2539 | weight_filler { type: "msra" } 2540 | bias_filler { type: "constant" value: 0 } 2541 | } 2542 | include: { phase: TRAIN } 2543 | } 2544 | layer { 2545 | name: "concat4_1by2_scale1by4/3x3" 2546 | type: "Convolution" 2547 | bottom: "concat4_1by2_scale1by4/1x1" 2548 | top: "concat4_1by2_scale1by4/3x3" 2549 | param { 2550 | lr_mult: 1 2551 | decay_mult: 1 2552 | } 2553 | param { 2554 | lr_mult: 2 2555 | decay_mult: 0 2556 | } 2557 | convolution_param { 2558 | engine: CAFFE 2559 | num_output: 1 2560 | pad: 1 2561 | kernel_size: 3 2562 | weight_filler { 2563 | type: "msra" 2564 | } 2565 | bias_filler { 2566 | type: "constant" 2567 | value: 0 2568 | } 2569 | } 2570 | include: { phase: TRAIN } 2571 | } 2572 | layer { 2573 | name: "loss_scale1by4" 2574 | type: "DiceCoefLoss" 2575 | bottom: "concat4_1by2_scale1by4/3x3" 2576 | bottom: "seg_scale1by4" 2577 | top: "loss_scale1by4" 2578 | loss_weight: 0.3 2579 | include: { phase: TRAIN } 2580 | } 2581 | 2582 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MobileNetv2 2 | 3 | Run the script benchmark_mobilenetv2.sh and you can get the result: top1/top5: 0.7123/0.9018 4 | 5 | You can use this model to do a lot of things such as training a smaller mobilenetv2 (By moving params or knowledge distillation) 6 | 7 | Small MobileNetV1/V2 is friendly used on a mobile device (U-net for semanic segmentation and refinedet for object detection) 8 | 9 | Training details for ImageNet2012 : 10 | type: "SGD" 11 | lr_policy: "poly" 12 | base_lr: 0.045 13 | power: 1 14 | momentum: 0.9 15 | weight_decay: 0.00004 16 | 17 | 18 | The pytorch version: https://github.com/suzhenghang/MobileNetV2_Pytorch 19 | 20 | 21 | The prototxt of SmallMobileUnet: https://github.com/suzhenghang/MobileNetv2/blob/master/MobileUnet1by2.prototxt 22 | 23 | The prototxt of SmallRefineDet_mobilev2_ssdlite: https://github.com/suzhenghang/MobileNetv2/blob/master/SmallRefineDet_mobilev2_ssdlite.prototxt 24 | -------------------------------------------------------------------------------- /forMobileUNet/dice_coef_loss_layer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "caffe/layers/dice_coef_loss_layer.hpp" 4 | #include "caffe/util/math_functions.hpp" 5 | 6 | namespace caffe { 7 | 8 | template 9 | void DiceCoefLossLayer::Reshape( 10 | const vector*>& bottom, const vector*>& top) { 11 | LossLayer::Reshape(bottom, top); 12 | CHECK_EQ(bottom[0]->count(1), bottom[1]->count(1)) 13 | << "Inputs must have the same dimension."; 14 | const int batchsize = bottom[0]->num(); 15 | const int dim = bottom[0]->count(1); 16 | 17 | vector multiplier_shape(1, dim); 18 | vector result_shape(1, batchsize); 19 | result_.Reshape(result_shape); 20 | result_tmp_.Reshape(result_shape); 21 | multiplier_.Reshape(multiplier_shape); 22 | tmp_.ReshapeLike(*bottom[0]); 23 | smooth = Dtype(1.); 24 | caffe_set(dim, Dtype(1), multiplier_.mutable_cpu_data()); 25 | caffe_set(batchsize, smooth, result_tmp_.mutable_cpu_data()); 26 | caffe_set(batchsize, smooth, result_.mutable_cpu_data()); 27 | } 28 | 29 | template 30 | void DiceCoefLossLayer::Forward_cpu(const vector*>& bottom, 31 | const vector*>& top) { 32 | caffe_mul(bottom[0]->count(), bottom[0]->cpu_data(), bottom[0]->cpu_data(), 33 | tmp_.mutable_cpu_data()); 34 | caffe_cpu_gemv(CblasNoTrans, bottom[0]->num(), bottom[0]->count(1), Dtype(1.), tmp_.cpu_data(), 35 | multiplier_.cpu_data(), Dtype(1.), result_tmp_.mutable_cpu_data()); 36 | caffe_mul(bottom[1]->count(), bottom[1]->cpu_data(), bottom[1]->cpu_data(), 37 | tmp_.mutable_cpu_data()); 38 | caffe_cpu_gemv(CblasNoTrans, bottom[1]->num(), bottom[1]->count(1), Dtype(1.), tmp_.cpu_data(), 39 | multiplier_.cpu_data(), Dtype(1.), result_tmp_.mutable_cpu_data()); 40 | caffe_mul(bottom[0]->count(), bottom[0]->cpu_data(), bottom[1]->cpu_data(), 41 | tmp_.mutable_cpu_data()); 42 | caffe_cpu_gemv(CblasNoTrans, bottom[1]->num(), bottom[1]->count(1), Dtype(2.), tmp_.cpu_data(), 43 | multiplier_.cpu_data(), Dtype(1.), result_.mutable_cpu_data()); 44 | caffe_div(bottom[0]->num(), result_.cpu_data(), result_tmp_.cpu_data(), result_.mutable_cpu_data()); 45 | 46 | Dtype loss = Dtype(1) - caffe_cpu_asum(bottom[0]->num(), result_.cpu_data()) / bottom[0]->num(); 47 | top[0]->mutable_cpu_data()[0] = loss; 48 | } 49 | 50 | template 51 | void DiceCoefLossLayer::Backward_cpu(const vector*>& top, 52 | const vector& propagate_down, const vector*>& bottom) { 53 | for (int i = 0; i < 2; ++i) { 54 | if (propagate_down[i]) { 55 | const Dtype sign = Dtype(1.0); 56 | const int index = (i == 0) ? 1 : 0; 57 | caffe_copy(bottom[i]->count(), bottom[i]->cpu_data(), bottom[i]->mutable_cpu_diff()); 58 | for (int j = 0; j < bottom[i]->num(); j++) { 59 | const Dtype alpha = sign * top[0]->cpu_diff()[0] / result_tmp_.cpu_data()[j]; 60 | // LOG(INFO) << top[0]->cpu_diff()[0]; 61 | caffe_cpu_axpby( 62 | bottom[i]->count(1), // count 63 | alpha*Dtype(-2), // alpha 64 | bottom[index]->cpu_data()+j*bottom[i]->count(1), // a 65 | alpha*result_.cpu_data()[j]*Dtype(2), // beta 66 | bottom[i]->mutable_cpu_diff()+j*bottom[i]->count(1) 67 | ); // b 68 | } 69 | } 70 | } 71 | } 72 | 73 | #ifdef CPU_ONLY 74 | STUB_GPU(DiceCoefLossLayer); 75 | #endif 76 | 77 | INSTANTIATE_CLASS(DiceCoefLossLayer); 78 | REGISTER_LAYER_CLASS(DiceCoefLoss); 79 | 80 | } // namespace caffe 81 | -------------------------------------------------------------------------------- /forMobileUNet/dice_coef_loss_layer.cu: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "caffe/layers/dice_coef_loss_layer.hpp" 4 | #include "caffe/util/math_functions.hpp" 5 | 6 | namespace caffe { 7 | 8 | template 9 | void DiceCoefLossLayer::Forward_gpu(const vector*>& bottom, 10 | const vector*>& top) { 11 | int count = bottom[0]->count(); 12 | 13 | caffe_gpu_mul(count, bottom[0]->gpu_data(), bottom[0]->gpu_data(), 14 | tmp_.mutable_gpu_data()); 15 | 16 | caffe_gpu_gemv(CblasNoTrans, bottom[0]->num(), bottom[0]->count(1), Dtype(1.), tmp_.gpu_data(), 17 | multiplier_.gpu_data(), Dtype(1.), result_tmp_.mutable_gpu_data()); 18 | caffe_gpu_mul(count, bottom[1]->gpu_data(), bottom[1]->gpu_data(), 19 | tmp_.mutable_gpu_data()); 20 | caffe_gpu_gemv(CblasNoTrans, bottom[1]->num(), bottom[1]->count(1), Dtype(1.), tmp_.gpu_data(), 21 | multiplier_.gpu_data(), Dtype(1.), result_tmp_.mutable_gpu_data()); 22 | caffe_gpu_mul(count, bottom[0]->gpu_data(), bottom[1]->gpu_data(), 23 | tmp_.mutable_gpu_data()); 24 | caffe_gpu_gemv(CblasNoTrans, bottom[1]->num(), bottom[1]->count(1), Dtype(2.), tmp_.gpu_data(), 25 | multiplier_.gpu_data(), Dtype(1.), result_.mutable_gpu_data()); 26 | caffe_gpu_div(bottom[0]->num(), result_.gpu_data(), result_tmp_.gpu_data(), 27 | result_.mutable_gpu_data()); 28 | Dtype loss; 29 | caffe_gpu_asum(bottom[0]->num(), result_.gpu_data(), &loss); 30 | loss /= bottom[0]->num(); 31 | loss = Dtype(1.) - loss; 32 | top[0]->mutable_cpu_data()[0] = loss; 33 | } 34 | 35 | template 36 | __global__ void DiceCoefLossBackward(const int n, const Dtype* x, 37 | const Dtype* y, Dtype* out_diff, const Dtype sign, 38 | const Dtype* loss, const Dtype* denominator, const int dim) { 39 | CUDA_KERNEL_LOOP(index, n) { 40 | const int i = index / dim; 41 | const Dtype alpha = Dtype(-2.) / denominator[i] * sign; 42 | const Dtype beta = Dtype(2.) * loss[i] / denominator[i] * sign; 43 | out_diff[index] = alpha * x[index] + beta * y[index]; 44 | } 45 | } 46 | 47 | template 48 | void DiceCoefLossLayer::Backward_gpu(const vector*>& top, 49 | const vector& propagate_down, const vector*>& bottom) { 50 | for (int i = 0; i < 2; ++i) { 51 | if (propagate_down[i]) { 52 | int count = bottom[i]->count(); 53 | const Dtype sign = Dtype(1.0)*top[0]->cpu_diff()[0]; 54 | const int index = (i == 0) ? 1 : 0; 55 | DiceCoefLossBackward<<>>( 56 | count, bottom[index]->gpu_data(), bottom[i]->gpu_data(), bottom[i]->mutable_gpu_diff(), 57 | sign, result_.gpu_data(), result_tmp_.gpu_data(), bottom[i]->count(1)); 58 | CUDA_POST_KERNEL_CHECK; 59 | } 60 | } 61 | } 62 | 63 | INSTANTIATE_LAYER_GPU_FUNCS(DiceCoefLossLayer); 64 | 65 | } // namespace caffe 66 | -------------------------------------------------------------------------------- /forMobileUNet/dice_coef_loss_layer.hpp: -------------------------------------------------------------------------------- 1 | #ifndef CAFFE_DICE_COEF_LOSS_LAYER_HPP_ 2 | #define CAFFE_DICE_COEF_LOSS_LAYER_HPP_ 3 | 4 | #include 5 | 6 | #include "caffe/blob.hpp" 7 | #include "caffe/layer.hpp" 8 | #include "caffe/proto/caffe.pb.h" 9 | 10 | #include "caffe/layers/loss_layer.hpp" 11 | 12 | namespace caffe { 13 | 14 | /** 15 | * @brief Computes the Euclidean (L2) loss @f$ 16 | * E = \frac{1}{2N} \sum\limits_{n=1}^N \left| \left| \hat{y}_n - y_n 17 | * \right| \right|_2^2 @f$ for real-valued regression tasks. 18 | * 19 | * @param bottom input Blob vector (length 2) 20 | * -# @f$ (N \times C \times H \times W) @f$ 21 | * the predictions @f$ \hat{y} \in [-\infty, +\infty]@f$ 22 | * -# @f$ (N \times C \times H \times W) @f$ 23 | * the targets @f$ y \in [-\infty, +\infty]@f$ 24 | * @param top output Blob vector (length 1) 25 | * -# @f$ (1 \times 1 \times 1 \times 1) @f$ 26 | * the computed Euclidean loss: @f$ E = 27 | * \frac{1}{2n} \sum\limits_{n=1}^N \left| \left| \hat{y}_n - y_n 28 | * \right| \right|_2^2 @f$ 29 | * 30 | * This can be used for least-squares regression tasks. An InnerProductLayer 31 | * input to a DiceCoefLossLayer exactly formulates a linear least squares 32 | * regression problem. With non-zero weight decay the problem becomes one of 33 | * ridge regression -- see src/caffe/test/test_sgd_solver.cpp for a concrete 34 | * example wherein we check that the gradients computed for a Net with exactly 35 | * this structure match hand-computed gradient formulas for ridge regression. 36 | * 37 | * (Note: Caffe, and SGD in general, is certainly \b not the best way to solve 38 | * linear least squares problems! We use it only as an instructive example.) 39 | */ 40 | template 41 | class DiceCoefLossLayer : public LossLayer { 42 | public: 43 | explicit DiceCoefLossLayer(const LayerParameter& param) 44 | : LossLayer(param), multiplier_() ,result_() ,result_tmp_() ,tmp_(){} 45 | virtual void Reshape(const vector*>& bottom, 46 | const vector*>& top); 47 | 48 | virtual inline const char* type() const { return "DiceCoefLoss"; } 49 | /** 50 | * Unlike most loss layers, in the DiceCoefLossLayer we can backpropagate 51 | * to both inputs -- override to return true and always allow force_backward. 52 | */ 53 | virtual inline bool AllowForceBackward(const int bottom_index) const { 54 | return true; 55 | } 56 | 57 | protected: 58 | /// @copydoc DiceCoefLossLayer 59 | virtual void Forward_cpu(const vector*>& bottom, 60 | const vector*>& top); 61 | virtual void Forward_gpu(const vector*>& bottom, 62 | const vector*>& top); 63 | 64 | /** 65 | * @brief Computes the Euclidean error gradient w.r.t. the inputs. 66 | * 67 | * Unlike other children of LossLayer, DiceCoefLossLayer \b can compute 68 | * gradients with respect to the label inputs bottom[1] (but still only will 69 | * if propagate_down[1] is set, due to being produced by learnable parameters 70 | * or if force_backward is set). In fact, this layer is "commutative" -- the 71 | * result is the same regardless of the order of the two bottoms. 72 | * 73 | * @param top output Blob vector (length 1), providing the error gradient with 74 | * respect to the outputs 75 | * -# @f$ (1 \times 1 \times 1 \times 1) @f$ 76 | * This Blob's diff will simply contain the loss_weight* @f$ \lambda @f$, 77 | * as @f$ \lambda @f$ is the coefficient of this layer's output 78 | * @f$\ell_i@f$ in the overall Net loss 79 | * @f$ E = \lambda_i \ell_i + \mbox{other loss terms}@f$; hence 80 | * @f$ \frac{\partial E}{\partial \ell_i} = \lambda_i @f$. 81 | * (*Assuming that this top Blob is not used as a bottom (input) by any 82 | * other layer of the Net.) 83 | * @param propagate_down see Layer::Backward. 84 | * @param bottom input Blob vector (length 2) 85 | * -# @f$ (N \times C \times H \times W) @f$ 86 | * the predictions @f$\hat{y}@f$; Backward fills their diff with 87 | * gradients @f$ 88 | * \frac{\partial E}{\partial \hat{y}} = 89 | * \frac{1}{n} \sum\limits_{n=1}^N (\hat{y}_n - y_n) 90 | * @f$ if propagate_down[0] 91 | * -# @f$ (N \times C \times H \times W) @f$ 92 | * the targets @f$y@f$; Backward fills their diff with gradients 93 | * @f$ \frac{\partial E}{\partial y} = 94 | * \frac{1}{n} \sum\limits_{n=1}^N (y_n - \hat{y}_n) 95 | * @f$ if propagate_down[1] 96 | */ 97 | virtual void Backward_cpu(const vector*>& top, 98 | const vector& propagate_down, const vector*>& bottom); 99 | virtual void Backward_gpu(const vector*>& top, 100 | const vector& propagate_down, const vector*>& bottom); 101 | 102 | Blob multiplier_; 103 | Blob result_; 104 | Blob result_tmp_; 105 | Blob tmp_; 106 | 107 | Dtype smooth; 108 | }; 109 | 110 | } // namespace caffe 111 | 112 | #endif // CAFFE_EUCLIDEAN_LOSS_LAYER_HPP_ 113 | -------------------------------------------------------------------------------- /forMobileUNet/hello.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /forMobileUNet/resize_layer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Integrate imgResize and blobAlign python layers together. 3 | * 4 | * Author: Wei Zhen @ IIE, CAS 5 | * Last modified: 2017-06-11 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | #include "caffe/layer.hpp" 12 | #include "caffe/util/math_functions.hpp" 13 | #include "caffe/layers/resize_layer.hpp" 14 | 15 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) 16 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) 17 | 18 | namespace caffe { 19 | 20 | template 21 | void ResizeLayer::LayerSetUp(const vector*>& bottom, 22 | const vector*>& top) { 23 | // do nothing 24 | } 25 | 26 | template 27 | void ResizeLayer::Reshape(const vector*>& bottom, 28 | const vector*>& top) { 29 | // parse params and get resize factor 30 | this->input_size_ = bottom[0]->height(); 31 | 32 | SegResizeParameter resize_param = this->layer_param_.resize_param(); 33 | switch (resize_param.function_type()) { 34 | case SegResizeParameter_FunctionType_SIZE_GIVEN: 35 | if (resize_param.output_size() <= 0) { 36 | LOG(INFO)<< "Illegal output size (" << resize_param.output_size() << "), use default resize factor 1."; 37 | } 38 | else { 39 | this->output_size_ = resize_param.output_size(); 40 | this->resize_factor_ = (float)this->output_size_ / this->input_size_; 41 | } 42 | break; 43 | case SegResizeParameter_FunctionType_BLOB_ALIGN: 44 | CHECK_EQ(bottom.size(), 2) << "When using BLOB_ALIGN option, bottom[1] must be given."; 45 | this->output_size_ = bottom[1]->height(); 46 | this->resize_factor_ = (float)this->output_size_ / this->input_size_; 47 | break; 48 | case SegResizeParameter_FunctionType_FACTOR_GIVEN: 49 | CHECK_GT(resize_param.resize_factor(), 0) << "Illegal resize factor (" << resize_param.resize_factor() << ")."; 50 | this->resize_factor_ = resize_param.resize_factor(); 51 | this->output_size_ = static_cast(this->input_size_ * this->resize_factor_); 52 | break; 53 | default: 54 | this->resize_factor_ = 1; 55 | this->output_size_ = this->input_size_; 56 | } 57 | 58 | // reshape top (assume that all features are square) 59 | top[0]->Reshape(bottom[0]->num(), bottom[0]->channels(), this->output_size_, this->output_size_); 60 | } 61 | 62 | template 63 | void ResizeLayer::Forward_cpu(const vector*>& bottom, 64 | const vector*>& top) { 65 | 66 | const Dtype* bottom_data = bottom[0]->cpu_data(); 67 | Dtype* top_data = top[0]->mutable_cpu_data(); 68 | 69 | // perform interpolation based on different interpolation types 70 | switch (this->layer_param_.resize_param().intepolation_type()) { 71 | case SegResizeParameter_InterpolationType_NEAREST: 72 | for (int n = 0; n < bottom[0]->num(); ++n) { 73 | for (int c = 0; c < bottom[0]->channels(); ++c) { 74 | for (int rh = 0; rh < this->output_size_; ++rh) { 75 | for (int rw = 0; rw < this->output_size_; ++rw) { 76 | int h = int(rh / this->resize_factor_); 77 | int w = int(rw / this->resize_factor_); 78 | h = std::min(h, this->input_size_); 79 | w = std::min(w, this->input_size_); 80 | top_data[rh * this->output_size_ + rw] = bottom_data[h * this->input_size_ + w]; 81 | } 82 | } 83 | // compute offset 84 | bottom_data += bottom[0]->offset(0, 1); 85 | top_data += top[0]->offset(0, 1); 86 | } 87 | } 88 | break; 89 | case SegResizeParameter_InterpolationType_BILINEAR: 90 | for (int n = 0; n < bottom[0]->num(); ++n) { 91 | for (int c = 0; c < bottom[0]->channels(); ++c) { 92 | for (int rh = 0; rh < this->output_size_; ++rh) { 93 | for (int rw = 0; rw < this->output_size_; ++rw) { 94 | float h = rh / this->resize_factor_; 95 | float w = rw / this->resize_factor_; 96 | //h = std::min(h, this->input_size_); 97 | //w = std::min(w, this->input_size_); 98 | int top_idx = rh * this->output_size_ + rw; 99 | top_data[top_idx] = 0; // DO NOT forget to reset before accumulation 100 | for (int n = MAX(static_cast(h-1) + 1, 0); n < MIN(h + 1, this->input_size_); n++) { 101 | for (int m = MAX(static_cast(w-1) + 1, 0); m < MIN(w + 1, this->input_size_); m++) { 102 | top_data[top_idx] += bottom_data[n * this->input_size_ + m] * (1 - std::abs(w-m)) * (1 - std::abs(h-n)); 103 | } 104 | } 105 | } 106 | } 107 | // compute offset 108 | bottom_data += bottom[0]->offset(0, 1); 109 | top_data += top[0]->offset(0, 1); 110 | } 111 | } 112 | break; 113 | default: 114 | LOG(FATAL) << "Unknown interpolation type."; 115 | } 116 | } 117 | 118 | template 119 | void ResizeLayer::Backward_cpu(const vector*>& top, 120 | const vector& propagate_down, const vector*>& bottom) { 121 | if (!propagate_down[0]) { return; } 122 | 123 | const Dtype* top_diff = top[0]->cpu_diff(); 124 | Dtype* bottom_diff = bottom[0]->mutable_cpu_diff(); 125 | caffe_set(bottom[0]->count(), Dtype(0), bottom_diff); 126 | 127 | // data gradient 128 | switch (this->layer_param_.resize_param().intepolation_type()) { 129 | case SegResizeParameter_InterpolationType_NEAREST: 130 | for (int n = 0; n < top[0]->num(); ++n) { 131 | for (int c = 0; c < top[0]->channels(); ++c) { 132 | for (int h = 0; h < this->input_size_; ++h) { 133 | for (int w = 0; w < this->input_size_; ++w) { 134 | int rh = int(h * this->resize_factor_); 135 | int rw = int(w * this->resize_factor_); 136 | rh = std::min(rh, this->output_size_ - 1); 137 | rw = std::min(rw, this->output_size_ - 1); 138 | bottom_diff[h * this->input_size_ + w] = top_diff[rh * this->output_size_ + rw]; 139 | } 140 | } 141 | // offset 142 | bottom_diff += bottom[0]->offset(0, 1); 143 | top_diff += top[0]->offset(0, 1); 144 | } 145 | } 146 | break; 147 | case SegResizeParameter_InterpolationType_BILINEAR: 148 | for (int n = 0; n < top[0]->num(); ++n) { 149 | for (int c = 0; c < top[0]->channels(); ++c) { 150 | for (int rh = 0; rh < this->output_size_; ++rh) { 151 | for (int rw = 0; rw < this->output_size_; ++rw) { 152 | float h = rh / this->resize_factor_; 153 | float w = rw / this->resize_factor_; 154 | 155 | int top_idx = rh * this->output_size_ + rw; 156 | int h0 = std::max(int(h), 0); 157 | int w0 = std::max(int(w), 0); 158 | int h1 = 0; 159 | float weight_h_h1 = 0; 160 | float weight_w_w0 = std::max(1 - std::abs(w - w0), float (0)); 161 | float weight_h_h0 = std::max(1 - std::abs(h - h0), float (0)); 162 | if (h < this->input_size_-1) { // h1 does not exceed input_size 163 | h1 = std::min(int(h)+1, this->input_size_ - 1); 164 | weight_h_h1 = std::max(1 - std::abs(h - h1), float (0)); 165 | if (w0 == 0) { // the first column 166 | bottom_diff[h1 * this->input_size_ + w0] += top_diff[top_idx] * weight_w_w0 * weight_h_h1 * 2; 167 | } else { 168 | bottom_diff[h1 * this->input_size_ + w0] += top_diff[top_idx] * weight_w_w0 * weight_h_h1; 169 | } 170 | } 171 | if (w < this->input_size_-1) { // w1 does not exceed input_size 172 | int w1 = std::min(int(w)+1, this->input_size_ - 1); 173 | float weight_w_w1 = std::max(1 - std::abs(w - w1), float (0)); 174 | if (h0 == 0) { // the first row 175 | bottom_diff[h0 * this->input_size_ + w1] += top_diff[top_idx] * weight_w_w1 * weight_h_h0*2; 176 | } else { 177 | bottom_diff[h0 * this->input_size_ + w1] += top_diff[top_idx] * weight_w_w1 * weight_h_h0; 178 | } 179 | if (h < this->input_size_-1) { // for the very left-bottom one 180 | bottom_diff[h1 * this->input_size_ + w1] += top_diff[top_idx] * weight_w_w1 * weight_h_h1; 181 | } 182 | } 183 | 184 | bottom_diff[h0 * this->input_size_ + w0] += top_diff[top_idx] * weight_w_w0 * weight_h_h0; 185 | } 186 | } 187 | // normalize 188 | caffe_scal(bottom[0]->count(), this->resize_factor_>1 ? 1/this->resize_factor_/this->resize_factor_ : 1, bottom_diff); 189 | // offset 190 | bottom_diff += bottom[0]->offset(0, 1); 191 | top_diff += top[0]->offset(0, 1); 192 | } 193 | } 194 | /*for (int n = 0; n < top[0]->num(); ++n) { 195 | for (int c = 0; c < top[0]->channels(); ++c) { 196 | for (int h = 0; h < this->input_size_; ++h) { 197 | for (int w = 0; w < this->input_size_; ++w) { 198 | int hstart = int((h - 1) * this->resize_factor_) + 1; 199 | int wstart = int((w - 1) * this->resize_factor_) + 1; 200 | int hend = int((h + 1) * this->resize_factor_); 201 | int wend = int((w + 1) * this->resize_factor_); 202 | hstart = std::max(hstart, 0); 203 | wstart = std::max(wstart, 0); 204 | hend = std::min(hend, this->output_size_ - 1); 205 | wend = std::min(wend, this->output_size_ - 1); 206 | const int bottom_idx = h * this->input_size_ + w; 207 | for (int rh = hstart; rh < hend; ++rh) { 208 | for (int rw = wstart; rw < wend; ++rw) { 209 | bottom_diff[bottom_idx] += top_diff[rh * this->output_size_ + rw] 210 | * (1 - std::abs((rw / this->resize_factor_) - w)) * (1 - std::abs((rh / this->resize_factor_) - h)); 211 | } 212 | } 213 | bottom_diff[bottom_idx] /= (hend-hstart) * (wend-wstart); 214 | } 215 | } 216 | // offset 217 | bottom_diff += bottom[0]->offset(0, 1); 218 | top_diff += top[0]->offset(0, 1); 219 | } 220 | }*/ 221 | 222 | break; 223 | default: 224 | LOG(FATAL) << "Unknown interpolation type."; 225 | } 226 | } 227 | 228 | #ifdef CPU_ONLY 229 | STUB_GPU(ResizeLayer); 230 | #endif 231 | 232 | INSTANTIATE_CLASS(ResizeLayer); 233 | REGISTER_LAYER_CLASS(Resize); 234 | } // namespace caffe 235 | -------------------------------------------------------------------------------- /forMobileUNet/resize_layer.cu: -------------------------------------------------------------------------------- 1 | /* 2 | * Integrate imgResize and blobAlign python layers together. 3 | * 4 | * Author: Wei Zhen @ IIE, CAS 5 | * Last modified: 2017-06-11 6 | */ 7 | 8 | #include 9 | #include 10 | 11 | #include "caffe/layer.hpp" 12 | #include "caffe/util/math_functions.hpp" 13 | #include "caffe/layers/resize_layer.hpp" 14 | 15 | #define MAX(a, b) ((a) > (b) ? (a) : (b)) 16 | #define MIN(a, b) ((a) < (b) ? (a) : (b)) 17 | 18 | namespace caffe { 19 | 20 | template 21 | __global__ void nearestForwardGPU(const int nthreads, 22 | const int input_channels, const int input_size, const int output_size, const float resize_factor, 23 | const Dtype* bottom_data, Dtype* top_data) { 24 | 25 | CUDA_KERNEL_LOOP(index, nthreads) { 26 | // resume channel idx and pixel idx 27 | int rw = index % output_size; 28 | int rh = (index / output_size) % output_size; 29 | int c = (index / output_size / output_size) % input_channels; 30 | int n = index / output_size / output_size / input_channels; 31 | // indexing and sampling 32 | int h = int(rh / resize_factor); 33 | int w = int(rw / resize_factor); 34 | h = min(h, input_size); 35 | w = min(w, input_size); 36 | const Dtype* bottom_data_channel = bottom_data + (n * input_channels + c) * input_size * input_size; 37 | top_data[index] = bottom_data_channel[h * input_size + w]; 38 | } 39 | } 40 | 41 | template 42 | __global__ void bilinearForwardGPU(const int nthreads, 43 | const int input_channels, const int input_size, const int output_size, const float resize_factor, 44 | const Dtype *bottom_data, Dtype *top_data) { 45 | 46 | CUDA_KERNEL_LOOP(index, nthreads) { 47 | // resume channel idx and pixel idx 48 | int rw = index % output_size; 49 | int rh = (index / output_size) % output_size; 50 | int c = (index / output_size / output_size) % input_channels; 51 | int num = index / output_size / output_size / input_channels; 52 | // indexing and sampling 53 | float h = rh / resize_factor; 54 | float w = rw / resize_factor; 55 | //h = min(h, float(input_size)); 56 | //w = min(w, float(input_size)); 57 | const Dtype* bottom_data_channel = bottom_data + (num * input_channels + c) * input_size * input_size; 58 | top_data[index] = 0; // DO NOT forget to reset before accumulation 59 | for (int n = MAX(floor(h-1) + 1, 0); n < MIN(h + 1, input_size); n++) { 60 | for (int m = MAX(floor(w-1) + 1, 0); m < MIN(w + 1, input_size); m++) { 61 | top_data[index] += bottom_data_channel[n * input_size + m] * (1 - abs(w - m)) * (1 - abs(h - n)); 62 | } 63 | } 64 | } 65 | } 66 | 67 | template 68 | void ResizeLayer::Forward_gpu(const vector*>& bottom, 69 | const vector*>& top) { 70 | 71 | const Dtype* bottom_data = bottom[0]->gpu_data(); 72 | Dtype* top_data = top[0]->mutable_gpu_data(); 73 | int count = top[0]->count(); 74 | 75 | // perform interpolation based on different interpolation types 76 | switch (this->layer_param_.resize_param().intepolation_type()) { 77 | case SegResizeParameter_InterpolationType_NEAREST: 78 | // parallel at pixel level 79 | nearestForwardGPU<<>> 80 | (count, bottom[0]->channels(), this->input_size_, this->output_size_, 81 | this->resize_factor_, bottom_data, top_data); 82 | break; 83 | case SegResizeParameter_InterpolationType_BILINEAR: 84 | // parallel at pixel level 85 | bilinearForwardGPU<<>> 86 | (count, bottom[0]->channels(), this->input_size_, this->output_size_, 87 | this->resize_factor_, bottom_data, top_data); 88 | break; 89 | default: 90 | LOG(FATAL) << "Unknown interpolation type."; 91 | } 92 | } 93 | 94 | template 95 | __global__ void nearestBackwardGPU(const int nthreads, 96 | const int input_channels, const int input_size, const int output_size, const float resize_factor, 97 | Dtype* bottom_diff, const Dtype* top_diff) { 98 | 99 | CUDA_KERNEL_LOOP(index, nthreads) { 100 | // resume channel idx and pixel idx 101 | int w = index % input_size; 102 | int h = (index / input_size) % input_size; 103 | int c = (index / input_size / input_size) % input_channels; 104 | int n = index / input_size / input_size / input_channels; 105 | // indexing and sampling 106 | int rh = int(h * resize_factor); 107 | int rw = int(w * resize_factor); 108 | rh = min(rh, output_size - 1); 109 | rw = min(rw, output_size - 1); 110 | top_diff += (n*input_channels + c) * output_size * output_size; 111 | bottom_diff[index] = top_diff[rh * output_size + rw]; 112 | } 113 | } 114 | 115 | template 116 | __global__ void bilinearBackwardGPU(const int nthreads, 117 | const int input_channels, const int input_size, const int output_size, const float resize_factor, 118 | Dtype* bottom_diff, const Dtype* top_diff) { 119 | 120 | /*CUDA_KERNEL_LOOP(index, nthreads) { 121 | // resume channel idx 122 | int c = index % input_channels; 123 | int n = index / input_channels; 124 | 125 | // indexing and sampling 126 | for (int rh = 0; rh < output_size; ++rh){ 127 | for (int rw = 0; rw < output_size; ++rw){ 128 | float h = rh / resize_factor; 129 | float w = rw / resize_factor; 130 | int top_idx = ((n*input_channels + c) * output_size + rh ) * output_size + rw; 131 | Dtype* bottom_diff_channel = bottom_diff + (n*input_channels + c) * input_size * input_size; 132 | 133 | int h0 = max(int(h), 0); 134 | int w0 = max(int(w), 0); 135 | int h1 = 0; 136 | float weight_h_h1 = 0; 137 | 138 | float weight_w_w0 = max(1 - abs(w - w0), 0.); 139 | float weight_h_h0 = max(1 - abs(h - h0), 0.); 140 | if (h < input_size-1) { // h1 does not exceed input_size 141 | h1 = min(int(h)+1, input_size - 1); 142 | weight_h_h1 = max(1 - std::abs(h - h1), float (0)); 143 | if (w0 == 0) { // the first column 144 | bottom_diff_channel[h1 * input_size + w0] += top_diff[top_idx] * weight_w_w0 * weight_h_h1 * 2; 145 | } else { 146 | bottom_diff_channel[h1 * input_size + w0] += top_diff[top_idx] * weight_w_w0 * weight_h_h1; 147 | } 148 | } 149 | if (w < input_size-1) { // w1 does not exceed input_size 150 | int w1 = min(int(w)+1, input_size - 1); 151 | float weight_w_w1 = max(1 - std::abs(w - w1), float (0)); 152 | if (h0 == 0) { // the first row 153 | bottom_diff_channel[h0 * input_size + w1] += top_diff[top_idx] * weight_w_w1 * weight_h_h0 * 2; 154 | } else { 155 | bottom_diff_channel[h0 * input_size + w1] += top_diff[top_idx] * weight_w_w1 * weight_h_h0; 156 | } 157 | if (h < input_size-1) { // for the very left-bottom one 158 | bottom_diff_channel[h1 * input_size + w1] += top_diff[top_idx] * weight_w_w1 * weight_h_h1; 159 | } 160 | } 161 | } 162 | } 163 | // the normalization is outside this function 164 | }*/ 165 | CUDA_KERNEL_LOOP(index, nthreads) { 166 | // resume channel idx and pixel idx 167 | int w = index % input_size; 168 | int h = (index / input_size) % input_size; 169 | int c = (index / input_size / input_size) % input_channels; 170 | int n = index / input_size / input_size / input_channels; 171 | // indexing and sampling 172 | float hstart = (h - 1) * resize_factor + 1; 173 | float wstart = (w - 1) * resize_factor + 1; 174 | float hend = (h + 1) * resize_factor; 175 | float wend = (w + 1) * resize_factor; 176 | hstart = max(hstart, 0.); 177 | wstart = max(wstart, 0.); 178 | hend = min(hend, float(output_size)); 179 | wend = min(wend, float(output_size)); 180 | const Dtype* top_diff_channel = top_diff + (n*input_channels + c) * output_size * output_size; 181 | bottom_diff[index] = 0; 182 | for (int rh = hstart; rh < hend; ++rh) { 183 | for (int rw = wstart; rw < wend; ++rw) { 184 | bottom_diff[index] += top_diff_channel[rh * output_size + rw] 185 | * (1 - abs((rw / resize_factor) - w)) * (1 - abs((rh / resize_factor) - h)); 186 | } 187 | } 188 | bottom_diff[index] /= resize_factor*resize_factor; 189 | } 190 | } 191 | 192 | template 193 | void ResizeLayer::Backward_gpu(const vector*>& top, 194 | const vector& propagate_down, const vector*>& bottom) { 195 | if (!propagate_down[0]) { return; } 196 | 197 | const Dtype* top_diff = top[0]->gpu_diff(); 198 | Dtype* bottom_diff = bottom[0]->mutable_gpu_diff(); 199 | const int bottom_count = bottom[0]->count(); 200 | //caffe_gpu_set(bottom[0]->count(), Dtype(0.), bottom_diff); 201 | //const int top_count = top[0]->count(); 202 | int nthreads = top[0]->num() * top[0]->channels(); 203 | 204 | // data gradient 205 | switch (this->layer_param_.resize_param().intepolation_type()) { 206 | case SegResizeParameter_InterpolationType_NEAREST: 207 | // parallel at pixel level 208 | nearestBackwardGPU<<>> 209 | (bottom_count, bottom[0]->channels(), this->input_size_, this->output_size_, 210 | this->resize_factor_, bottom_diff, top_diff); 211 | break; 212 | case SegResizeParameter_InterpolationType_BILINEAR: 213 | // parallel at channel level 214 | bilinearBackwardGPU<<>> 215 | (bottom_count, bottom[0]->channels(), this->input_size_, this->output_size_, 216 | this->resize_factor_, bottom_diff, top_diff); 217 | // normalize 218 | //caffe_gpu_scal(bottom_count, this->resize_factor_>1 ? 1/this->resize_factor_/this->resize_factor_ : 1, bottom_diff); 219 | break; 220 | default: 221 | LOG(FATAL) << "Unknown interpolation type."; 222 | } 223 | 224 | } 225 | 226 | INSTANTIATE_LAYER_GPU_FUNCS(ResizeLayer); 227 | 228 | }// namespace caffe 229 | -------------------------------------------------------------------------------- /forMobileUNet/resize_layer.hpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Integrate imgResize and blobAlign python layers together. 3 | * 4 | * Author: Wei Zhen @ IIE, CAS 5 | * Last modified: 2017-06-11 6 | */ 7 | 8 | #ifndef CAFFE_RESIZE_LAYER_HPP_ 9 | #define CAFFE_RESIZE_LAYER_HPP_ 10 | 11 | #include 12 | 13 | #include "caffe/blob.hpp" 14 | #include "caffe/layer.hpp" 15 | #include "caffe/proto/caffe.pb.h" 16 | 17 | namespace caffe { 18 | 19 | template 20 | class ResizeLayer : public Layer { 21 | public: 22 | explicit ResizeLayer(const LayerParameter& param) 23 | : Layer(param) {} 24 | virtual void LayerSetUp(const vector*>& bottom, 25 | const vector*>& top); 26 | virtual void Reshape(const vector*>& bottom, 27 | const vector*>& top); 28 | 29 | virtual inline const char* type() const { return "Resize"; } 30 | virtual inline int MinBottomBlobs() const { return 1; } 31 | virtual inline int MaxBottomBlobs() const { return 2; } 32 | virtual inline int ExactNumTopBlobs() const { return 1; } 33 | 34 | protected: 35 | virtual void Forward_cpu(const vector*>& bottom, 36 | const vector*>& top); 37 | virtual void Forward_gpu(const vector*>& bottom, 38 | const vector*>& top); 39 | virtual void Backward_cpu(const vector*>& top, 40 | const vector& propagate_down, const vector*>& bottom); 41 | virtual void Backward_gpu(const vector*>& top, 42 | const vector& propagate_down, const vector*>& bottom); 43 | 44 | Dtype resize_factor_; 45 | int input_size_; 46 | int output_size_; 47 | 48 | }; 49 | 50 | 51 | } // namespace caffe 52 | 53 | #endif // CAFFE_RESIZE_LAYER_HPP_ 54 | --------------------------------------------------------------------------------