提交 72778112 编写于 作者: G gineshidalgo99

COCO-tunned version

上级 62ad0737
......@@ -22,7 +22,7 @@ Check [doc/installation.md#calibration-module](./installation.md#calibration-mod
## Quick Start
Note: This example will assume that the target are 3 Flir/Point Grey cameras, but it can be generalized to any camera model.
Note: In order to maximize calibration quality, **do not reuse the same video sequence for both intrinsic and extrinsic parameter estimation**. The intrinsic parameter calibration should be run camera by camera, where each recorded video sequence should be focused in covering all regions of the camera view and repeated from several distances. In the extrinsic sequence, this video sequence should be focused in making sure that the checkboard is visible from at least 2 cameras at the time. So for 3-camera calibration, you would need 1 video sequence per camera as well as a final sequence for the extrinsic parameter calibration.
1. Distortion and intrinsic parameter calibration:
1. Run OpenPose and save images for your desired camera. Use a grid (chessboard) pattern and move around all the image area.
......@@ -41,10 +41,12 @@ Note: This example will assume that the target are 3 Flir/Point Grey cameras, bu
```
./build/examples/calibration/calibration.bin --help
```
3. Extract and save the intrinsic parameters:
```
./build/examples/calibration/calibration.bin --mode 1 --grid_square_size_mm 40.0 --grid_number_inner_corners "9x5" --camera_serial_number 18079958 --intrinsics_image_dir {intrinsic_images_folder_path}
```
4. In this case, the intrinsic parameters would have been generated as {intrinsic_images_folder_path}/18079958.xml.
5. Run steps 1-4 for each one of your cameras.
6. After you calibrate the camera intrinsics, when you run OpenPose with those cameras, you should see the lines in real-life to be (almost) perfect lines in the image. Otherwise, the calibration was not good. Try checking straight patterns such us wall corners or ceilings:
......@@ -54,7 +56,8 @@ Note: This example will assume that the target are 3 Flir/Point Grey cameras, bu
# Without distortion (lines should look as lines)
./build/examples/openpose/openpose.bin --num_gpu 0 --flir_camera --flir_camera_index 0
```
7. Full example for 4 flir cameras:
7. Full example for 4 Flir/Point Grey cameras:
```
# Get images for calibration
./build/examples/openpose/openpose.bin --num_gpu 0 --frame_keep_distortion --flir_camera --flir_camera_index 0 --write_images ~/Desktop/intrinsics_0
......@@ -78,4 +81,6 @@ Note: This example will assume that the target are 3 Flir/Point Grey cameras, bu
## Using a Different Camera Brand
You can use any camera brand, check [doc/3d_reconstruction_demo.md#using-a-different-camera-brand](./3d_reconstruction_demo.md#using-a-different-camera-brand).
If you plan to use the calibration tool without using OpenPose, you can manually save a video sequence of your desired camera into each of the camera image folders (i.e., in the above example, the `~/Desktop/intrinsics_0`, `~/Desktop/intrinsics_1`, etc. folders).
If you wanna eventually run that camera with OpenPose, check [doc/3d_reconstruction_demo.md#using-a-different-camera-brand](./3d_reconstruction_demo.md#using-a-different-camera-brand).
......@@ -11,7 +11,7 @@ JSON_FOLDER=../evaluation/coco_val_jsons/
OP_BIN=./build/examples/openpose/openpose.bin
# 1 scale
$OP_BIN --image_dir $IMAGE_FOLDER --write_coco_foot_json ${JSON_FOLDER}1_foot.json --display 0 --render_pose 0 --model_pose BODY_25
$OP_BIN --model_pose BODY_25 --image_dir $IMAGE_FOLDER --write_coco_foot_json ${JSON_FOLDER}1_foot.json --display 0 --render_pose 0
# # 4 scales
# $OP_BIN --image_dir $IMAGE_FOLDER --write_coco_foot_json ${JSON_FOLDER}1_4_foot.json --display 0 --render_pose 0 --model_pose BODY_25 --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736"
# $OP_BIN --model_pose BODY_25 --image_dir $IMAGE_FOLDER --write_coco_foot_json ${JSON_FOLDER}1_4_foot.json --display 0 --render_pose 0 --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736"
......@@ -92,11 +92,12 @@ namespace op
for (auto bodyPart = 0u ; bodyPart < indexesInCocoOrder.size() ; bodyPart++)
{
const auto finalIndex = 3*(person*numberBodyParts + indexesInCocoOrder.at(bodyPart));
mJsonOfstream.plainText(poseKeypoints[finalIndex]);
const auto validPoint = (poseKeypoints[finalIndex+2] > 0.f);
mJsonOfstream.plainText(validPoint ? poseKeypoints[finalIndex] : -1.f);
mJsonOfstream.comma();
mJsonOfstream.plainText(poseKeypoints[finalIndex+1]);
mJsonOfstream.plainText(validPoint ? poseKeypoints[finalIndex+1] : -1.f);
mJsonOfstream.comma();
mJsonOfstream.plainText((poseKeypoints[finalIndex+2] > 0.f ? 1 : 0));
mJsonOfstream.plainText(validPoint ? 1 : 0);
// mJsonOfstream.plainText(poseKeypoints[finalIndex+2]); // For debugging
if (bodyPart < indexesInCocoOrder.size() - 1u)
mJsonOfstream.comma();
......
......@@ -328,21 +328,28 @@ namespace op
// Default Model Parameters
// They might be modified on running time
// const bool COCO_CHALLENGE = true;
const bool COCO_CHALLENGE = false;
const auto nmsT = (COCO_CHALLENGE ? 0.04f : 0.05f);
const std::array<float, (int)PoseModel::Size> POSE_DEFAULT_NMS_THRESHOLD{
0.05f, 0.6f, 0.3f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f
nmsT, 0.6f, 0.3f, nmsT, nmsT, nmsT, nmsT, nmsT, nmsT, nmsT, nmsT
};
const auto minAT = (COCO_CHALLENGE ? 0.75f : 0.95f); // Matlab version: 0.85f
const std::array<float, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_INTER_MIN_ABOVE_THRESHOLD{
0.95f, 0.95f, 0.95f, 0.95f, 0.95f, 0.95f, 0.95f, 0.95f, 0.95f, 0.95f, 0.95f
minAT, minAT, minAT, minAT, minAT, minAT, minAT, minAT, minAT, minAT, minAT
// 0.85f, 0.85f, 0.85f, 0.85f, 0.85f, 0.85f // Matlab version
};
const auto conIT = (COCO_CHALLENGE ? 0.01f : 0.05f);
const std::array<float, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_INTER_THRESHOLD{
0.05f, 0.01f, 0.01f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f, 0.05f
conIT, 0.01f, 0.01f, conIT, conIT, conIT, conIT, conIT, conIT, conIT, conIT
};
const auto minSC = (COCO_CHALLENGE ? 2 : 3);
const std::array<unsigned int, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_MIN_SUBSET_CNT{
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3
minSC, minSC, minSC, minSC, minSC, minSC, minSC, minSC, minSC, minSC, minSC
};
const auto minSS = (COCO_CHALLENGE ? 0.05f : 0.4f);
const std::array<float, (int)PoseModel::Size> POSE_DEFAULT_CONNECT_MIN_SUBSET_SCORE{
0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f
minSS, minSS, minSS, minSS, minSS, minSS, minSS, minSS, minSS, minSS, minSS
// 0.2f, 0.4f, 0.4f, 0.4f, 0.4f, 0.4f // Matlab version
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册