caffeは自分のデータを訓練する

2031 ワード

  • 画像をimdb形式に変換するにはcaffe/build/tools/奥のconvert_imageset、パラメータは以下の通りです:
  • convert_imageset [FLAGS] ROOTFOLDER/LISTFILE DB_NAME
    FLAG: -backend :lmdb/leveldb for storing the result, default: “lmdb” -gray (When this option is on, treat images as grayscale ones) type: bool default: false -resize_height (Height images are resized to) type: int32 default: 0 -resize_width (Width images are resized to) type: int32 default: 0 -shuffle (Randomly shuffle the order of images and their labels) type: bool default: false
    例を参照してshellファイルcreateを書きました.sh
    #!/usr/bin/env sh
    # This script converts the image data into leveldb/lmdb format.
    
    TOOLS=/home/chuny/Downloads/caffe/build/tools
    RESIZE_HEIGHT=256
    RESIZE_WIDTH=256
    DATADIR=/home/chuny/temp/datadir
    DATA=/home/chuny/temp/data
    
    echo "Creating train leveldb..."
    GLOG_logtostderr=1 
    $TOOLS/convert_imageset \
        --resize_height=$RESIZE_HEIGHT \
        --resize_width=$RESIZE_WIDTH \
        --shuffle \
        $DATADIR/ \
        $DATA/train.txt \
        $DATA/train_imdb 
    
    echo "Creating val leveldb..."
    GLOG_logtostderr=1 
    $TOOLS/convert_imageset \
        --resize_height=$RESIZE_HEIGHT \
        --resize_width=$RESIZE_WIDTH \
        --shuffle \
        $DATADIR/ \
        $DATA/val.txt \
        $DATA/val_imdb