faster rcnn svd compress

来源:互联网 发布:dota2比赛数据未找到 编辑:程序博客网 时间:2024/05/10 07:36

1 Edit test_svd.prototxt:

   # ================= fc6 LU start =================

# old

#layer {

#  name: "fc6"

#  type: "InnerProduct"

#  bottom: "pool5"

#  top: "fc6"

#  inner_product_param {

#    num_output: 4096

#  }

#}

#layer {

#  name: "relu6"

#  type: "ReLU"

#  bottom: "fc6"

#  top: "fc6"

#}

# new

layer {

  name: "fc6_L"

  type: "InnerProduct"

  bottom: "pool5"

  top: "fc6_L"

  inner_product_param {

    num_output: 1024

    bias_term: false

  }

}

layer {

  name: "fc6_U"

  type: "InnerProduct"

  bottom: "fc6_L"

  top: "fc6_U"

  inner_product_param {

    num_output: 4096

  }

}

layer {

  name: "relu6"

  type: "ReLU"

  bottom: "fc6_U"

  top: "fc6_U"

}

# ================= fc6 LU stop =================

# ================= fc7 LU start ================

#old

#layer {

#  name: "fc7"

#  type: "InnerProduct"

#  bottom: "fc6"

#  top: "fc7"

#  inner_product_param {

#    num_output: 4096

#  }

#}

#layer {

#  name: "relu7"

#  type: "ReLU"

#  bottom: "fc7"

#  top: "fc7"

#}

#new

layer {

  name: "fc7_L"

  type: "InnerProduct"

  bottom: "fc6_U"

  top: "fc7_L"

  inner_product_param {

    num_output: 256

    bias_term: false

  }

}

layer {

  name: "fc7_U"

  type: "InnerProduct"

  bottom: "fc7_L"

  top: "fc7_U"

  inner_product_param {

    num_output: 4096

  }

}

layer {

  name: "relu7"

  type: "ReLU"

  bottom: "fc7_U"

  top: "fc7_U"

}

# ================= fc7 LU stop ================

layer {

  name: "cls_score"

  type: "InnerProduct"

  bottom: "fc7_U"

  top: "cls_score"

  inner_product_param {

    num_output: 21

  }

}

layer {

  name: "bbox_pred"

  type: "InnerProduct"

  bottom: "fc7_U"

  top: "bbox_pred"

  inner_product_param {

    num_output: 84

  }

}

layer {

  name: "cls_prob"

  type: "Softmax"

  bottom: "cls_score"

  top: "cls_prob"

}


2 Run compress.py

   ./compress_net.py --def /path/to/your/online.prototxt --def-svd /path/to/your/online_svd.prototxt --net /path/to/your/VGG16_faster_rcnn_final.caffemodel


3 Size VS

   orig_caffemodel: 523M

   compress_caffemodel: 189M

4 runTime VS

   orig_caffemodel:  avg 245ms/img

   compress_caffemodel: avg 220ms/img


GPU: Tesla K80

0 0
原创粉丝点击