Caffe Convert_imageset PROJRCT transforms the image data into a data format caffe can read Leveldb/lmdb
1. Adding command parameters
In the main function, add the command parameters, and the contents and location are as follows:
#ifndef Gflags_gflags_h_
namespace gflags = Google;
#endif
Convert ImageSet by xiaopanlyu====================================================
ARGC = 12;
"Convert_imageset";
"-gray=true"; //whether Read Gray image
"-shuffle=true"; //whether Mix Order
"-resize_height=28";
"-resize_width=28";
"-backend=lmdb"; //leveldb/lmdb
"-check_size=false";
"-encoded=true";
"-encode_type=jpg";
"e:/mycode/dl/caffe-master/examples/images/";
"E:/mycode/dl/caffe-master/examples/convert_imageset/images_list.txt";
"e:/mycode/dl/caffe-master/examples/convert_imageset/img_convert/";
After read the [FLAGS] command, the argv & ARGC would is adjust automatically
//==================================================================================
Gflags::setusagemessage ("Convert a set of images to the leveldb/lmdb\n"
"Format used as input for caffe.\n"
"Usage:\n"
" Convert_imageset [FLAGS] Rootfolder/listfile db_name\n"
"The ImageNet DataSet for the training demo is at\n"
" http://www.image-net.org/download-images\n");
true);
Attention:
1) argv[10] = "E:/mycode/dl/caffe-master/examples/convert_imageset/images_list.txt"; the file represents the corresponding label of the image, in the following format:
Cat Gray.jpg 1
Cat.jpg 1
Cat_gray.jpg 1
Fish-bike.jpg 2
2) argv[11] = "e:/mycode/dl/caffe-master/examples/convert_imageset/img_convert/"; the file under which the path is generated, if it has been previously generated, When you execute the code again, make sure there are no duplicate files, or you will get an error.
2. Execute the code and get the result
The resulting files are as follows:
Chapter 5 Convert Image Set to Leveldb/lmdb