haychris / deepdriving-collision-avoidance

4 stars 1 forks source link

Segment fault when train new model #2

Closed liber145 closed 8 years ago

liber145 commented 8 years ago

I met segment fault problem when I train deep driving model on collected data. Could you help me?

I have followed Readme to make TORCS and Caffe. Since the training data set you provided is too large for me, I would like to collect a small number of images and train a model on it. The following is what I do:

Collect data:

  1. Run TORCS, Configure Race with chenyi- prefix road.
  2. Select player to add human-control car and select chenyi- prefix AI traffic cars.
  3. Run torcs_data_collector.sh and select window & type p .
  4. Play the game. Type Esc to quit above window. Type Esc to quit the game. This generates TORCS_Training_1F folder.

Train TORCS:

  1. change data_layer.cpp to data_layer.run and change data_layer.train to data_layer.cpp .
  2. Replace TORCS_Training_1F folder in pre_trained with current TORCS_Training_1F .
  3. Run ./torcs_train.sh .

Then I met segment fault:

I0607 22:34:14.982471 24099 caffe.cpp:101] Use CPU.
I0607 22:34:14.982740 24099 caffe.cpp:105] Starting Optimization
I0607 22:34:14.982836 24099 solver.cpp:32] Initializing solver from parameters: 
base_lr: 0.01
display: 1000
max_iter: 300000
lr_policy: "step"
gamma: 0.9
momentum: 0.9
weight_decay: 0.0005
stepsize: 8000
snapshot: 10000
snapshot_prefix: "pre_trained/driving_train_1F"
solver_mode: CPU
net: "pre_trained/driving_train_1F.prototxt"
I0607 22:34:14.982923 24099 solver.cpp:72] Creating training net from net file: pre_trained/driving_train_1F.prototxt
I0607 22:34:14.983669 24099 net.cpp:56] Initializing net from parameters: 
name: "TORCS_Net"
layers {
  top: "data"
  top: "label"
  name: "data"
  type: DATA
  data_param {
    source: "pre_trained/TORCS_Training_1F"
    batch_size: 64
    backend: LEVELDB
  }
  transform_param {
    mirror: false
    crop_size: 0
    mean_file: "pre_trained/driving_mean_1F.binaryproto"
  }
}
layers {
  bottom: "data"
  top: "conv1"
  name: "conv1"
  type: CONVOLUTION
  blobs_lr: 1
  blobs_lr: 2
  weight_decay: 1
  weight_decay: 0
  convolution_param {
    num_output: 96
    kernel_size: 11
    stride: 4
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layers {
  bottom: "conv1"
  top: "conv1"
  name: "relu1"
  type: RELU
}
layers {
  bottom: "conv1"
  top: "pool1"
  name: "pool1"
  type: POOLING
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}
layers {
  bottom: "pool1"
  top: "norm1"
  name: "norm1"
  type: LRN
  lrn_param {
    local_size: 5
    alpha: 0.0001
    beta: 0.75
  }
}
layers {
  bottom: "norm1"
  top: "conv2"
  name: "conv2"
  type: CONVOLUTION
  blobs_lr: 1
  blobs_lr: 2
  weight_decay: 1
  weight_decay: 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
    }
  }
}
layers {
  bottom: "conv2"
  top: "conv2"
  name: "relu2"
  type: RELU
}
layers {
  bottom: "conv2"
  top: "pool2"
  name: "pool2"
  type: POOLING
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}
layers {
  bottom: "pool2"
  top: "norm2"
  name: "norm2"
  type: LRN
  lrn_param {
    local_size: 5
    alpha: 0.0001
    beta: 0.75
  }
}
layers {
  bottom: "norm2"
  top: "conv3"
  name: "conv3"
  type: CONVOLUTION
  blobs_lr: 1
  blobs_lr: 2
  weight_decay: 1
  weight_decay: 0
  convolution_param {
    num_output: 384
    pad: 1
    kernel_size: 3
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layers {
  bottom: "conv3"
  top: "conv3"
  name: "relu3"
  type: RELU
}
layers {
  bottom: "conv3"
  top: "conv4"
  name: "conv4"
  type: CONVOLUTION
  blobs_lr: 1
  blobs_lr: 2
  weight_decay: 1
  weight_decay: 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
    }
  }
}
layers {
  bottom: "conv4"
  top: "conv4"
  name: "relu4"
  type: RELU
}
layers {
  bottom: "conv4"
  top: "conv5"
  name: "conv5"
  type: CONVOLUTION
  blobs_lr: 1
  blobs_lr: 2
  weight_decay: 1
  weight_decay: 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
    }
  }
}
layers {
  bottom: "conv5"
  top: "conv5"
  name: "relu5"
  type: RELU
}
layers {
  bottom: "conv5"
  top: "pool5"
  name: "pool5"
  type: POOLING
  pooling_param {
    pool: MAX
    kernel_size: 3
    stride: 2
  }
}
layers {
  bottom: "pool5"
  top: "fc6"
  name: "fc6"
  type: INNER_PRODUCT
  blobs_lr: 1
  blobs_lr: 2
  weight_decay: 1
  weight_decay: 0
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 1
    }
  }
}
layers {
  bottom: "fc6"
  top: "fc6"
  name: "relu6"
  type: RELU
}
layers {
  bottom: "fc6"
  top: "fc6"
  name: "drop6"
  type: DROPOUT
  dropout_param {
    dropout_ratio: 0.5
  }
}
layers {
  bottom: "fc6"
  top: "fc7"
  name: "fc7"
  type: INNER_PRODUCT
  blobs_lr: 1
  blobs_lr: 2
  weight_decay: 1
  weight_decay: 0
  inner_product_param {
    num_output: 4096
    weight_filler {
      type: "gaussian"
      std: 0.005
    }
    bias_filler {
      type: "constant"
      value: 1
    }
  }
}
layers {
  bottom: "fc7"
  top: "fc7"
  name: "relu7"
  type: RELU
}
layers {
  bottom: "fc7"
  top: "fc7"
  name: "drop7"
  type: DROPOUT
  dropout_param {
    dropout_ratio: 0.5
  }
}
layers {
  bottom: "fc7"
  top: "fc8"
  name: "fc8"
  type: INNER_PRODUCT
  blobs_lr: 1
  blobs_lr: 2
  weight_decay: 1
  weight_decay: 0
  inner_product_param {
    num_output: 256
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layers {
  bottom: "fc8"
  top: "fc8"
  name: "relu8"
  type: RELU
}
layers {
  bottom: "fc8"
  top: "fc8"
  name: "drop8"
  type: DROPOUT
  dropout_param {
    dropout_ratio: 0.5
  }
}
layers {
  bottom: "fc8"
  top: "fc9"
  name: "fc9"
  type: INNER_PRODUCT
  blobs_lr: 1
  blobs_lr: 2
  weight_decay: 1
  weight_decay: 0
  inner_product_param {
    num_output: 14
    weight_filler {
      type: "gaussian"
      std: 0.01
    }
    bias_filler {
      type: "constant"
      value: 0
    }
  }
}
layers {
  bottom: "fc9"
  top: "fc9"
  name: "relu9"
  type: SIGMOID
}
layers {
  bottom: "fc9"
  bottom: "label"
  top: "loss"
  name: "loss"
  type: EUCLIDEAN_LOSS
}
state {
  phase: TRAIN
}
I0607 22:34:14.984504 24099 net.cpp:84] Creating Layer data
I0607 22:34:14.984520 24099 net.cpp:373] data -> data
I0607 22:34:14.984539 24099 net.cpp:373] data -> label
I0607 22:34:14.984568 24099 net.cpp:113] Setting up data
I0607 22:34:14.984589 24099 data_layer.cpp:117] Opening leveldb pre_trained/TORCS_Training_1F
I0607 22:34:15.077641 24099 data_layer.cpp:150] output data size: 64,3,210,280
I0607 22:34:15.077749 24099 base_data_layer.cpp:36] Loading mean file frompre_trained/driving_mean_1F.binaryproto
I0607 22:34:15.090307 24099 net.cpp:120] Top shape: 64 3 210 280 (11289600)
I0607 22:34:15.090384 24099 net.cpp:120] Top shape: 64 1 1 14 (896)
I0607 22:34:15.090423 24099 net.cpp:84] Creating Layer conv1
I0607 22:34:15.090445 24099 net.cpp:411] conv1 <- data
I0607 22:34:15.090478 24099 net.cpp:373] conv1 -> conv1
I0607 22:34:15.090507 24099 net.cpp:113] Setting up conv1
Segmentation fault (core dumped)
liber145 commented 8 years ago

This issue comes from the inconsistent data number in data_layer.cpp. It is stated in the more detailed Readme file of DeepDrivingCode_v2.zip at http://deepdriving.cs.princeton.edu/

Notice: when using your own dataset to train a new model, the data_layer.train needs modification, at least line 77: "key=random(484815)+1; // MUST be changed according to the size of the training set"

minhaoxu1995 commented 6 years ago

Do you know how to edit the value of "key=random(484815)+1; // MUST be changed according to the size of the training set",I repalce the “TORCS_Training_1F” in floder "pre_trained" with the torcs_trainset.zip, (63GB),then I0607 22:34:14.984568 24099 net.cpp:113] Setting up data Segmentation fault (core dumped)