google-ai-edge / mediapipe

Cross-platform, customizable ML solutions for live and streaming media.
https://ai.google.dev/edge/mediapipe
Apache License 2.0
26.86k stars 5.09k forks source link

Hand Detection Bounding Box Python #1507

Closed faldisulistiawan closed 3 years ago

faldisulistiawan commented 3 years ago

Hello.

I want to use the Hands Solution API Python for drawing bounding box. I already saw the solution of #1390 but that only draws the bounding box according to the palm_detections bbox coordinates, not the whole hand. The hand_rects output is not available for the Python package (as far as i know. please correct me if i'm wrong).

Is there a way for me to draw the bounding box of the whole hand using Python?

Thanks.

jiuqiant commented 3 years ago

Yes, there is a way to do this. But, it requires you to build the python wheel locally since there is a BUILD file change.

Step 1. Modify the source code.

In mediapipe/python/BUILD, register the rect proto. (We will have this fix in the coming release)

--- a/mediapipe/python/BUILD
+++ b/mediapipe/python/BUILD
@@ -47,6 +47,7 @@ pybind_extension(
         "//mediapipe/framework/formats:classification_registration",
         "//mediapipe/framework/formats:detection_registration",
         "//mediapipe/framework/formats:landmark_registration",
+       "//mediapipe/framework/formats:rect_registration",
     ],
 )

In hands.py, you can add hand_rects into the outputs list.

--- a/mediapipe/python/solutions/hands.py
+++ b/mediapipe/python/solutions/hands.py
@@ -142,7 +142,7 @@ class Hands(SolutionBase):
             'handlandmarkcpu__ThresholdingCalculator.threshold':
                 min_tracking_confidence,
         },
-        outputs=['multi_hand_landmarks', 'multi_handedness'])
+        outputs=['multi_hand_landmarks', 'multi_handedness', 'hand_rects'])

   def process(self, image: np.ndarray) -> NamedTuple:
     """Processes an RGB image and returns the hand landmarks and handedness of each detected hand.

Step 2.Build the python wheel locally by following https://google.github.io/mediapipe/getting_started/python.html#building-mediapipe-python-package

Step 3. Modify your example code to get the hand bbox.

results = hands.process(cv2.cvtColor(image, cv2.COLOR_BGR2RGB))
for rect in results.hand_rects:
  print(rect)

Then, you will get something like:

x_center: 0.7076132893562317
y_center: 0.4579037129878998
height: 1.0035101175308228
width: 0.6690067052841187
rotation: -0.29718053340911865

x_center: 0.27738717198371887
y_center: 0.4893067479133606
height: 0.9825395941734314
width: 0.6550264358520508
rotation: 0.28020596504211426
faldisulistiawan commented 3 years ago

@jiuqiant It worked! but the bounding box is wider than i expected. Thank you so much!

faldisulistiawan commented 3 years ago

@jiuqiant What is the difference between hand_rects and hand_rects_from_palm_detections? And is there a plan on creating a complete API Documentation for Python API?

fawad1989 commented 3 years ago

Screenshot from 2021-05-07 17-16-22

my build is failing on the last step i.e. python3 setup.py install --link-opencv. Also attached is the screenshot. Please Help....

jiuqiant commented 3 years ago

Screenshot from 2021-05-07 17-16-22

my build is failing on the last step i.e. python3 setup.py install --link-opencv. Also attached is the screenshot. Please Help....

Option 1. Fix your opencv installation and settings: https://github.com/google/mediapipe/blob/master/docs/getting_started/troubleshooting.md#incorrect-mediapipe-opencv-config

Option 2. Do python3 setup.py install, which builds opencv from the source code and takes much longer time.

fawad1989 commented 3 years ago

Screenshot from 2021-05-08 13-19-12

I installed opencv from source. all the instructions worked and i am dead in the water at the last step. i am not sure what i am doing wrong... Any help is appreciated....

fawad1989 commented 3 years ago

[ 80%] Building CXX object modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/loadsave.cpp.o In file included from /usr/include/OpenEXR/ImfChromaticities.h:46:0, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/758/execroot/mediapipe/external/opencv/modules/imgcodecs/src/grfmt_exr.hpp:52, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/758/execroot/mediapipe/external/opencv/modules/imgcodecs/src/grfmts.hpp:53, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/758/execroot/mediapipe/external/opencv/modules/imgcodecs/src/loadsave.cpp:47: /usr/include/OpenEXR/ImathVec.h:228:34: error: ISO C++1z does not allow dynamic exception specifications const Vec2 & normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:232:37: error: ISO C++1z does not allow dynamic exception specifications Vec2 normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:440:34: error: ISO C++1z does not allow dynamic exception specifications const Vec3 & normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:444:37: error: ISO C++1z does not allow dynamic exception specifications Vec3 normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:622:37: error: ISO C++1z does not allow dynamic exception specifications const Vec4 & normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:626:44: error: ISO C++1z does not allow dynamic exception specifications Vec4 normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:714:30: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:723:37: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:738:28: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:747:35: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:762:30: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:771:37: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:786:28: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:795:35: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:809:30: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:818:37: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:833:28: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:842:35: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:1212:26: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizeExc () throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathVec.h:1249:33: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizedExc () const throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathVec.h:1704:26: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizeExc () throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathVec.h:1743:33: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizedExc () const throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathVec.h:2109:26: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizeExc () throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathVec.h:2150:33: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizedExc () const throw (IEX_NAMESPACE::MathExc) ^~~~~ In file included from /usr/include/OpenEXR/ImfChromaticities.h:47:0, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/758/execroot/mediapipe/external/opencv/modules/imgcodecs/src/grfmt_exr.hpp:52, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/758/execroot/mediapipe/external/opencv/modules/imgcodecs/src/grfmts.hpp:53, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/758/execroot/mediapipe/external/opencv/modules/imgcodecs/src/loadsave.cpp:47: /usr/include/OpenEXR/ImathMatrix.h:266:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:269:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:272:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:275:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:640:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:643:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:646:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:649:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:1433:38: error: ISO C++1z does not allow dynamic exception specifications Matrix33::gjInvert (bool singExc) throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:1441:45: error: ISO C++1z does not allow dynamic exception specifications Matrix33::gjInverse (bool singExc) const throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:1545:36: error: ISO C++1z does not allow dynamic exception specifications Matrix33::invert (bool singExc) throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:1553:43: error: ISO C++1z does not allow dynamic exception specifications Matrix33::inverse (bool singExc) const throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:2702:38: error: ISO C++1z does not allow dynamic exception specifications Matrix44::gjInvert (bool singExc) throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:2710:45: error: ISO C++1z does not allow dynamic exception specifications Matrix44::gjInverse (bool singExc) const throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:2814:36: error: ISO C++1z does not allow dynamic exception specifications Matrix44::invert (bool singExc) throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:2822:43: error: ISO C++1z does not allow dynamic exception specifications Matrix44::inverse (bool singExc) const throw (IEX_NAMESPACE::MathExc) ^~~~~ modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/build.make:81: recipe for target 'modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/loadsave.cpp.o' failed make[2]: [modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/loadsave.cpp.o] Error 1 CMakeFiles/Makefile2:1645: recipe for target 'modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/all' failed make[1]: [modules/imgcodecs/CMakeFiles/opencvimgcodecs.dir/all] Error 2 Makefile:181: recipe for target 'all' failed make: *** [all] Error 2 ____ END BUILD LOGS _____ rules_foreign_cc: Build wrapper script location: bazel-out/k8-opt/bin/third_party/opencv_cmake_scripts/CMake_wrapper_script.sh rules_foreign_cc: Build script location: bazel-out/k8-opt/bin/third_party/opencv_cmake_scripts/CMake_script.sh rules_foreign_cc: Build log location: bazel-out/k8-opt/bin/third_party/opencv_cmake_logs/CMake.log

Target //mediapipe/modules/face_detection:face_detection_front_cpu failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 715.555s, Critical Path: 676.00s INFO: 2609 processes: 123 internal, 2486 linux-sandbox. FAILED: Build did NOT complete successfully

The error i am getting, I built opencv from source, installed bazelisk, ran through the installation steps. failed at python3 setup.py gen_protos, skipped that steps and ran option 2 as per your recommendation and i got the above errors. Help is appreciated....

fawad1989 commented 3 years ago

Screenshot from 2021-05-07 17-16-22 my build is failing on the last step i.e. python3 setup.py install --link-opencv. Also attached is the screenshot. Please Help....

Option 1. Fix your opencv installation and settings: https://github.com/google/mediapipe/blob/master/docs/getting_started/troubleshooting.md#incorrect-mediapipe-opencv-config

Option 2. Do python3 setup.py install, which builds opencv from the source code and takes much longer time.

Good Day...

Hope you are well.

Screenshot from 2021-05-10 10-41-43

it was stuck at this point for a long time and finally gave out the error as below. [ 80%] Building CXX object modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/loadsave.cpp.o In file included from /usr/include/OpenEXR/ImfChromaticities.h:46:0, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/3045/execroot/mediapipe/external/opencv/modules/imgcodecs/src/grfmt_exr.hpp:52, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/3045/execroot/mediapipe/external/opencv/modules/imgcodecs/src/grfmts.hpp:53, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/3045/execroot/mediapipe/external/opencv/modules/imgcodecs/src/loadsave.cpp:47: /usr/include/OpenEXR/ImathVec.h:228:34: error: ISO C++1z does not allow dynamic exception specifications const Vec2 & normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:232:37: error: ISO C++1z does not allow dynamic exception specifications Vec2 normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:440:34: error: ISO C++1z does not allow dynamic exception specifications const Vec3 & normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:444:37: error: ISO C++1z does not allow dynamic exception specifications Vec3 normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:622:37: error: ISO C++1z does not allow dynamic exception specifications const Vec4 & normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:626:44: error: ISO C++1z does not allow dynamic exception specifications Vec4 normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:714:30: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:723:37: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:738:28: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:747:35: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:762:30: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:771:37: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:786:28: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:795:35: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:809:30: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:818:37: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:833:28: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizeExc () throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:842:35: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizedExc () const throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathVec.h:1212:26: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizeExc () throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathVec.h:1249:33: error: ISO C++1z does not allow dynamic exception specifications Vec2::normalizedExc () const throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathVec.h:1704:26: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizeExc () throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathVec.h:1743:33: error: ISO C++1z does not allow dynamic exception specifications Vec3::normalizedExc () const throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathVec.h:2109:26: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizeExc () throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathVec.h:2150:33: error: ISO C++1z does not allow dynamic exception specifications Vec4::normalizedExc () const throw (IEX_NAMESPACE::MathExc) ^~~~~ In file included from /usr/include/OpenEXR/ImfChromaticities.h:47:0, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/3045/execroot/mediapipe/external/opencv/modules/imgcodecs/src/grfmt_exr.hpp:52, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/3045/execroot/mediapipe/external/opencv/modules/imgcodecs/src/grfmts.hpp:53, from /home/fawad/.cache/bazel/_bazel_fawad/bb37fa2a8c8fd8a318b4bccd3be2f22f/sandbox/linux-sandbox/3045/execroot/mediapipe/external/opencv/modules/imgcodecs/src/loadsave.cpp:47: /usr/include/OpenEXR/ImathMatrix.h:266:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:269:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:272:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:275:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:640:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:643:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:646:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:649:25: error: ISO C++1z does not allow dynamic exception specifications throw (IEX_NAMESPACE::MathExc); ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:1433:38: error: ISO C++1z does not allow dynamic exception specifications Matrix33::gjInvert (bool singExc) throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:1441:45: error: ISO C++1z does not allow dynamic exception specifications Matrix33::gjInverse (bool singExc) const throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:1545:36: error: ISO C++1z does not allow dynamic exception specifications Matrix33::invert (bool singExc) throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:1553:43: error: ISO C++1z does not allow dynamic exception specifications Matrix33::inverse (bool singExc) const throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:2702:38: error: ISO C++1z does not allow dynamic exception specifications Matrix44::gjInvert (bool singExc) throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:2710:45: error: ISO C++1z does not allow dynamic exception specifications Matrix44::gjInverse (bool singExc) const throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:2814:36: error: ISO C++1z does not allow dynamic exception specifications Matrix44::invert (bool singExc) throw (IEX_NAMESPACE::MathExc) ^~~~~ /usr/include/OpenEXR/ImathMatrix.h:2822:43: error: ISO C++1z does not allow dynamic exception specifications Matrix44::inverse (bool singExc) const throw (IEX_NAMESPACE::MathExc) ^~~~~ modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/build.make:81: recipe for target 'modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/loadsave.cpp.o' failed make[2]: [modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/src/loadsave.cpp.o] Error 1 CMakeFiles/Makefile2:1645: recipe for target 'modules/imgcodecs/CMakeFiles/opencv_imgcodecs.dir/all' failed make[1]: [modules/imgcodecs/CMakeFiles/opencvimgcodecs.dir/all] Error 2 Makefile:181: recipe for target 'all' failed make: *** [all] Error 2 ____ END BUILD LOGS _____ rules_foreign_cc: Build wrapper script location: bazel-out/k8-opt/bin/third_party/opencv_cmake_scripts/CMake_wrapper_script.sh rules_foreign_cc: Build script location: bazel-out/k8-opt/bin/third_party/opencv_cmake_scripts/CMake_script.sh rules_foreign_cc: Build log location: bazel-out/k8-opt/bin/third_party/opencv_cmake_logs/CMake.log

Target //mediapipe/modules/face_detection:face_detection_front_cpu failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 533.480s, Critical Path: 489.08s INFO: 82 processes: 4 internal, 78 linux-sandbox. FAILED: Build did NOT complete successfully


I have followed all the process to the letter and it fails. Any guidance is appreciated...

jiuqiant commented 3 years ago

I don't have OpenEXR locally so I didn't run into this issue before... You probably can try the following:

diff --git a/third_party/BUILD b/third_party/BUILD
index 654f0cb..4139add 100644
--- a/third_party/BUILD
+++ b/third_party/BUILD
@@ -113,6 +113,7 @@ cmake_external(
         "WITH_PNG": "ON",
         "WITH_TIFF": "ON",
         "WITH_WEBP": "OFF",
+        "WITH_OPENEXR": "OFF"
         # Optimization flags
         "CV_ENABLE_INTRINSICS": "ON",
         "WITH_EIGEN": "ON",
naveedkhan1998 commented 2 years ago

@jiuqiant It worked! but the bounding box is wider than i expected. Thank you so much!

can you tell me how we can draw the boundary boxes from this data.

20XYSong commented 2 years ago

I wonder what does rotation mean? cos or sin of which angle?

RyanPaulMcKenna commented 10 months ago

@jiuqiant provided a very useful answer but the link to building from source was outdated, here is the new one. https://github.com/google/mediapipe/blob/master/docs/getting_started/python.md

Jamxscape commented 6 months ago
x_center: 0.7076132893562317
y_center: 0.4579037129878998
height: 1.0035101175308228
width: 0.6690067052841187
rotation: -0.29718053340911865

x_center: 0.27738717198371887
y_center: 0.4893067479133606
height: 0.9825395941734314
width: 0.6550264358520508
rotation: 0.28020596504211426

I have a question: What do width, height, and rotation refer to specifically? Are they proportional to the width or height of the image? If so, why do width and height often appear to be greater than 1?