caffe训练输入数据格式介绍(LMDB/imagelist)
生活随笔
收集整理的這篇文章主要介紹了
caffe训练输入数据格式介绍(LMDB/imagelist)
小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
目錄
引言
LMDB數(shù)據(jù)格式
imagelist數(shù)據(jù)
LMDB數(shù)據(jù)生成
引言
這里介紹caffe訓(xùn)練數(shù)據(jù)的兩種輸入格式,分別是LMDB,以及普通的imagelist圖片輸入。主要貼出兩種輸入數(shù)據(jù)格式的prototxt作為參考,具體如何工作的可以看caffe源碼,參數(shù)的介紹參考caffe proto文件:
LMDB數(shù)據(jù)格式
layer {name: "data"type: "Data"top: "data"top: "label"include{phase:TRAIN}transform_param {mirror: truecrop_size: 128}data_param {source: "/PATH/lmdb"batch_size: 64backend: LMDB} }imagelist數(shù)據(jù)
layer { name: "data" type: "ImageData" top: "data" top: "label" include { phase: TRAIN } transform_param {mirror: truecrop_size: 128 mean_value: 0 force_gray: true} image_data_param { source: "/PATH/path_train.txt" batch_size: 64 is_color: falseshuffle: true} }LMDB數(shù)據(jù)生成
#!/usr/bin/env sh # Create the imagenet lmdb inputs # N.B. set the path to the imagenet train + val data dirs set -eEXAMPLE=examples/imagenet DATA=data/ilsvrc12 TOOLS=build/toolsTRAIN_DATA_ROOT=/public/xuhaitao/imageNet/ILSVRC2012_img_train/ VAL_DATA_ROOT=/public/xuhaitao/imageNet/ILSVRC2012_img_val/# Set RESIZE=true to resize the images to 256x256. Leave as false if images have # already been resized using another tool. RESIZE=false if $RESIZE; thenRESIZE_HEIGHT=256RESIZE_WIDTH=256 elseRESIZE_HEIGHT=0RESIZE_WIDTH=0 fiif [ ! -d "$TRAIN_DATA_ROOT" ]; thenecho "Error: TRAIN_DATA_ROOT is not a path to a directory: $TRAIN_DATA_ROOT"echo "Set the TRAIN_DATA_ROOT variable in create_imagenet.sh to the path" \"where the ImageNet training data is stored."exit 1 fiif [ ! -d "$VAL_DATA_ROOT" ]; thenecho "Error: VAL_DATA_ROOT is not a path to a directory: $VAL_DATA_ROOT"echo "Set the VAL_DATA_ROOT variable in create_imagenet.sh to the path" \"where the ImageNet validation data is stored."exit 1 fiecho "Creating train lmdb..."GLOG_logtostderr=1 $TOOLS/convert_imageset \--resize_height=$RESIZE_HEIGHT \--resize_width=$RESIZE_WIDTH \--shuffle \$TRAIN_DATA_ROOT \$DATA/train.txt \$EXAMPLE/ilsvrc12_train_lmdbecho "Creating val lmdb..."GLOG_logtostderr=1 $TOOLS/convert_imageset \--resize_height=$RESIZE_HEIGHT \--resize_width=$RESIZE_WIDTH \--shuffle \$VAL_DATA_ROOT \$DATA/val.txt \$EXAMPLE/ilsvrc12_val_lmdbecho "Done."?
總結(jié)
以上是生活随笔為你收集整理的caffe训练输入数据格式介绍(LMDB/imagelist)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 高效神经网络的设计
- 下一篇: caffe源码解析—image_data