2

저는 카페와 깊은 학습에서 새로운 점을 알게되었습니다. 나는 단지 깊은 학습 아키텍처를 구현하려고하고있다. Architecture주어진 데이터 세트로 깊은 학습 아키텍처 구현

이것은 구현하려는 아키텍처입니다. 아키텍처 및 Parse27k 데이터 세트는 RWTH Aachen University의 Visual Computing Institute에서 컴퓨터 비전 그룹 에 의해 만들어지고 구성되었습니다..

당신은 내가 개선해야 할 내 모델을 참조하실 수 있습니다 :

Train_val.prototxt

name: "Parse27" 
layer { 
    name: "data" 
    type: "HDF5Data" 
    top: "crops" 
    top: "labels" 
    include { 
    phase: TRAIN 
    } 

    hdf5_data_param { 
    source: "/home/nail/caffe/caffe/examples/hdf5_classification/data/train.txt" 
    batch_size: 256 
    } 
} 
layer { 
    name: "data" 
    type: "HDF5Data" 
    top: "crops" 
    top: "labels" 
    include { 
    phase: TEST 
    } 
    hdf5_data_param { 
    source: "/home/nail/caffe/caffe/examples/hdf5_classification/data/test.txt" 
    batch_size: 256 
    } 
} 
layer { 
    name: "conv1" 
    type: "Convolution" 
    bottom: "crops" 
    top: "conv1" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    convolution_param { 
    num_output: 96 
    kernel_size: 11 
    stride: 4 
    weight_filler { 
     type: "gaussian" 
     std: 0.01 
    } 
    bias_filler { 
     type: "constant" 
     value: 0 
    } 
    } 
} 
layer { 
    name: "relu1" 
    type: "ReLU" 
    bottom: "conv1" 
    top: "conv1" 
} 
layer { 
    name: "pool1" 
    type: "Pooling" 
    bottom: "conv1" 
    top: "pool1" 
    pooling_param { 
    pool: MAX 
    kernel_size: 3 
    stride: 2 
    } 
} 
layer { 
    name: "norm1" 
    type: "LRN" 
    bottom: "pool1" 
    top: "norm1" 
    lrn_param { 
    local_size: 5 
    alpha: 0.0001 
    beta: 0.75 
    } 
} 
layer { 
    name: "conv2" 
    type: "Convolution" 
    bottom: "norm1" 
    top: "conv2" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    convolution_param { 
    num_output: 256 
    pad: 2 
    kernel_size: 5 
    group: 2 
    weight_filler { 
     type: "gaussian" 
     std: 0.01 
    } 
    bias_filler { 
     type: "constant" 
     value: 1 
    } 
    } 
} 
layer { 
    name: "relu2" 
    type: "ReLU" 
    bottom: "conv2" 
    top: "conv2" 
} 
layer { 
    name: "pool2" 
    type: "Pooling" 
    bottom: "conv2" 
    top: "pool2" 
    pooling_param { 
    pool: MAX 
    kernel_size: 3 
    stride: 2 
    } 
} 
layer { 
    name: "norm2" 
    type: "LRN" 
    bottom: "pool2" 
    top: "norm2" 
    lrn_param { 
    local_size: 5 
    alpha: 0.0001 
    beta: 0.75 
    } 
} 
layer { 
    name: "conv3" 
    type: "Convolution" 
    bottom: "norm2" 
    top: "conv3" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    convolution_param { 
    num_output: 384 
    pad: 1 
    kernel_size: 3 
    weight_filler { 
     type: "gaussian" 
     std: 0.01 
    } 
    bias_filler { 
     type: "constant" 
     value: 0 
    } 
    } 
} 
layer { 
    name: "relu3" 
    type: "ReLU" 
    bottom: "conv3" 
    top: "conv3" 
} 
layer { 
    name: "conv4" 
    type: "Convolution" 
    bottom: "conv3" 
    top: "conv4" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    convolution_param { 
    num_output: 384 
    pad: 1 
    kernel_size: 3 
    group: 2 
    weight_filler { 
     type: "gaussian" 
     std: 0.01 
    } 
    bias_filler { 
     type: "constant" 
     value: 1 
    } 
    } 
} 
layer { 
    name: "relu4" 
    type: "ReLU" 
    bottom: "conv4" 
    top: "conv4" 
} 
layer { 
    name: "conv5" 
    type: "Convolution" 
    bottom: "conv4" 
    top: "conv5" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    convolution_param { 
    num_output: 256 
    pad: 1 
    kernel_size: 3 
    group: 2 
    weight_filler { 
     type: "gaussian" 
     std: 0.01 
    } 
    bias_filler { 
     type: "constant" 
     value: 1 
    } 
    } 
} 
layer { 
    name: "relu5" 
    type: "ReLU" 
    bottom: "conv5" 
    top: "conv5" 
} 
layer { 
    name: "pool5" 
    type: "Pooling" 
    bottom: "conv5" 
    top: "pool5" 
    pooling_param { 
    pool: MAX 
    kernel_size: 3 
    stride: 2 
    } 
} 
layer { 
    name: "fc6" 
    type: "InnerProduct" 
    bottom: "pool5" 
    top: "fc6" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    inner_product_param { 
    num_output: 4096 
    weight_filler { 
     type: "gaussian" 
     std: 0.005 
    } 
    bias_filler { 
     type: "constant" 
     value: 1 
    } 
    } 
} 
layer { 
    name: "relu6" 
    type: "ReLU" 
    bottom: "fc6" 
    top: "fc6" 
} 
layer { 
    name: "drop6" 
    type: "Dropout" 
    bottom: "fc6" 
    top: "fc6" 
    dropout_param { 
    dropout_ratio: 0.5 
    } 
} 
layer { 
    name: "fc7" 
    type: "InnerProduct" 
    bottom: "fc6" 
    top: "fc7" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    inner_product_param { 
    num_output: 4096 
    weight_filler { 
     type: "gaussian" 
     std: 0.005 
    } 
    bias_filler { 
     type: "constant" 
     value: 1 
    } 
    } 
} 
layer { 
    name: "relu7" 
    type: "ReLU" 
    bottom: "fc7" 
    top: "fc7" 
} 
layer { 
    name: "drop7" 
    type: "Dropout" 
    bottom: "fc7" 
    top: "fc7" 
    dropout_param { 
    dropout_ratio: 0.5 
    } 
} 
layer { 
    name: "fc8" 
    type: "InnerProduct" 
    bottom: "fc7" 
    top: "fc8" 
    param { 
    lr_mult: 1 
    decay_mult: 1 
    } 
    param { 
    lr_mult: 2 
    decay_mult: 0 
    } 
    inner_product_param { 
    num_output: 1000 
    weight_filler { 
     type: "gaussian" 
     std: 0.01 
    } 
    bias_filler { 
     type: "constant" 
     value: 0 
    } 
    } 
} 
layer { 
    name: "accuracy" 
    type: "Accuracy" 
    bottom: "fc8" 
    bottom: "labels" 
    top: "accuracy" 
    include { 
    phase: TEST 
    } 
} 
layer { 
    name: "loss" 
    type: "SoftmaxWithLoss" 
    bottom: "fc8" 
    bottom: "labels" 
    top: "loss" 
} 

Solver.prototxt을

net: "models/Parse27/train_val.prototxt" 
test_iter: 1000 
test_interval: 1000 
base_lr: 0.01 
lr_policy: "step" 
gamma: 0.1 
stepsize: 100000 
display: 20 
max_iter: 450000 
momentum: 0.9 
weight_decay: 0.0005 
snapshot: 10000 
snapshot_prefix: "models/Parse27/Parse27_train" 
solver_mode: GPU 

나는 2 개 주 어려움에이 이 아키텍처를 구현합니다.

  1. 위에서 본 것처럼 내 모델에는 맞춤 손실 레이어가 포함되어 있지 않습니다. 내 모델은 거의 caffeNet 아키텍처입니다. 하지만 나는 빨간색 상자 안에있는 마지막 레이어를 사용자 지정 손실 레이어 (녹색 상자)로 바꿔야합니다.

  2. 내 기차 데이터 세트의 구조는 다음과 같습니다.

    작물 및 라벨 여기에 행 (예)의 수를 알 수있는 바와 같이
    crops  Dataset {27482, 3, 128, 192} 
    labels  Dataset {27482, 12} 
    mean  Dataset {3, 128, 192} 
    pids  Dataset {27482} 
    

는 27482. 그러나 난 내 레이블 데이터 세트에서 12 열이 동일합니다. 그리고 내 모델은 단 하나의 레이블이있을 때 작동합니다. 어떻게 모든 레이블을 훈련시킬 수 있을까요?

Train_val.prototxt 나의 모델은 지금과 같이 찾고 :

enter image description here

도움이나 제안의 모든 종류가 높게 평가 될 것입니다.

답변

2

정확하게 이해한다면 각 입력 예제에 대해 12 개의 개별 레이블 (특성)을 예측하려고합니다. 이 경우에는 레이블을 "Slice"해야

layer { 
    type: "Slice" 
    name: "slice_labels" 
    bottom: "label" 
    top: "attr_00" 
    top: "attr_01" 
    top: "attr_02" 
    top: "attr_03" 
    top: "attr_04" 
    top: "attr_05" 
    top: "attr_06" 
    top: "attr_07" 
    top: "attr_08" 
    top: "attr_09" 
    top: "attr_10" 
    top: "attr_11" 
    slice_param { 
    axis: -1 # slice the last dimension 
    slice_point: 1 
    slice_point: 2 
    slice_point: 3 
    slice_point: 4 
    slice_point: 5 
    slice_point: 6 
    slice_point: 7 
    slice_point: 8 
    slice_point: 9 
    slice_point: 10 
    slice_point: 11 
    } 
} 

지금, 당신은 각 속성에 대해 "스칼라"레이블이. 네가 여기서 가져갈 수 있다고 생각해.

+0

내가 실행 중일 때 이러한 오류 메시지가 나타납니다. F1101 14 : 11 : 12.764832 7023 layer.hpp : 374] 검사 실패 : ExactNumBottomBlobs() (= 2) 2 개의 bottom blob을 입력으로 사용합니다. 나는 심지어 속성 중 하나를 손실로 보내려고했지만 fc8은 여전히 ​​같은 실수를했습니다. 이미지 링크 https://postimg.org/image/3yh66h8fp/ 모델 prototxt 문서 http://codepad.org/GfsLcWqn – MIRMIX

+0

@MIRMIX 당신이 게시 된 모델을 보면 : HTTPS : //i.stack.imgur .com/B7Cmq.png. 당신이 볼 수 있듯이, 속성 당 ** 다른 ** 손실 (및 정확성) 레이어가 있습니다.모든 속성에 대해 단일 레이어를 가질 수는 없습니다. 구현하려는 계획에 따라 작업하십시오. – Shai

+0

나는 그것이 나에게 하나의 속성을 위해 그것을하려고 할 때조차 나는 오류 메시지를 다시 얻는다. https://postimg.org/image/xrqzhgzz7/ 적어도 하나의 라벨에 대해 작동하지 않아야합니까? – MIRMIX