【问题标题】:Caffe - How to make Python API generate runtime input prototxtCaffe - 如何让 Python API 生成运行时输入 prototxt
【发布时间】:2018-09-17 13:45:10
【问题描述】:

我需要python API来生成这样的prototxt:

input: "data"
input_dim: 7
input_dim: 3
input_dim: 368
input_dim: 368
input: "heatmap"
input_dim: 7
input_dim: 15
input_dim: 46
input_dim: 46
input: "center_map"
input_dim: 7
input_dim: 1
input_dim: 368
input_dim: 368
input: "h_t_1"
input_dim: 7
input_dim: 48
input_dim: 46
input_dim: 46
input: "cell_t_1"
input_dim: 7
input_dim: 48
input_dim: 46
input_dim: 46

如何做到这一点?我试过这样做:

        caffeNet.tops['x'] = L.Data(name="x")
        caffeNet.tops['y'] = L.Data(name="y")
        caffeNet.tops['z'] = L.Data(name="z")

但这只会以这种无效语法格式生成:

layer {
  name: "h_t"
  type: "Data"
  top: "h_t"
}
layer {
  name: "cell_t"
  type: "Data"
  top: "cell_t"
}
layer {
  name: "last_paf"
  type: "Data"
  top: "last_paf"
}

如果我尝试使用这种格式加载我的网络,它会崩溃,它似乎只接受其他格式。我可以编写一个 hacky 脚本来转换它,但肯定有更好的方法

【问题讨论】:

    标签: machine-learning neural-network computer-vision deep-learning caffe


    【解决方案1】:

    你需要使用"Input"层:

    caffeNet.tops['data'] = L.Input(name="data", 
                                    input_param={"shape":{"dim":[7, 3, 368, 368]}})
    caffeNet.tops['heatmap'] = L.Input(name="heatmap", 
                                    input_param={"shape":{"dim":[7, 15, 46, 46]}})
    caffeNet.tops['center_map'] = L.Input(name="center_map", 
                                    input_param={"shape":{"dim":[7, 1, 368, 368]}})
    

    等等。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-02-06
      • 2018-05-21
      • 2019-03-27
      • 2017-09-09
      • 2010-09-18
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多