Skip to content

Commit 1f476d4

Browse files
Exception if input channels != 3
1 parent 6648027 commit 1f476d4

22 files changed

+598
-24
lines changed

.github/issue_template.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ You might select multiple topics, delete the rest:
3333

3434

3535
### Your system configuration
36-
**Operating system** (`lsb_release -a` on Ubuntu):
36+
**Operating system** (`lsb_release -a` in Ubuntu):
3737
**CUDA version** (`cat /usr/local/cuda/version.txt` in most cases):
3838
**cuDNN version**:
39-
**GPU model** (`nvidia-smi`):
39+
**GPU model** (`nvidia-smi` in Ubuntu):
4040
**Caffe version**: Default from OpenPose or custom version.
41-
**OpenCV version**: installed with `apt-get install libopencv-dev` or OpenCV 2.X or OpenCV 3.X.
42-
Generation mode (only for Ubuntu): Makefile + Makefile.config (default) or CMake.
43-
Compiler (`gcc --version` on Ubuntu):
41+
**OpenCV version**: installed with `apt-get install libopencv-dev` (Ubuntu) or default from OpenPose (Windows) or OpenCV 2.X or OpenCV 3.X.
42+
Generation mode (only for Ubuntu): Makefile + Makefile.config (default, Ubuntu) or CMake (Ubuntu, Windows) or Visual Studio (Windows).
43+
Compiler (`gcc --version` in Ubuntu):

doc/demo_overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ In order to learn how to use it, run `./build/examples/openpose/openpose.bin --h
1111
Each flag is divided into flag name, default value, and description.
1212

1313
1. Debugging
14-
- DEFINE_int32(logging_level, 4, "The logging level. Integer in the range [0, 255]. 0 will output any log() message, while 255 will not output any. Current OpenPose library messages are in the range 0-4: 1 for low priority messages and 4 for important ones.");
14+
- DEFINE_int32(logging_level, 3, "The logging level. Integer in the range [0, 255]. 0 will output any log() message, while 255 will not output any. Current OpenPose library messages are in the range 0-4: 1 for low priority messages and 4 for important ones.");
1515
2. Producer
1616
- DEFINE_int32(camera, 0, "The camera index for cv::VideoCapture. Integer in the range [0, 9].");
1717
- DEFINE_string(camera_resolution, "1280x720", "Size of the camera frames to ask for.");

doc/openpose_3d_reconstruction_demo.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,5 +116,5 @@ LIBS += -Wpedantic -Wall -Wextra -Wfatal-errors
116116
## Expected Visual Results
117117
The visual GUI should show 3 screens, the Windows command line or Ubuntu bash terminal, the different cameras 2-D keypoint estimations, and the final 3-D reconstruction, similarly to the following image:
118118
<p align="center">
119-
<img src="media/openpose3d.png", width="720">
119+
<img src="media/openpose3d.png">
120120
</p>

doc/release_notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ OpenPose Library - Release Notes
55

66
## OpenPose 1.0.0rc1
77
1. Initial version, main functionality:
8-
1. Body keypoint detection and rendering on Ubuntu 14 and 16.
8+
1. Body keypoint detection and rendering in Ubuntu 14 and 16.
99
2. It can read an image directory, video or webcam.
1010
3. It can display the results or storing them on disk.
1111

examples/openpose/openpose.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
// Note: This command will show you flags for other unnecessary 3rdparty files. Check only the flags for the OpenPose
4444
// executable. E.g. for `openpose.bin`, look for `Flags from examples/openpose/openpose.cpp:`.
4545
// Debugging
46-
DEFINE_int32(logging_level, 4, "The logging level. Integer in the range [0, 255]. 0 will output any log() message, while"
46+
DEFINE_int32(logging_level, 3, "The logging level. Integer in the range [0, 255]. 0 will output any log() message, while"
4747
" 255 will not output any. Current OpenPose library messages are in the range 0-4: 1 for"
4848
" low priority messages and 4 for important ones.");
4949
// Producer
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
// ------------------------- OpenPose Library Tutorial - Hand Keypoint Detection from JSON Ground-Truth Data -------------------------
2+
// Example to test hands accuracy given ground-truth bounding boxes.
3+
4+
#include <chrono> // `std::chrono::` functions and classes, e.g. std::chrono::milliseconds
5+
#include <gflags/gflags.h> // DEFINE_bool, DEFINE_int32, DEFINE_int64, DEFINE_uint64, DEFINE_double, DEFINE_string
6+
#include <glog/logging.h> // google::InitGoogleLogging
7+
#include <openpose/headers.hpp>
8+
#include "wrapperHandFromJsonTest.hpp"
9+
10+
// For info about the flags, check `examples/openpose/openpose.bin`.
11+
// Debugging
12+
DEFINE_int32(logging_level, 3, "");
13+
// Producer
14+
DEFINE_string(image_dir, "", "");
15+
DEFINE_string(hand_ground_truth, "", "");
16+
// OpenPose
17+
DEFINE_string(model_folder, "models/", "");
18+
DEFINE_int32(num_gpu, -1, "");
19+
DEFINE_int32(num_gpu_start, 0, "");
20+
// OpenPose Hand
21+
DEFINE_bool(hand, true, "");
22+
DEFINE_string(hand_net_resolution, "368x368", "");
23+
DEFINE_int32(hand_scale_number, 1, "");
24+
DEFINE_double(hand_scale_range, 0.4, "");
25+
DEFINE_bool(hand_tracking, false, "");
26+
// Display
27+
DEFINE_bool(no_display, false, "");
28+
// Result Saving
29+
DEFINE_string(write_keypoint_json, "", "");
30+
31+
int handFromJsonTest()
32+
{
33+
// logging_level
34+
op::check(0 <= FLAGS_logging_level && FLAGS_logging_level <= 255, "Wrong logging_level value.", __LINE__, __FUNCTION__, __FILE__);
35+
op::ConfigureLog::setPriorityThreshold((op::Priority)FLAGS_logging_level);
36+
// op::ConfigureLog::setPriorityThreshold(op::Priority::None); // To print all logging messages
37+
38+
op::log("Starting pose estimation demo.", op::Priority::High);
39+
const auto timerBegin = std::chrono::high_resolution_clock::now();
40+
41+
// Applying user defined configuration - Google flags to program variables
42+
// handNetInputSize
43+
const auto handNetInputSize = op::flagsToPoint(FLAGS_hand_net_resolution, "368x368 (multiples of 16)");
44+
// producerType
45+
const auto producerSharedPtr = op::flagsToProducer(FLAGS_image_dir, "", 0);
46+
op::log("", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
47+
48+
// OpenPose wrapper
49+
op::log("Configuring OpenPose wrapper.", op::Priority::Low, __LINE__, __FUNCTION__, __FILE__);
50+
op::WrapperHandFromJsonTest<std::vector<op::Datum>> opWrapper;
51+
// Pose configuration (use WrapperStructPose{} for default and recommended configuration)
52+
op::WrapperStructPose wrapperStructPose{op::flagsToPoint("656x368"), op::flagsToPoint("1280x720"),
53+
op::ScaleMode::InputResolution, FLAGS_num_gpu, FLAGS_num_gpu_start};
54+
wrapperStructPose.modelFolder = FLAGS_model_folder;
55+
// Hand configuration (use op::WrapperStructHand{} to disable it)
56+
const op::WrapperStructHand wrapperStructHand{FLAGS_hand, handNetInputSize, FLAGS_hand_scale_number,
57+
(float)FLAGS_hand_scale_range, FLAGS_hand_tracking,
58+
op::flagsToRenderMode(1)};
59+
// Configure wrapper
60+
opWrapper.configure(wrapperStructPose, wrapperStructHand, producerSharedPtr, FLAGS_hand_ground_truth, FLAGS_write_keypoint_json,
61+
!FLAGS_no_display);
62+
63+
// Start processing
64+
op::log("Starting thread(s)", op::Priority::High);
65+
opWrapper.exec(); // It blocks this thread until all threads have finished
66+
67+
// Measuring total time
68+
const auto now = std::chrono::high_resolution_clock::now();
69+
const auto totalTimeSec = (double)std::chrono::duration_cast<std::chrono::nanoseconds>(now-timerBegin).count() * 1e-9;
70+
const auto message = "Real-time pose estimation demo successfully finished. Total time: " + std::to_string(totalTimeSec) + " seconds.";
71+
op::log(message, op::Priority::High);
72+
73+
return 0;
74+
}
75+
76+
int main(int argc, char *argv[])
77+
{
78+
// Initializing google logging (Caffe uses it for logging)
79+
google::InitGoogleLogging("handFromJsonTest");
80+
81+
// Parsing command line flags
82+
gflags::ParseCommandLineFlags(&argc, &argv, true);
83+
84+
// Running handFromJsonTest
85+
return handFromJsonTest();
86+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Script for internal use. We might completely change it continuously and we will not answer questions about it.
2+
3+
# Clear terminal screen
4+
clear && clear
5+
6+
7+
8+
HAND_TESTING_FOLDER="/media/posefs3b/Users/gines/openpose_training/dataset/hand_testing/5_keypointJson/"
9+
IMAGES_FOLDER=${HAND_TESTING_FOLDER}"0_images/"
10+
IMAGES_BB_FOLDER=${HAND_TESTING_FOLDER}"3_images_bounding_box"
11+
IMAGES_BB_FOLDER=${HAND_TESTING_FOLDER}"4_hand_detections"
12+
KEYPOINT_JSON_FOLDER=${HAND_TESTING_FOLDER}"5_keypointJson/"
13+
14+
SCALES=6
15+
SUFFIX="_test${SCALES}"
16+
17+
18+
19+
# Given bounding box
20+
HAND_RESULTS_FOLDER_BB=${KEYPOINT_JSON_FOLDER}"hand_keypoints_estimated"${SUFFIX}"_bounding_box"
21+
echo "Output on ${HAND_RESULTS_FOLDER_BB}"
22+
rm -rf $HAND_RESULTS_FOLDER_BB
23+
# 1 scale
24+
./build/examples/tests/handFromJsonTest.bin \
25+
--hand_scale_number ${SCALES} --hand_scale_range 0.4 \
26+
--image_dir ${IMAGES_BB_FOLDER} \
27+
--hand_ground_truth ${IMAGES_BB_FOLDER} \
28+
--write_keypoint_json $HAND_RESULTS_FOLDER_BB \
29+
--no_display
30+
31+
32+
33+
# No bounding box
34+
HAND_RESULTS_FOLDER_NO_BB=${KEYPOINT_JSON_FOLDER}"hand_keypoints_estimated"${SUFFIX}
35+
echo "Output on ${HAND_RESULTS_FOLDER_NO_BB}"
36+
rm -rf $HAND_RESULTS_FOLDER_NO_BB
37+
# 1 scale
38+
./build/examples/openpose/openpose.bin \
39+
--hand logging_level 3 \
40+
--hand_scale_number ${SCALES} --hand_scale_range 0.4 \
41+
--image_dir ${IMAGES_FOLDER} \
42+
--write_keypoint_json $HAND_RESULTS_FOLDER_NO_BB \
43+
--no_display
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Script for internal use. We might completely change it continuously and we will not answer questions about it.
2+
3+
# USAGE EXAMPLE
4+
# clear && clear && make all -j24 && bash ./examples/tests/pose_accuracy_coco_test.sh
5+
6+
# # Go back to main folder
7+
# cd ../../
8+
9+
# Write COCO-format JSON
10+
# Note: `--frame_last 3558` --> total = 3559 frames
11+
# Last id:
12+
# ID 20671 <--> #frames = 1471 --> ~ 1.5 min at 15fps
13+
# ID 50006 <--> #frames = 3559 --> ~ 4 min at 15fps
14+
15+
# 1 scale
16+
./build/examples/openpose/openpose.bin --image_dir "/home/gines/devel/images/val2014" --write_coco_json ../evaluation/coco/results/openpose/1.json --no_display --render_pose 0 --frame_last 3558
17+
18+
# # 3 scales
19+
# ./build/examples/openpose/openpose.bin --image_dir "/home/gines/devel/images/val2014" --write_coco_json ../evaluation/coco/results/openpose/1_3.json --no_display --render_pose 0 --scale_number 3 --scale_gap 0.25 --frame_last 3558
20+
21+
# # 4 scales
22+
# ./build/examples/openpose/openpose.bin --num_gpu 1 --image_dir "/home/gines/devel/images/val2014" --write_coco_json ../evaluation/coco/results/openpose/1_4.json --no_display --render_pose 0 --scale_number 4 --scale_gap 0.25 --net_resolution "1312x736" --frame_last 3558
23+
24+
# Debugging - Rendered frames saved
25+
# ./build/examples/openpose/openpose.bin --image_dir "/home/gines/devel/images/val2014" --write_images ../evaluation/coco/results/openpose/frameOutput --no_display
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Script for internal use. We might completely change it continuously and we will not answer questions about it.
2+
3+
# # Go back to main folder
4+
# cd ../../
5+
6+
# Performance results
7+
PROTOTXT_PATH=/home/gines/Dropbox/Perceptual_Computing_Lab/openpose/openpose/models/pose/coco/pose_deploy_linevec.prototxt
8+
9+
gedit $0
10+
# First: Add 656 x 368 as input_dim in:
11+
gedit $PROTOTXT_PATH
12+
./3rdparty/caffe/build/tools/caffe time -model $PROTOTXT_PATH -gpu 0 -phase TEST
13+
gedit $PROTOTXT_PATH
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Script for internal use. We might completely change it continuously and we will not answer questions about it.
2+
3+
# # Go back to main folder
4+
# cd ../../
5+
6+
# Re-build
7+
clear && clear && make all -j12
8+
9+
# Performance results (~1400)
10+
./build/examples/openpose/openpose.bin --video soccer.mp4 --frame_last 1500
11+
# Including 2nd graphics card (~3500)
12+
# ./build/examples/openpose/openpose.bin --video soccer.mp4 --frame_last 3750

0 commit comments

Comments
 (0)