2016-09-22 39 views
1

我已經閱讀了大量的咖啡輸入準備圖像數據的參考資料,但尚未能解決我的問題!如何爲咖啡輸入準備灰度圖像數據

我已經把.jpg圖像文件在2個獨立的文件夾:

folder train: containing 100,000 image files of size 227*227 
folder val: containing 9,000 image files of size 227*227 

我把它們放在一個文件夾中/home/user/DL

然後我trainval了兩個文本文件列出圖像的名稱文件夾爲:

. 
. 
p127.jpg 2 
p943.jpg 2 
p8765.jpg 1 
. 
. 

,我把這兩個文件/home/user/caffe-master/data/DL

我做了位於DL_create.sh/home/user/caffe-master/examples/DL波紋管:

set -e 

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

TRAIN_DATA_ROOT=/home/user/DL/train/ 
VAL_DATA_ROOT=/home/user/DL/val/ 


RESIZE=true 
if $RESIZE; then 
    RESIZE_HEIGHT=227 
    RESIZE_WIDTH=227 
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_DL.sh to the path" \ 
     "where the DL 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_DL.sh to the path" \ 
     "where the DL validation data is stored." 
    exit 1 
fi 

echo "Creating train lmdb..." 

GLOG_logtostderr=1 $TOOLS/convert_imageset \ 
    --resize_height=$RESIZE_HEIGHT \ 
    --resize_width=$RESIZE_WIDTH \ 
    --shuffle \ 
    --gray \ 
    $TRAIN_DATA_ROOT \ 
    $DATA/train.txt \ 
    $EXAMPLE/DL_train_lmdb 

echo "Creating val lmdb..." 

GLOG_logtostderr=1 $TOOLS/convert_imageset \ 
    --resize_height=$RESIZE_HEIGHT \ 
    --resize_width=$RESIZE_WIDTH \ 
    --shuffle \ 
    --gray \ 
    $VAL_DATA_ROOT \ 
    $DATA/val.txt \ 
    $EXAMPLE/DL_val_lmdb 

echo "Done." 

然後當我運行DL_create.sh腳本來改變我的圖像數據轉換成lmdb它無法找到我的圖像,並給出了類似的消息:

. 
. 
. 
E0922 14:35:24.152361 31301 io.cpp:80] Could not open or find file /home/user/caffe-master/data/DL/train/p84167.jpg 
E0922 14:35:24.160773 31301 io.cpp:80] Could not open or find file /home/user/caffe-master/data/DL/train/p24118.jpg 
. 
. 
. 

可否請你幫我知道我在做什麼錯誤??!?!

回答

1

問題是我有的圖像是uint16位圖!但是,經過大量搜索後,我發現caffe在uint8位圖上工作

+0

如果這是您的解決方案,則應考慮接受您的答案。另外:您可以在輸入圖層中爲圖像本身定義比例 – Kev1n91