2016-06-29 2 views
0

저는 Caffe을 처음 접하고 누군가 나를 안내해 주시면 감사하겠습니다. convert_imagenet.cpp를 사용하여 jpg에서 lmdb를 만들 겠지만 성공할 수는 없습니다. 또한,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를 실행 한 후, 출력은 : 다음과 같이 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. 

두 파일 알 수 없는.

큰 도움에 감사드립니다. 모든

+0

가능한 사용 가이드 [convert \ _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는 실제로 작습니다. 교육 및 검증 이미지를 올바르게 제공했는지 신중하게 확인하십시오. 교육용 텍스트 파일과 유효성 검사 용 텍스트 파일이 필요합니다. 각 파일에는 두 개의 열이 있습니다. 각 행에는 첫 번째 열에 이미지 경로가 포함되고 두 번째 열에는 해당 레이블이 있습니다. 레이블은 항상 숫자입니다. 두 열은 공백으로 구분됩니다.

+0

답장을 보내 주셔서 감사합니다. 위에서 언급 한 매개 변수를 다시 실행했지만 다음 오류가 발생했습니다. train.txt 및 test.txt의 일부분을 붙여넣고 또한 create.sh 파일을 붙여 넣습니다. – user3549723

+0

예/home/samar/caffe/examples/caltech101 DATA =/home/samar/caffe/data/caltech101/images TOOLS =/가정/사마르/CAFFE/구축/도구 TRAIN_DATA_ROOT =/가정/사마르/CAFFE/데이터/caltech101/이미지/ VAL_DATA_ROOT =/가정/사마르/CAFFE/데이터/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