summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrzemysław Dolata <snowball91b@gmail.com>2018-02-20 13:03:14 (GMT)
committerGitHub <noreply@github.com>2018-02-20 13:03:14 (GMT)
commitf7135eda3cb88fffb9a9f79a9d9dc174fdc75528 (patch)
treebdb2bc97dfde5accb6cbbb7518b689f51723bed0
parent2571808e55303e0c4bc4e613a2a1f0ed0abc1216 (diff)
parentb3deb95e75f6890c08e7aa60193ea304614b24ea (diff)
downloadcaffe-f7135eda3cb88fffb9a9f79a9d9dc174fdc75528.zip
caffe-f7135eda3cb88fffb9a9f79a9d9dc174fdc75528.tar.gz
caffe-f7135eda3cb88fffb9a9f79a9d9dc174fdc75528.tar.bz2
Merge pull request #5149 from yanchen036/master
fix extension extraction in matchExt
-rw-r--r--src/caffe/util/io.cpp2
-rw-r--r--tools/convert_imageset.cpp2
2 files changed, 2 insertions, 2 deletions
diff --git a/src/caffe/util/io.cpp b/src/caffe/util/io.cpp
index 835d2d4..5295d9d 100644
--- a/src/caffe/util/io.cpp
+++ b/src/caffe/util/io.cpp
@@ -106,7 +106,7 @@ cv::Mat ReadImageToCVMat(const string& filename) {
static bool matchExt(const std::string & fn,
std::string en) {
size_t p = fn.rfind('.');
- std::string ext = p != fn.npos ? fn.substr(p) : fn;
+ std::string ext = p != fn.npos ? fn.substr(p+1) : fn;
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);
std::transform(en.begin(), en.end(), en.begin(), ::tolower);
if ( ext == en )
diff --git a/tools/convert_imageset.cpp b/tools/convert_imageset.cpp
index 90cdb15..9c5d09f 100644
--- a/tools/convert_imageset.cpp
+++ b/tools/convert_imageset.cpp
@@ -115,7 +115,7 @@ int main(int argc, char** argv) {
size_t p = fn.rfind('.');
if ( p == fn.npos )
LOG(WARNING) << "Failed to guess the encoding of '" << fn << "'";
- enc = fn.substr(p);
+ enc = fn.substr(p+1);
std::transform(enc.begin(), enc.end(), enc.begin(), ::tolower);
}
status = ReadImageToDatum(root_folder + lines[line_id].first,