Chapter 5 Convert Image Set to Leveldb/lmdb

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.