When using Caffe, we want to use our own data for training, and here's how to make your own data. All data production is based on imagenet.
1. Data preparation, we need a train and valid folder, a train.txt and Val.txt (the location of the picture folder can be arbitrary, but the location of the two TXT files in the data/mydata/directory)
The train and valid folders naturally store the images to be trained, and the data formats for Train.txt and Val.txt are as follows
train_example/1. jpg0Train_example/2. jpg0Train_example/3. jpg0Train_example/4. jpg0Train_example/5. jpg0Train_example/6. jpg0Train_example/7. jpg0Train_example/8. jpg0Train_example/9. jpg0
The front is the picture path, then the label, note that the label is starting from 0.
2. In the example directory, create your own folder MyTask, bake all the files in the imagenet and modify them.
create_imagenet.sh
// Current Path example=/home/kongtao/caffe-master/examples/voc2007_test1// store train.txt and Val.txt path, is the data /mydatadata=/home/kongtao/caffe-master/data/voc2007_data1// unchanging tools=/home/ kongtao/caffe-master/build/Tools// home directory for train and Val picture folders (This is the picture directory in the TXT file) train_data_root=/home/kongtao/learn/cnn_learn/voc2007_research/vocdevkit/val_data_root=/home/ kongtao/learn/cnn_learn/voc2007_research/vocdevkit/
Run create_imagenet.sh to generate two data files Lmdb
Make_image_mean.sh also modifies the corresponding path
Finally need to modify the model in the Prototxt file, only need to modify the path
Run
./build/tools/caffe Train--solver=models/bvlc_reference_caffenet/solver.prototxt
That's all you can do.
The above completed a data file creation and training process, for us, in fact, the network architecture is more important, so it is not only the tuning, but also the adjustment of network architecture and improvement, this is the most difficult part.
[Caffe] data production and training