提交 bbef0384 编写于 作者: G Gines Hidalgo

Improved error message and doc

上级 5283e28e
......@@ -8,10 +8,11 @@ OpenPose Demo - Output
1. [Keypoint Ordering](#keypoint-ordering)
2. [Heatmap Ordering](#heatmap-ordering)
3. [Heatmap Saving in Float Format](#heatmap-saving-in-float-format)
4. [Face and Hands](#face-and-hands)
5. [Pose Output Format](#pose-output-format)
6. [Face Output Format](#face-output-format)
7. [Hand Output Format](#hand-output-format)
4. [Heatmap Scaling](#heatmap-scaling)
5. [Face and Hands](#face-and-hands)
6. [Pose Output Format](#pose-output-format)
7. [Face Output Format](#face-output-format)
8. [Hand Output Format](#hand-output-format)
3. [Reading Saved Results](#reading-saved-results)
4. [Keypoint Format in the C++ API](#keypoint-format-in-the-c-api)
......@@ -153,6 +154,11 @@ arrayData = x[1+int(round(x[0])):]
### Heatmap Scaling
Note that `--net_resolution` sets the size of the network, thus also the size of the output heatmaps. This heatmaps are resized while keeping the aspect ratio. When aspect ratio of the the input and network are not the same, padding is added at the bottom and/or right part of the output heatmaps.
### Face and Hands
The output format is analogous for hand (`hand_left_keypoints`, `hand_right_keypoints`) and face (`face_keypoints`) JSON files.
......
......@@ -6,6 +6,24 @@
namespace op
{
int getLastNumberWithErrorMessage(const std::string& imageName, const CocoJsonFormat cocoJsonFormat)
{
try
{
return getLastNumber(imageName);
}
catch (const std::exception& e)
{
const std::string errorMessage = "`--write_coco_json` is to be used with the original "
+ std::string(cocoJsonFormat == CocoJsonFormat::Car ? "car" : "COCO")
+ " dataset images. If you are not"
" applying those, OpenPose cannot obtain the ID from their file names. Error details: "
+ e.what();
error(errorMessage, __LINE__, __FUNCTION__, __FILE__);
return -1;
}
}
CocoJsonSaver::CocoJsonSaver(const std::string& filePathToSave, const PoseModel poseModel,
const bool humanReadable, const int cocoJsonVariants,
const CocoJsonFormat cocoJsonFormat, const int cocoJsonVariant) :
......@@ -97,7 +115,7 @@ namespace op
auto imageId = frameNumber;
if (cocoJsonFormat == CocoJsonFormat::Body)
{
imageId = getLastNumber(imageName);
imageId = getLastNumberWithErrorMessage(imageName, CocoJsonFormat::Body);
// Body
if (numberBodyParts == 23)
indexesInCocoOrder = std::vector<int>{
......@@ -120,7 +138,7 @@ namespace op
// Foot
else if (cocoJsonFormat == CocoJsonFormat::Foot)
{
imageId = getLastNumber(imageName);
imageId = getLastNumberWithErrorMessage(imageName, CocoJsonFormat::Foot);
if (numberBodyParts == 25 || numberBodyParts > 60)
indexesInCocoOrder = std::vector<int>{19,20,21, 22,23,24};
else if (numberBodyParts == 23)
......@@ -160,7 +178,7 @@ namespace op
// Car
else if (cocoJsonFormat == CocoJsonFormat::Car)
{
imageId = getLastNumber(imageName);
imageId = getLastNumberWithErrorMessage(imageName, CocoJsonFormat::Car);
// Car12
if (numberBodyParts == 12)
indexesInCocoOrder = std::vector<int>{0,1,2,3, 4,5,6,7, 8, 8,9,10,11, 11};
......
......@@ -102,9 +102,10 @@ namespace op
}
}
if (!wrapperStructOutput.writeVideo.empty() && producerSharedPtr == nullptr)
error("Writting video is only available if the OpenPose producer is used (i.e."
" producerSharedPtr cannot be a nullptr).",
__LINE__, __FUNCTION__, __FILE__);
error("Writting video (`--write_video`) is only available if the OpenPose producer is used (i.e."
" producerSharedPtr cannot be a nullptr). Otherwise, OpenPose would not know the frame rate"
" of that output video nor whether all the images maintain the same resolution. You might"
" use `--write_images` instead.", __LINE__, __FUNCTION__, __FILE__);
if (wrapperStructPose.poseMode == PoseMode::Disabled && !wrapperStructFace.enable
&& !wrapperStructHand.enable)
error("Body, face, and hand keypoint detectors are disabled. You must enable at least one (i.e,"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册