-
Notifications
You must be signed in to change notification settings - Fork 4
Null pointer exception when creating graphs #3
Comments
Hi! Thank you for providing the console error text in your edit; that helped clue me in. I think the issue here is that you are literally passing the word In this repo's example Lines 76 to 144 in d682b12
|
Thanks a lot for the fast answer. Oops! Sorry I pasted the wrong error and corrected my comment as you answered it. Edited my original comment with proper error |
No problem. I'm no expert, so I googled your access violation error. It seems that this occurs mostly when something which shouldn't be null is, in fact, null. This makes sense, as My guess is that Line 147 in d682b12
into separate parts: mediapipe::LibMP* face_mesh = mediapipe::LibMP::Create(graph, "input_video"); // create LibMP object
std::cout << "LibMP object address: " << face_mesh << std::endl; // address SHOULD NOT be nullptr! What do you see if you do this? What does your whole file look like, too? The more info and context you can provide, the better. |
My cpp file essentially the same as main.cpp from the libmp example. I'm simply building using VS instead of cmake. I replaced Line 147 in d682b12
mediapipe::LibMP* face_mesh = mediapipe::LibMP::Create(graph, "input_video"); // create LibMP object I have copied the bazel-bin/mediapipe modules and models to the same folder as my executable as well as the openCV dll and downloaded the .tflites to my models folder. Could I be missing something regarding my folder structure? Could I be using the wrong .tflites, the wrong version of mediapipe or the wrong version of protobuf? |
I unfortunately haven't used anything other than CMake, so I'm not sure. Are you sure that your manual copies are identical to what CMake accomplishes in the following lines? Lines 66 to 88 in d682b12
This is the folder structure of my build/Release folder after building with CMake:
My mediapipe/models folder contains two .tflite files ( |
I had the same error message and I resolved it. In my case, the cause was that When complinging mediapipe using VS2022, the following error occurred
So I commented out some lines of the source code following the answer: Then mediapipe complied successfully. However, as it turned out, the same runtime error as the original poster occurred. My solution was to complie |
I'm not sure this is a proper place, but I want to express my gratitude to rajkundu, the author of this repository. Thank you so much. You are my savior. It would have been impossible to integrate MediaPipe to my project without help of this repository. Just out of curiosity, how did you do that? Google does not provide any method to use MediaPipe as a C++ library. You can only use it with Bazel, which is extreamly inconvenient. A tutorial on MediaPipe I found on the internet says:
As I see it, it would take tremendus effort and expertise to build a C++ library out of MediaPipe by manually examining this monster, the orignal mediapipe project repository. The code structure is way too complex to comprehend, build script is involved with thousands of C++ sources. Google does not provide any appropriate tutorial. It is simply impossible for me. How did you do that? |
@donghyunismyname That is very kind of you to say - thank you! However, pretty much all credit goes to @asprecic. He is the one who figured out how to compile MediaPipe into a shared library using Bazel and kindly shared I completely agree with you - MediaPipe is a monster, and I am a mere mortal like you. I honestly have no idea how @asprecic figured this all out, but I am just as thankful as you are that he did. LibMP is far from perfect and quite hacky, but it filled enough holes for me to get my work done. I hope that it helps as many others as possible, and I do apologize (on behalf of Google, actually...) for the places that it falls short. In any case, thank you very, very much, @asprecic!! 😄 |
@rajkundu in order to narrow everything down, I rebuilt the libmp dll with the only difference being my python path in Everything builds like it did, and still get the same error/crash at the same line. Line 147 in d682b12
Exception thrown at 0x00007FFA5DCEA5B5 (libmp.dll) in TestMediaPipe.exe: 0xC0000005: Access violation reading location 0x0000000000000020.
Is there any way I can enable more logs that can help me troubleshoot the error further? |
@stRodeo I'm setting up a new machine from scratch for work, and I'm trying to build LibMP on it as well. I ran into google-ai-edge/mediapipe/issues/4060. Furthermore, I'm having the same crash as you when trying to create graphs. Perhaps this is related to that issue? The main difference between machines is that I'm running the latest version of VS 2022 Build Tools on my new machine (14.5.0), whereas I had 14.3.5 on my old machine. I am not sure how to enable any extra logs, but I'll poke around and let you know what I find over the next few days. |
@stRodeo This seems to be a VS 2022 17.4+ issue - see google-ai-edge/mediapipe#3851 and google-ai-edge/mediapipe#4060. Thank you very much, @donghyunismyname, for sharing google-ai-edge/mediapipe#4060 and helping us get to the bottom of this issue. As suggested, using older versions of VS work - even VS 2022 17.3.7 works, just not 17.4+. The current best workaround, in my opinion, is to use an older version of VS. If I were more skilled at C++, perhaps I could figure out how to work around MediaPipe's use of static data member templates, but I unfortunately am not. @donghyunismyname @stRodeo I have filed an issue with Microsoft here. If you can, please consider upvoting the issue on Microsoft's forum to ensure that we can build MediaPipe with future versions of VS! |
I can confirm that the underlying bug in VS 2022 and has been fixed in version 17.6 Preview 1. So, the permanent solution is to avoid using VS 2022 17.4.x & 17.5.x and either use VS 2022 <=17.3 or >=17.6 upon release. |
Hello,
I built the example using visual studio and everything compiles. However, when I launch the executable I have the following error
at the line 147 when graphs are created:
Exception thrown at 0x00007FFA5DCEA5B5 (libmp.dll) in TestMediaPipe.exe: 0xC0000005: Access violation reading location 0x0000000000000020.
There are no error from the console. It's just blank
I'm not really sure where to look and how to debug the following error. Help would be much appreciated!
Thanks a lot
The text was updated successfully, but these errors were encountered: