提交 b0e5de3b 编写于 作者: G gineshidalgo99

Google flags working on Ubuntu 14

上级 5160a127
...@@ -19,7 +19,12 @@ ...@@ -19,7 +19,12 @@
#include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds #include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds
#include <thread> // std::this_thread #include <thread> // std::this_thread
// Other 3rdparty dependencies // Other 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
#include <openpose/headers.hpp> #include <openpose/headers.hpp>
......
...@@ -3,7 +3,12 @@ ...@@ -3,7 +3,12 @@
#include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds #include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds
#include <thread> // std::this_thread #include <thread> // std::this_thread
// Other 3rdparty dependencies // Other 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
......
...@@ -2,7 +2,12 @@ ...@@ -2,7 +2,12 @@
// Example to test hands accuracy given ground-truth bounding boxes. // Example to test hands accuracy given ground-truth bounding boxes.
#include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds #include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
#include <openpose/headers.hpp> #include <openpose/headers.hpp>
#include "wrapperHandFromJsonTest.hpp" #include "wrapperHandFromJsonTest.hpp"
......
...@@ -9,7 +9,12 @@ ...@@ -9,7 +9,12 @@
// 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively // 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively
// 3rdparty dependencies // 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
#include <openpose/core/headers.hpp> #include <openpose/core/headers.hpp>
......
...@@ -9,7 +9,12 @@ ...@@ -9,7 +9,12 @@
// 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively // 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively
// 3rdparty dependencies // 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
#include <openpose/core/headers.hpp> #include <openpose/core/headers.hpp>
......
...@@ -8,7 +8,12 @@ ...@@ -8,7 +8,12 @@
// 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively // 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively
// 3rdparty dependencies // 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
#include <openpose/core/headers.hpp> #include <openpose/core/headers.hpp>
......
...@@ -9,7 +9,12 @@ ...@@ -9,7 +9,12 @@
// 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively // 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively
// 3rdparty dependencies // 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
#include <openpose/core/headers.hpp> #include <openpose/core/headers.hpp>
......
...@@ -9,7 +9,12 @@ ...@@ -9,7 +9,12 @@
// 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively // 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively
// 3rdparty dependencies // 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
// Option a) Importing all modules // Option a) Importing all modules
......
...@@ -9,7 +9,12 @@ ...@@ -9,7 +9,12 @@
// 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively // 2. `utilities` module: for the error & logging functions, i.e. op::error & op::log respectively
// 3rdparty dependencies // 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
// Option a) Importing all modules // Option a) Importing all modules
......
...@@ -19,7 +19,12 @@ ...@@ -19,7 +19,12 @@
#include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds #include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds
#include <thread> // std::this_thread #include <thread> // std::this_thread
// Other 3rdparty dependencies // Other 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
#include <openpose/headers.hpp> #include <openpose/headers.hpp>
......
...@@ -19,7 +19,12 @@ ...@@ -19,7 +19,12 @@
#include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds #include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds
#include <thread> // std::this_thread #include <thread> // std::this_thread
// Other 3rdparty dependencies // Other 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
#include <openpose/headers.hpp> #include <openpose/headers.hpp>
......
...@@ -19,7 +19,12 @@ ...@@ -19,7 +19,12 @@
#include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds #include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds
#include <thread> // std::this_thread #include <thread> // std::this_thread
// Other 3rdparty dependencies // Other 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
#include <openpose/headers.hpp> #include <openpose/headers.hpp>
......
...@@ -19,7 +19,12 @@ ...@@ -19,7 +19,12 @@
#include <thread> // std::this_thread #include <thread> // std::this_thread
#include <vector> #include <vector>
// Other 3rdparty dependencies // Other 3rdparty dependencies
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string // GFlags: DEFINE_bool, _int32, _int64, _uint64, _double, _string
#include <gflags/gflags.h>
// Allow Google Flags in Ubuntu 14
#ifndef GFLAGS_GFLAGS_H_
namespace gflags = google;
#endif
#include <glog/logging.h> // google::InitGoogleLogging #include <glog/logging.h> // google::InitGoogleLogging
// OpenPose dependencies // OpenPose dependencies
......
...@@ -7,7 +7,9 @@ namespace op ...@@ -7,7 +7,9 @@ namespace op
{ {
OP_API void mkdir(const std::string& directoryPath); OP_API void mkdir(const std::string& directoryPath);
OP_API bool exist(const std::string& directoryPath); OP_API bool existDir(const std::string& directoryPath);
OP_API bool existFile(const std::string& filePath);
OP_API bool isDirectory(const std::string& directoryPath); OP_API bool isDirectory(const std::string& directoryPath);
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <caffe/net.hpp> #include <caffe/net.hpp>
#endif #endif
#include <openpose/utilities/cuda.hpp> #include <openpose/utilities/cuda.hpp>
#include <openpose/utilities/fileSystem.hpp>
#include <openpose/core/netCaffe.hpp> #include <openpose/core/netCaffe.hpp>
namespace op namespace op
...@@ -32,6 +33,14 @@ namespace op ...@@ -32,6 +33,14 @@ namespace op
mCaffeTrainedModel{caffeTrainedModel}, mCaffeTrainedModel{caffeTrainedModel},
mLastBlobName{lastBlobName} mLastBlobName{lastBlobName}
{ {
const std::string message{".\nPossible causes:\n\t1. Not downloading the OpenPose trained models."
"\n\t2. Not running OpenPose from the same directory where the `model`"
" folder is located.\n\t3. Using paths with spaces."};
if (!existFile(mCaffeProto))
error("Prototxt file not found: " + mCaffeProto + message, __LINE__, __FUNCTION__, __FILE__);
if (!existFile(mCaffeTrainedModel))
error("Caffe trained model file not found: " + mCaffeTrainedModel + message,
__LINE__, __FUNCTION__, __FILE__);
} }
#endif #endif
}; };
......
#include <cstdio> // fopen
#include <boost/filesystem.hpp> #include <boost/filesystem.hpp>
#include <boost/range/iterator_range_core.hpp> #include <boost/range/iterator_range_core.hpp>
#include <openpose/utilities/fileSystem.hpp>
#include <openpose/utilities/string.hpp> #include <openpose/utilities/string.hpp>
#include <openpose/utilities/fileSystem.hpp>
namespace op namespace op
{ {
...@@ -23,10 +24,11 @@ namespace op ...@@ -23,10 +24,11 @@ namespace op
} }
} }
bool exist(const std::string& directoryPath) bool existDir(const std::string& directoryPath)
{ {
try try
{ {
// Maybe existFile also works for directories in Ubuntu/Windows/Mac?
return boost::filesystem::exists(directoryPath); return boost::filesystem::exists(directoryPath);
} }
catch (const std::exception& e) catch (const std::exception& e)
...@@ -36,6 +38,25 @@ namespace op ...@@ -36,6 +38,25 @@ namespace op
} }
} }
bool existFile(const std::string& filePath)
{
try
{
if (auto* file = fopen(filePath.c_str(), "r"))
{
fclose(file);
return true;
}
else
return false;
}
catch (const std::exception& e)
{
error(e.what(), __LINE__, __FUNCTION__, __FILE__);
return false;
}
}
bool isDirectory(const std::string& directoryPath) bool isDirectory(const std::string& directoryPath)
{ {
try try
...@@ -153,7 +174,7 @@ namespace op ...@@ -153,7 +174,7 @@ namespace op
try try
{ {
// Check folder exits // Check folder exits
if (!exist(directoryPath)) if (!existDir(directoryPath))
error("Folder " + directoryPath + " does not exist.", __LINE__, __FUNCTION__, __FILE__); error("Folder " + directoryPath + " does not exist.", __LINE__, __FUNCTION__, __FILE__);
// Read images // Read images
std::vector<std::string> filePaths; std::vector<std::string> filePaths;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册