Ubuntu code compatible with Windows one

This commit is contained in:
Gines Hidalgo
2017-05-25 14:41:55 -04:00
parent 763cd1ff03
commit e8a4223d27
12 changed files with 79 additions and 46 deletions
+4 -1
View File
@@ -66,7 +66,6 @@ namespace op
const std::array<float, (int)PoseModel::Size> POSE_CCN_DECREASE_FACTOR{ 8.f, 8.f, 8.f};
const std::array<unsigned int, (int)PoseModel::Size> POSE_MAX_PEAKS{ POSE_MAX_PEOPLE, POSE_MAX_PEOPLE, POSE_MAX_PEOPLE};
const std::array<unsigned char, (int)PoseModel::Size> POSE_NUMBER_BODY_PARTS{ POSE_COCO_NUMBER_PARTS, POSE_MPI_NUMBER_PARTS, POSE_MPI_NUMBER_PARTS};
const std::array<std::map<unsigned char, std::string>, 3> POSE_BODY_PART_MAPPING{ POSE_COCO_BODY_PARTS, POSE_MPI_BODY_PARTS, POSE_MPI_BODY_PARTS};
const std::array<std::vector<unsigned char>, 3> POSE_BODY_PART_PAIRS{ POSE_COCO_PAIRS, POSE_MPI_PAIRS, POSE_MPI_PAIRS};
const std::array<std::vector<unsigned char>, 3> POSE_MAP_IDX{ POSE_COCO_MAP_IDX, POSE_MPI_MAP_IDX, POSE_MPI_MAP_IDX};
const std::array<std::string, (int)PoseModel::Size> POSE_PROTOTXT{ "pose/coco/pose_deploy_linevec.prototxt",
@@ -75,6 +74,10 @@ namespace op
const std::array<std::string, (int)PoseModel::Size> POSE_TRAINED_MODEL{ "pose/coco/pose_iter_440000.caffemodel",
"pose/mpi/pose_iter_160000.caffemodel",
"pose/mpi/pose_iter_160000.caffemodel"};
// POSE_BODY_PART_MAPPING crashes on Windows at dynamic initialization, to avoid this crash:
// POSE_BODY_PART_MAPPING has been moved to poseParameters.cpp and getPoseBodyPartMapping() wraps it
//const std::array<std::map<unsigned char, std::string>, 3> POSE_BODY_PART_MAPPING{ POSE_COCO_BODY_PARTS, POSE_MPI_BODY_PARTS, POSE_MPI_BODY_PARTS};
const std::map<unsigned char, std::string>& getPoseBodyPartMapping(const PoseModel poseModel);
// Default Model Parameters
// They might be modified on running time
+1
View File
@@ -1,6 +1,7 @@
#ifndef OPENPOSE__PRODUCER__PRODUCER_HPP
#define OPENPOSE__PRODUCER__PRODUCER_HPP
#include <array>
#include <chrono>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp> // capProperties of OpenCV
+1 -1
View File
@@ -1,5 +1,5 @@
#ifndef OPENPOSE__THREAD__QUEUE_BASE_HPP
#define OPENPOSE__THREAD__QUEUE_BASE_HPP
#define OPENPOSE__THREAD__QUEUE_BASE_HPP
#include <queue> // std::queue & std::priority_queue
#include <condition_variable>
+4 -4
View File
@@ -442,7 +442,7 @@ namespace op
// #threads = maxThreadId+1
mThreads.resize(maxThreadId);
for (auto& thread : mThreads)
thread = {std::make_shared<Thread<TDatums, TWorker>>()};
thread = std::make_shared<Thread<TDatums, TWorker>>();
mThreads.emplace_back(std::make_shared<Thread<TDatums, TWorker>>(spIsRunning));
}
catch (const std::exception& e)
@@ -467,8 +467,8 @@ namespace op
std::vector<std::pair<bool, bool>> usedQueueIds(maxQueueId + 1, {false, false});
for (const auto& threadWorkerQueue : mThreadWorkerQueues)
{
usedQueueIds[std::get<2>(threadWorkerQueue)].first = true;
usedQueueIds[std::get<3>(threadWorkerQueue)].second = true;
usedQueueIds.at(std::get<2>(threadWorkerQueue)).first = true;
usedQueueIds.at(std::get<3>(threadWorkerQueue)).second = true;
}
// Id 0 must only needs a worker using it as input.
usedQueueIds.begin()->second = true;
@@ -493,7 +493,7 @@ namespace op
else
error("Unknown ThreadManagerMode", __LINE__, __FUNCTION__, __FILE__);
for (auto& tQueue : mTQueues)
tQueue = {std::make_shared<TQueue>(mDefaultMaxSizeQueues)};
tQueue = std::make_shared<TQueue>(mDefaultMaxSizeQueues);
}
}
catch (const std::exception& e)