2016-06-29 5 views
0

私はCaffeを新しくしてくれて、誰かが私を案内してくれてありがとう。 convert_imagenet.cppを使用してjpgからlmdbを作成しますが、成功することはできません。次のようにcreate.shの内容は次のとおりです。ガイドcaffe convert_imageset.cppを使用してlmdbを作成

#!/usr/bin/env sh 
# Create the caltech101 lmdb inputs 
# N.B. set the path to the caltech101 train + val data dirs 

EXAMPLE=examples/caltech101 
DATA=data/caltech101 
TOOLS=build/tools 

TRAIN_DATA_ROOT=examples/caltech101/caltech101_train/ 
VAL_DATA_ROOT=examples/caltech101/caltech101_train/ 

# Set RESIZE=true to resize the images to 256x256. Leave as false if images have 
# already been resized using another tool. 
RESIZE=true 
if $RESIZE; then 
    RESIZE_HEIGHT=256 
    RESIZE_WIDTH=256 
else 
    RESIZE_HEIGHT=0 
    RESIZE_WIDTH=0 
fi 

if [ ! -d "$TRAIN_DATA_ROOT" ]; then 
    echo "Error: TRAIN_DATA_ROOT is not a path to a directory: $TRAIN_DATA_ROOT" 
    echo "Set the TRAIN_DATA_ROOT variable in create_caltech101.sh to the path" \ 
     "where the caltech101 training data is stored." 
    exit 1 
fi 

if [ ! -d "$VAL_DATA_ROOT" ]; then 
    echo "Error: VAL_DATA_ROOT is not a path to a directory: $VAL_DATA_ROOT" 
    echo "Set the VAL_DATA_ROOT variable in create_caltech101.sh to the path" \ 
     "where the caltech101 validation data is stored." 
    exit 1 
fi 

echo "Creating train lmdb..." 

GLOG_logtostderr=1 $CAFFE_ROOT/build/tools/convert_imageset \ 
    --resize_height=256 \ 
    --resize_width=256 \ 
    --shuffle \ 
    $CAFFE_ROOT/examples/caltech101/caltech101_train/ \ 
    $CAFFE_ROOT/data/caltech101/caltech101_train.txt \ 
    $CAFFE_ROOT/examples/caltech101/caltech101_train_lmdb 

echo "Creating val lmdb..." 

GLOG_logtostderr=1 $TOOLS/convert_imageset \ 
    --resize_height=256 \ 
    --resize_width=256 \ 
    --shuffle \ 
    $CAFFE_ROOT/examples/caltech101/caltech101_train/ \ 
    $CAFFE_ROOT/data/caltech101/caltech101_test.txt \ 
    $CAFFE_ROOT/examples/caltech101/caltech101_test_lmdb 

echo "Done." 

また、create.shを実行した後、出力は次のようになります。caltech101_train_lmdbとcaltech101_test_lmdb含む

[email protected]:~/caffe# ./examples/caltech101/create_caltech101.sh 
Creating train lmdb... 
I0701 20:17:34.589217 3256 convert_imageset.cpp:86] Shuffling data 
I0701 20:17:34.589913 3256 convert_imageset.cpp:89] A total of 84 images. 
I0701 20:17:34.590143 3256 db_lmdb.cpp:35] Opened lmdb /home/samar/caffe/examples/caltech101/caltech101_train_lmdb 
E0701 20:17:34.645048 3256 io.cpp:80] Could not open or find file /home/samar/caffe/examples/caltech101/caltech101_train/ 
I0701 20:17:34.768301 3256 convert_imageset.cpp:153] Processed 83 files. 
Creating val lmdb... 
I0701 20:17:34.787917 3258 convert_imageset.cpp:86] Shuffling data 
I0701 20:17:34.788311 3258 convert_imageset.cpp:89] A total of 40 images. 
I0701 20:17:34.788477 3258 db_lmdb.cpp:35] Opened lmdb /home/samar/caffe/examples/caltech101/caltech101_test_lmdb 
I0701 20:17:34.872882 3258 convert_imageset.cpp:153] Processed 40 files. 
Done. 

2つのファイルが作成されますが、サイズがされています未知の。

大変ありがとうございます。

+0

[使用する変換ガイド\ _imageset.cpp](http://stackoverflow.com/questions/31427094/guide-to-use-convert-imageset-cpp) – Shai

答えて

1

まず第一に、すべての変数の絶対パスを使用します。

EXAMPLE 
DATA 
TOOLS 

TRAIN_DATA_ROOT 
VAL_DATA_ROOT 

次に、あなただけの84の画像を持っているようです。その場合、あなたのDBは本当に小さくなります。トレーニングイメージと検証イメージを適切に提供しているかどうかを注意深く確認してください。トレーニング用と検証用の2つのテキストファイルが必要です。各ファイルには2つの列があります。各行には、最初の列にイメージへのパスが含まれ、2番目の列には対応するラベルがあります。ラベルは常に数字です。 2つの列はスペースで区切られています。

+0

回答ありがとうございました。あなたが言及し、それを再実行したが、以下のエラーが出た。 train.txtとtest.txtの一部と、create.shファイルを貼り付けます。 – user3549723

+0

例/ home/samar/caffe/examples/caltech101 DATA/home/samar/caffe/data/caltech101/images TOOLS = /ホーム/サマール/カフェ/構築/ツール TRAIN_DATA_ROOT = /ホーム/サマール/カフェ/データ/ caltech101 /画像/ VAL_DATA_ROOT = /ホーム/サマール/カフェ/データ/ caltech101 /画像/ – user3549723

+0

GLOG_logtostderr = 1 $ CAFFE_ROOT//ツールを構築/ convert_imageset \ --resize_height = 256 \ --resize_width = 256 \ --shuffle $ CAFFE_ROOT \ /データ/ caltech101 /画像/ \ $ CAFFE_ROOT /データ/ caltech101/caltech101_train.txt \ $ CAFFE_ROOT/data/caltech101/caltech101_train_lmdb#caltech101_ train_lmdbは存在しません。私はそれが エコーこのステップで作成されますと思います "作成ヴァルlmdb ..." – user3549723

関連する問題