2015-01-21 90 views
11

我按照kaggle facialkeypoints比賽從輸入圖像中提取30個面部關鍵點(x,y)。Caffe中的多標籤迴歸

我如何設置咖啡來運行迴歸並生成30維輸出??。

Input: 96x96 image 
Output: 30 - (30 dimensions). 

我該如何設置caffe?我使用EUCLIDEAN_LOSS(平方和)來得到迴歸輸出。這是一個簡單的使用caffe的邏輯迴歸模型,但它不起作用。看起來準確性層不能處理多標籤輸出。

I0120 17:51:27.039113 4113 net.cpp:394] accuracy <- label_fkp_1_split_1 
I0120 17:51:27.039135 4113 net.cpp:356] accuracy -> accuracy 
I0120 17:51:27.039158 4113 net.cpp:96] Setting up accuracy 
F0120 17:51:27.039201 4113 accuracy_layer.cpp:26] Check failed: bottom[1]->channels() == 1 (30 vs. 1) 
*** Check failure stack trace: *** 
    @  0x7f7c2711bdaa (unknown) 
    @  0x7f7c2711bce4 (unknown) 
    @  0x7f7c2711b6e6 (unknown) 

這裏是層的文件:

name: "LogReg" 
layers { 
    name: "fkp" 
    top: "data" 
    top: "label" 
    type: HDF5_DATA 
    hdf5_data_param { 
    source: "train.txt" 
    batch_size: 100 
    } 
    include: { phase: TRAIN } 

} 

layers { 
    name: "fkp" 
    type: HDF5_DATA 
    top: "data" 
    top: "label" 
    hdf5_data_param { 
    source: "test.txt" 
    batch_size: 100 
    } 

    include: { phase: TEST } 
} 

layers { 
    name: "ip" 
    type: INNER_PRODUCT 
    bottom: "data" 
    top: "ip" 
    inner_product_param { 
    num_output: 30 
    } 
} 
layers { 
    name: "loss" 
    type: EUCLIDEAN_LOSS 
    bottom: "ip" 
    bottom: "label" 
    top: "loss" 
} 

layers { 
    name: "accuracy" 
    type: ACCURACY 
    bottom: "ip" 
    bottom: "label" 
    top: "accuracy" 
    include: { phase: TEST } 
} 
+0

請將工作模型定義(.prototxt)更新爲原始文章或答案。 – mrgloom 2015-09-03 10:02:54

+1

精度圖層在迴歸設置中不起作用。這隻適用於分類問題 – curio1729 2017-02-14 17:00:17

回答

4

我發現它:)

我取代SOFTLAYER到EUCLIDEAN_LOSS功能和改變的輸出的數量。有效。

layers { 
    name: "loss" 
    type: EUCLIDEAN_LOSS 
    bottom: "ip1" 
    bottom: "label" 
    top: "loss" 
} 

HINGE_LOSS也是另一種選擇。

+0

您的輸出數量發生了什麼變化? – nayef 2015-02-18 13:25:47

+0

我對輸入進行了重新設置(總數爲1,96,96),輸出標籤爲(總數爲30) – pbu 2015-02-18 18:45:56

+0

您能否詳細解釋一下?爲什麼你要避免批量模式,只舉一個例子,你爲什麼要將標籤更改爲30? – thetna 2015-06-24 16:17:59