OpenPose  1.0.0rc2
OpenPose: A Real-Time Multi-Person Key-Point Detection And Multi-Threading C++ Library
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
poseParameters.hpp
Go to the documentation of this file.
1 #ifndef OPENPOSE_POSE_POSE_PARAMETERS_HPP
2 #define OPENPOSE_POSE_POSE_PARAMETERS_HPP
3 
4 #include <map>
7 
8 namespace op
9 {
10  // #define when needed in CUDA code
11 
12  // Constant Global Parameters
13  const unsigned int POSE_MAX_PEOPLE = 96u;
14 
15  // Model-Dependent Parameters
16  // COCO
17  const std::map<unsigned int, std::string> POSE_COCO_BODY_PARTS {
18  {0, "Nose"},
19  {1, "Neck"},
20  {2, "RShoulder"},
21  {3, "RElbow"},
22  {4, "RWrist"},
23  {5, "LShoulder"},
24  {6, "LElbow"},
25  {7, "LWrist"},
26  {8, "RHip"},
27  {9, "RKnee"},
28  {10, "RAnkle"},
29  {11, "LHip"},
30  {12, "LKnee"},
31  {13, "LAnkle"},
32  {14, "REye"},
33  {15, "LEye"},
34  {16, "REar"},
35  {17, "LEar"},
36  {18, "Background"}
37  };
38  const unsigned int POSE_COCO_NUMBER_PARTS = 18u; // Equivalent to size of std::map POSE_COCO_BODY_PARTS - 1 (removing background)
39  const std::vector<unsigned int> POSE_COCO_MAP_IDX {31,32, 39,40, 33,34, 35,36, 41,42, 43,44, 19,20, 21,22, 23,24, 25,26, 27,28, 29,30, 47,48, 49,50, 53,54, 51,52, 55,56, 37,38, 45,46};
40  #define POSE_COCO_PAIRS_RENDER_GPU {1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12, 12,13, 1,0, 0,14, 14,16, 0,15, 15,17}
41  const std::vector<unsigned int> POSE_COCO_PAIRS_RENDER {POSE_COCO_PAIRS_RENDER_GPU};
42  const std::vector<unsigned int> POSE_COCO_PAIRS {1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12, 12,13, 1,0, 0,14, 14,16, 0,15, 15,17, 2,16, 5,17};
43  #define POSE_COCO_COLORS_RENDER_GPU \
44  255.f, 0.f, 85.f, \
45  255.f, 0.f, 0.f, \
46  255.f, 85.f, 0.f, \
47  255.f, 170.f, 0.f, \
48  255.f, 255.f, 0.f, \
49  170.f, 255.f, 0.f, \
50  85.f, 255.f, 0.f, \
51  0.f, 255.f, 0.f, \
52  0.f, 255.f, 85.f, \
53  0.f, 255.f, 170.f, \
54  0.f, 255.f, 255.f, \
55  0.f, 170.f, 255.f, \
56  0.f, 85.f, 255.f, \
57  0.f, 0.f, 255.f, \
58  255.f, 0.f, 170.f, \
59  170.f, 0.f, 255.f, \
60  255.f, 0.f, 255.f, \
61  85.f, 0.f, 255.f
63  // MPI
64  const std::map<unsigned int, std::string> POSE_MPI_BODY_PARTS {
65  {0, "Head"},
66  {1, "Neck"},
67  {2, "RShoulder"},
68  {3, "RElbow"},
69  {4, "RWrist"},
70  {5, "LShoulder"},
71  {6, "LElbow"},
72  {7, "LWrist"},
73  {8, "RHip"},
74  {9, "RKnee"},
75  {10, "RAnkle"},
76  {11, "LHip"},
77  {12, "LKnee"},
78  {13, "LAnkle"},
79  {14, "Chest"},
80  {15, "Background"}
81  };
82  const unsigned int POSE_MPI_NUMBER_PARTS = 15; // Equivalent to size of std::map POSE_MPI_NUMBER_PARTS - 1 (removing background)
83  const std::vector<unsigned int> POSE_MPI_MAP_IDX {16,17, 18,19, 20,21, 22,23, 24,25, 26,27, 28,29, 30,31, 32,33, 34,35, 36,37, 38,39, 40,41, 42,43};
84  #define POSE_MPI_PAIRS_RENDER_GPU { 0,1, 1,2, 2,3, 3,4, 1,5, 5,6, 6,7, 1,14, 14,8, 8,9, 9,10, 14,11, 11,12, 12,13}
85  const std::vector<unsigned int> POSE_MPI_PAIRS POSE_MPI_PAIRS_RENDER_GPU;
86  // MPI colors chosen such that they are closed to COCO colors
87  #define POSE_MPI_COLORS_RENDER_GPU \
88  255.f, 0.f, 85.f, \
89  255.f, 0.f, 0.f, \
90  255.f, 85.f, 0.f, \
91  255.f, 170.f, 0.f, \
92  255.f, 255.f, 0.f, \
93  170.f, 255.f, 0.f, \
94  85.f, 255.f, 0.f, \
95  43.f, 255.f, 0.f, \
96  0.f, 255.f, 0.f, \
97  0.f, 255.f, 85.f, \
98  0.f, 255.f, 170.f, \
99  0.f, 255.f, 255.f, \
100  0.f, 170.f, 255.f, \
101  0.f, 85.f, 255.f, \
102  0.f, 0.f, 255.f
104  // BODY_18
105  const std::map<unsigned int, std::string> POSE_BODY_18_BODY_PARTS { // Windows map copy error if `= POSE_COCO_BODY_PARTS`
106  { 0, "Nose" },
107  { 1, "Neck" },
108  { 2, "RShoulder" },
109  { 3, "RElbow" },
110  { 4, "RWrist" },
111  { 5, "LShoulder" },
112  { 6, "LElbow" },
113  { 7, "LWrist" },
114  { 8, "RHip" },
115  { 9, "RKnee" },
116  { 10, "RAnkle" },
117  { 11, "LHip" },
118  { 12, "LKnee" },
119  { 13, "LAnkle" },
120  { 14, "REye" },
121  { 15, "LEye" },
122  { 16, "REar" },
123  { 17, "LEar" },
124  { 18, "Background" }
125  };
127  const std::vector<unsigned int> POSE_BODY_18_MAP_IDX {POSE_COCO_MAP_IDX};
128  #define POSE_BODY_18_PAIRS_RENDER_GPU POSE_COCO_PAIRS_RENDER_GPU
129  const std::vector<unsigned int> POSE_BODY_18_PAIRS_RENDER {POSE_BODY_18_PAIRS_RENDER_GPU};
130  const std::vector<unsigned int> POSE_BODY_18_PAIRS {POSE_COCO_PAIRS};
131  #define POSE_BODY_18_COLORS_RENDER_GPU POSE_COCO_COLORS_RENDER_GPU
133  // BODY_19
134  const std::map<unsigned int, std::string> POSE_BODY_19_BODY_PARTS {
135  { 0, "Nose" },
136  { 1, "Neck" },
137  { 2, "RShoulder" },
138  { 3, "RElbow" },
139  { 4, "RWrist" },
140  { 5, "LShoulder" },
141  { 6, "LElbow" },
142  { 7, "LWrist" },
143  { 8, "LowerAbs" },
144  { 9, "RHip" },
145  { 10, "RKnee" },
146  { 11, "RAnkle" },
147  { 12, "LHip" },
148  { 13, "LKnee" },
149  { 14, "LAnkle" },
150  { 15, "REye" },
151  { 16, "LEye" },
152  { 17, "REar" },
153  { 18, "LEar" },
154  { 19, "Background" }
155  };
156  const unsigned int POSE_BODY_19_NUMBER_PARTS = 19u; // Equivalent to size of std::map POSE_BODY_19_BODY_PARTS - 1 (removing background)
157  const std::vector<unsigned int> POSE_BODY_19_MAP_IDX {20,21, 34,35, 42,43, 36,37, 38,39, 44,45, 46,47, 26,27, 22,23, 24,25, 28,29, 30,31, 32,33, 50,51, 52,53, 56,57, 54,55, 58,59, 40,41, 48,49};
158  #define POSE_BODY_19_PAIRS_RENDER_GPU {1,8, 1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 8,9, 9,10, 10,11, 8,12, 12,13, 13,14, 1,0, 0,15, 15,17, 0,16, 16,18}
159  const std::vector<unsigned int> POSE_BODY_19_PAIRS_RENDER {POSE_COCO_PAIRS_RENDER_GPU};
160  const std::vector<unsigned int> POSE_BODY_19_PAIRS {1,8, 1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 8,9, 9,10, 10,11, 8,12, 12,13, 13,14, 1,0, 0,15, 15,17, 0,16, 16,18, 2,17, 5,18};
161  #define POSE_BODY_19_COLORS_RENDER_GPU \
162  255.f, 0.f, 85.f, \
163  255.f, 0.f, 0.f, \
164  255.f, 85.f, 0.f, \
165  255.f, 170.f, 0.f, \
166  255.f, 255.f, 0.f, \
167  170.f, 255.f, 0.f, \
168  85.f, 255.f, 0.f, \
169  0.f, 255.f, 0.f, \
170  255.f, 0.f, 0.f, \
171  0.f, 255.f, 85.f, \
172  0.f, 255.f, 170.f, \
173  0.f, 255.f, 255.f, \
174  0.f, 170.f, 255.f, \
175  0.f, 85.f, 255.f, \
176  0.f, 0.f, 255.f, \
177  255.f, 0.f, 170.f, \
178  170.f, 0.f, 255.f, \
179  255.f, 0.f, 255.f, \
180  85.f, 0.f, 255.f
182  // BODY_22
183  const std::map<unsigned int, std::string> POSE_BODY_22_BODY_PARTS {
184  {0, "Nose"},
185  {1, "Neck"},
186  {2, "RShoulder"},
187  {3, "RElbow"},
188  {4, "RWrist"},
189  {5, "LShoulder"},
190  {6, "LElbow"},
191  {7, "LWrist"},
192  {8, "RHip"},
193  {9, "RKnee"},
194  {10, "RAnkle"},
195  {11, "LHip"},
196  {12, "LKnee"},
197  {13, "LAnkle"},
198  {14, "REye"},
199  {15, "LEye"},
200  {16, "REar"},
201  {17, "LEar"},
202  {18, "RTest1"},
203  {19, "LTest1"},
204  {20, "RTest2"},
205  {21, "LTest2"},
206  {22, "Background"}
207  };
208  const unsigned int POSE_BODY_22_NUMBER_PARTS = 22u; // Equivalent to size of std::map POSE_BODY_22_BODY_PARTS - 1 (removing background)
209  const std::vector<unsigned int> POSE_BODY_22_MAP_IDX {35,36, 43,45, 37,38, 39,40, 45,46, 47,48, 23,24, 25,26, 27,28, 29,30, 31,32, 33,34, 51,52};
210  #define POSE_BODY_22_PAIRS_RENDER_GPU {1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12}
211  const std::vector<unsigned int> POSE_BODY_22_PAIRS_RENDER {POSE_BODY_22_PAIRS_RENDER_GPU};
212  const std::vector<unsigned int> POSE_BODY_22_PAIRS {1,2, 1,5, 2,3, 3,4, 5,6, 6,7, 1,8, 8,9, 9,10, 1,11, 11,12, 12,13, 1,0};
213  #define POSE_BODY_22_COLORS_RENDER_GPU \
214  255.f, 0.f, 0.f, \
215  255.f, 85.f, 0.f, \
216  255.f, 170.f, 0.f, \
217  255.f, 255.f, 0.f, \
218  170.f, 255.f, 0.f, \
219  85.f, 255.f, 0.f, \
220  0.f, 255.f, 0.f, \
221  0.f, 255.f, 85.f, \
222  0.f, 255.f, 170.f, \
223  0.f, 255.f, 255.f, \
224  0.f, 170.f, 255.f, \
225  0.f, 85.f, 255.f, \
226  0.f, 0.f, 255.f, \
227  85.f, 0.f, 255.f, \
228  170.f, 0.f, 255.f, \
229  255.f, 0.f, 255.f, \
230  255.f, 0.f, 170.f, \
231  255.f, 0.f, 85.f
233 
234  // Constant Array Parameters
235  const std::array<float, (int)PoseModel::Size> POSE_CCN_DECREASE_FACTOR{
236  8.f, 8.f, 8.f, 8.f, 8.f, 8.f
237  };
238  const std::array<unsigned int, (int)PoseModel::Size> POSE_MAX_PEAKS{
240  };
241  const std::array<unsigned int, (int)PoseModel::Size> POSE_NUMBER_BODY_PARTS{
243  };
244  const std::array<std::vector<unsigned int>, (int)PoseModel::Size> POSE_BODY_PART_PAIRS{
246  };
247  const std::array<std::vector<unsigned int>, (int)PoseModel::Size> POSE_BODY_PART_PAIRS_RENDER{
249  };
250  const std::array<std::vector<unsigned int>, (int)PoseModel::Size> POSE_MAP_IDX{
252  };
253  const std::array<std::vector<float>, (int)PoseModel::Size> POSE_COLORS{
255  };
256  const std::array<std::string, (int)PoseModel::Size> POSE_PROTOTXT{
257  "pose/coco/pose_deploy_linevec.prototxt",
258  "pose/mpi/pose_deploy_linevec.prototxt",
259  "pose/mpi/pose_deploy_linevec_faster_4_stages.prototxt",
260  "pose/body_18/pose_deploy.prototxt",
261  "pose/body_19/pose_deploy.prototxt",
262  "pose/body_22/pose_deploy.prototxt"
263  };
264  const std::array<std::string, (int)PoseModel::Size> POSE_TRAINED_MODEL{
265  "pose/coco/pose_iter_440000.caffemodel",
266  "pose/mpi/pose_iter_160000.caffemodel",
267  "pose/mpi/pose_iter_160000.caffemodel",
268  "pose/body_18/pose_iter_XXXXXX.caffemodel",
269  "pose/body_19/pose_iter_XXXXXX.caffemodel",
270  "pose/body_22/pose_iter_40000.caffemodel"
271  };
272  // POSE_BODY_PART_MAPPING crashes on Windows at dynamic initialization, to avoid this crash:
273  // POSE_BODY_PART_MAPPING has been moved to poseParameters.cpp and getPoseBodyPartMapping() wraps it
274  // const std::array<std::map<unsigned int, std::string>, (int)PoseModel::Size> POSE_BODY_PART_MAPPING{
275  // POSE_COCO_BODY_PARTS, POSE_MPI_BODY_PARTS, POSE_MPI_BODY_PARTS
276  // };
277  const std::map<unsigned int, std::string>& getPoseBodyPartMapping(const PoseModel poseModel);
278 
279  // Default Model Parameters
280  // They might be modified on running time
281  const std::array<float, (int)PoseModel::Size> POSE_DEFAULT_NMS_THRESHOLD{
282  0.05f, 0.6f, 0.3f, 0.05f, 0.05f, 0.05f
283  };
284  const std::array<unsigned int, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_INTER_MIN_ABOVE_THRESHOLD{
285  9, 8, 8, 9, 9, 9
286  };
287  const std::array<float, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_INTER_THRESHOLD{
288  0.05f, 0.01f, 0.01f, 0.05f, 0.05f, 0.05f
289  };
290  const std::array<unsigned int, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_MIN_SUBSET_CNT{
291  3, 3, 3, 3, 3, 3
292  };
293  const std::array<float, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_MIN_SUBSET_SCORE{
294  0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f
295  };
296 
297  // Rendering parameters
298  const auto POSE_DEFAULT_ALPHA_KEYPOINT = 0.6f;
299  const auto POSE_DEFAULT_ALPHA_HEAT_MAP = 0.7f;
300 
301  // Auxiliary functions
302  OP_API unsigned int poseBodyPartMapStringToKey(const PoseModel poseModel, const std::string& string);
303  OP_API unsigned int poseBodyPartMapStringToKey(const PoseModel poseModel, const std::vector<std::string>& strings);
304 }
305 
306 #endif // OPENPOSE_POSE_POSE_PARAMETERS_HPP
const std::map< unsigned int, std::string > POSE_BODY_22_BODY_PARTS
Definition: poseParameters.hpp:183
const unsigned int POSE_COCO_NUMBER_PARTS
Definition: poseParameters.hpp:38
#define POSE_BODY_18_COLORS_RENDER_GPU
Definition: poseParameters.hpp:131
const unsigned int POSE_BODY_18_NUMBER_PARTS
Definition: poseParameters.hpp:126
const std::map< unsigned int, std::string > POSE_COCO_BODY_PARTS
Definition: poseParameters.hpp:17
const std::array< float,(int) PoseModel::Size > POSE_DEFAULT_NMS_THRESHOLD
Definition: poseParameters.hpp:281
const std::array< unsigned int,(int) PoseModel::Size > POSE_MAX_PEAKS
Definition: poseParameters.hpp:238
const std::vector< unsigned int > POSE_BODY_19_MAP_IDX
Definition: poseParameters.hpp:157
const auto POSE_DEFAULT_ALPHA_KEYPOINT
Definition: poseParameters.hpp:298
const unsigned int POSE_BODY_22_NUMBER_PARTS
Definition: poseParameters.hpp:208
OP_API unsigned int poseBodyPartMapStringToKey(const PoseModel poseModel, const std::string &string)
PoseModel
Definition: enumClasses.hpp:9
const std::map< unsigned int, std::string > & getPoseBodyPartMapping(const PoseModel poseModel)
const std::array< std::string,(int) PoseModel::Size > POSE_TRAINED_MODEL
Definition: poseParameters.hpp:264
#define POSE_BODY_22_COLORS_RENDER_GPU
Definition: poseParameters.hpp:213
const std::array< float,(int) PoseModel::Size > POSE_CCN_DECREASE_FACTOR
Definition: poseParameters.hpp:235
const std::array< unsigned int,(int) PoseModel::Size > POSE_DEFAULT_CONNECT_INTER_MIN_ABOVE_THRESHOLD
Definition: poseParameters.hpp:284
const unsigned int POSE_MPI_NUMBER_PARTS
Definition: poseParameters.hpp:82
const std::vector< float > POSE_MPI_COLORS_RENDER
Definition: poseParameters.hpp:103
#define POSE_BODY_19_COLORS_RENDER_GPU
Definition: poseParameters.hpp:161
const std::vector< unsigned int > POSE_BODY_19_PAIRS_RENDER
Definition: poseParameters.hpp:159
const std::vector< float > POSE_BODY_18_COLORS_RENDER
Definition: poseParameters.hpp:132
const std::vector< unsigned int > POSE_BODY_18_MAP_IDX
Definition: poseParameters.hpp:127
const unsigned int POSE_MAX_PEOPLE
Definition: poseParameters.hpp:13
const std::array< std::vector< float >,(int) PoseModel::Size > POSE_COLORS
Definition: poseParameters.hpp:253
const std::vector< float > POSE_COCO_COLORS_RENDER
Definition: poseParameters.hpp:62
const std::vector< unsigned int > POSE_BODY_22_PAIRS_RENDER
Definition: poseParameters.hpp:211
const std::vector< unsigned int > POSE_COCO_PAIRS_RENDER
Definition: poseParameters.hpp:41
const std::vector< unsigned int > POSE_COCO_MAP_IDX
Definition: poseParameters.hpp:39
#define POSE_COCO_COLORS_RENDER_GPU
Definition: poseParameters.hpp:43
const std::vector< float > POSE_BODY_22_COLORS_RENDER
Definition: poseParameters.hpp:232
const std::vector< unsigned int > POSE_BODY_22_PAIRS
Definition: poseParameters.hpp:212
const std::map< unsigned int, std::string > POSE_BODY_19_BODY_PARTS
Definition: poseParameters.hpp:134
const std::array< std::vector< unsigned int >,(int) PoseModel::Size > POSE_BODY_PART_PAIRS
Definition: poseParameters.hpp:244
const std::array< float,(int) PoseModel::Size > POSE_DEFAULT_CONNECT_INTER_THRESHOLD
Definition: poseParameters.hpp:287
const std::vector< unsigned int > POSE_BODY_19_PAIRS
Definition: poseParameters.hpp:160
const std::array< float,(int) PoseModel::Size > POSE_DEFAULT_CONNECT_MIN_SUBSET_SCORE
Definition: poseParameters.hpp:293
const std::vector< unsigned int > POSE_MPI_MAP_IDX
Definition: poseParameters.hpp:83
#define POSE_BODY_22_PAIRS_RENDER_GPU
Definition: poseParameters.hpp:210
const std::array< unsigned int,(int) PoseModel::Size > POSE_DEFAULT_CONNECT_MIN_SUBSET_CNT
Definition: poseParameters.hpp:290
#define POSE_MPI_COLORS_RENDER_GPU
Definition: poseParameters.hpp:87
const std::map< unsigned int, std::string > POSE_MPI_BODY_PARTS
Definition: poseParameters.hpp:64
#define POSE_BODY_18_PAIRS_RENDER_GPU
Definition: poseParameters.hpp:128
const std::array< std::string,(int) PoseModel::Size > POSE_PROTOTXT
Definition: poseParameters.hpp:256
const std::array< std::vector< unsigned int >,(int) PoseModel::Size > POSE_BODY_PART_PAIRS_RENDER
Definition: poseParameters.hpp:247
const unsigned int POSE_BODY_19_NUMBER_PARTS
Definition: poseParameters.hpp:156
const std::vector< unsigned int > POSE_BODY_18_PAIRS_RENDER
Definition: poseParameters.hpp:129
#define POSE_COCO_PAIRS_RENDER_GPU
Definition: poseParameters.hpp:40
#define OP_API
Definition: macros.hpp:5
const std::vector< float > POSE_BODY_19_COLORS_RENDER
Definition: poseParameters.hpp:181
const std::vector< unsigned int > POSE_MPI_PAIRS POSE_MPI_PAIRS_RENDER_GPU
Definition: poseParameters.hpp:85
const std::vector< unsigned int > POSE_BODY_18_PAIRS
Definition: poseParameters.hpp:130
const auto POSE_DEFAULT_ALPHA_HEAT_MAP
Definition: poseParameters.hpp:299
const std::vector< unsigned int > POSE_COCO_PAIRS
Definition: poseParameters.hpp:42
const std::array< unsigned int,(int) PoseModel::Size > POSE_NUMBER_BODY_PARTS
Definition: poseParameters.hpp:241
const std::vector< unsigned int > POSE_BODY_22_MAP_IDX
Definition: poseParameters.hpp:209
const std::array< std::vector< unsigned int >,(int) PoseModel::Size > POSE_MAP_IDX
Definition: poseParameters.hpp:250
const std::map< unsigned int, std::string > POSE_BODY_18_BODY_PARTS
Definition: poseParameters.hpp:105