91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 7KB
    文件類型: .cpp
    金幣: 1
    下載: 0 次
    發布日期: 2021-05-16
  • 語言: C/C++
  • 標簽:

資源簡介

將此convert_imageset.cpp替換caffe中的原來的convert_imageset.cpp重新編譯caffe,就能是caffe支持多標簽輸出

資源截圖

代碼片段和文件信息

//?This?program?converts?a?set?of?images?to?a?lmdb/leveldb?by?storing?them
//?as?Datum?proto?buffers.
//?Usage:
//???convert_imageset?[FLAGS]?ROOTFOLDER/?LISTFILE?IM_DB_NAME?LABEL_DB_NAME?LABEL_COUNT
//
//?where?ROOTFOLDER?is?the?root?folder?that?holds?all?the?images?and?LISTFILE
//?should?be?a?list?of?files?as?well?as?their?labels?in?the?format?as
//???subfolder1/file1.JPEG?7
//???....



//#ifdef MULTILABEL



#include?
#include???//?NOLINT(readability/streams)
#include?
#include?
#include?

#include?“boost/scoped_ptr.hpp“
#include?“gflags/gflags.h“
#include?“glog/logging.h“

#include?“caffe/proto/caffe.pb.h“
#include?“caffe/util/db.hpp“
#include?“caffe/util/format.hpp“
#include?“caffe/util/io.hpp“
#include?“caffe/util/rng.hpp“

using?namespace?caffe;??//?NOLINT(build/namespaces)
using?std::pair;
using?boost::scoped_ptr;

DEFINE_bool(gray?false
????“When?this?option?is?on?treat?images?as?grayscale?ones“);
DEFINE_bool(shuffle?false
????“Randomly?shuffle?the?order?of?images?and?their?labels“);
DEFINE_string(backend?“lmdb“
????“The?backend?{lmdb?leveldb}?for?storing?the?result“);
DEFINE_int32(resize_width?0?“Width?images?are?resized?to“);
DEFINE_int32(resize_height?0?“Height?images?are?resized?to“);
DEFINE_bool(check_size?false
????“When?this?option?is?on?check?that?all?the?datum?have?the?same?size“);
DEFINE_bool(encoded?false
????“When?this?option?is?on?the?encoded?image?will?be?save?in?datum“);
DEFINE_string(encode_type?““
????“Optional:?What?type?should?we?encode?the?image?as?(‘png‘‘jpg‘...).“);

int?main(int?argc?char**?argv)?{
#ifdef?USE_OPENCV
????::google::InitGoogleLogging(argv[0]);
????//?Print?output?to?stderr?(while?still?logging)
????FLAGS_alsologtostderr?=?1;

#ifndef?GFLAGS_GFLAGS_H_
????namespace?gflags?=?google;
#endif

????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“);
????gflags::ParseCommandLineFlags(&argc?&argv?true);

????if?(argc?????????gflags::ShowUsageWithFlagsRestrict(argv[0]?“tools/convert_imageset“);
????????return?1;
????}

????const?bool?is_color?=?!FLAGS_gray;
????const?bool?check_size?=?FLAGS_check_size;
????const?bool?encoded?=?FLAGS_encoded;
????const?string?encode_type?=?FLAGS_encode_type;

????std::ifstream?infile(argv[2]);

????LOG(INFO)?<????
????std::vector?>?>?lines;
????std::string?filename;

????std::string?label_count_string?=?argv[5]?;
????int?label_count?=?std::atoi(label_count_string.c_str());
????LOG(INFO)?<????std::vector?label(label_count);

????while?(infile?>>?filename)
????{
????????for?(int?i?=?0;?i?????????{
????????????i

評論

共有 條評論

相關資源