问题描述:

I have read lots of references to prepare image data for caffe input but have not been able to solve my problem yet!!

I have put .jpg image files in 2 seperate folders:

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

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

I put them in a folder in /home/user/DL

Then I made two text files listing the names of the images in train and val folders as:

.

.

p127.jpg 2

p943.jpg 2

p8765.jpg 1

.

.

and I put these two files in /home/user/caffe-master/data/DL.

I made DL_create.sh located in /home/user/caffe-master/examples/DL as bellow:

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."

Then when I run DL_create.sh script to change my image data into lmdb it can not find my images and gives messages like:

.

.

.

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

.

.

.

could you please help me know where I am doing mistake??!?!

网友答案:

The problem was that the images I had were uint16 bitmap!! However, after lots of search I found that caffe works on uint8 bitmap

相关阅读:
Top