Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

posts/onnx-directml-unity-tutorial/part-1/ #36

Open
utterances-bot opened this issue May 15, 2023 · 4 comments
Open

posts/onnx-directml-unity-tutorial/part-1/ #36

utterances-bot opened this issue May 15, 2023 · 4 comments

Comments

@utterances-bot
Copy link

Christian Mills - Real-Time Object Detection in Unity With ONNX and DirectML Pt. 1

Create a dynamic link library (DLL) file in Visual Studio to perform object detection with a YOLOX model using ONNX Runtime and DirectML.

https://christianjmills.com/posts/onnx-directml-unity-tutorial/part-1/

Copy link

Hi there,
thanks a lot for this amazing tutorial!
I followed all the steps but I got the following error in the building section:
Error LNK1107: invalid or corrupt file: cannot read at 0x1B2 test_YOLOX_DLL C:\opencv\build\x64\vc15\lib\OpenCVConfig-version.cmake 1

do you have any idea how I can solve this issue?
even I tried to install OpenCV with Cmake, but it wasn't help

Copy link
Owner

Hi @SoroorMa,

Thank you for reporting this issue. The source of the problem is that I mixed up the folders for different OpenCV versions when writing the tutorial. I covered downloading OpenCV 4.6.0 in the beginning, but I used OpenCV 4.5.2 in the Visual Studio project.

Since you already have OpenCV 4.6.0, make the following changes:

  1. Update Linker Additional Dependencies Entry:

    • Before:

      <parent-folder-path>\opencv\build\x64\vc15\lib\*
    • After:

      <parent-folder-path>\opencv\build\x64\vc15\lib\*.lib
  2. Update Post Build Events Command:

    • Before:

      xcopy <parent-folder-path>\opencv\build\x64\vc15\bin\opencv_world452.dll $(SolutionDir)$(Platform)\$(Configuration)\ /c /y
    • After:

      xcopy <parent-folder-path>\opencv\build\x64\vc15\bin\opencv_world460.dll $(SolutionDir)$(Platform)\$(Configuration)\ /c /y

The project should build properly with those changes.

Thanks again for reporting this issue. I recently started updating all my tutorials and will add this to the list.

@SoroorMa
Copy link

I sincerely appreciate your response.
However, I am still facing an issue while trying to run this project :

image

@cj-mills
Copy link
Owner

Hi @SoroorMa,
Without more details, I'm not sure what would cause those errors that would not also cause multiple other errors. I would try using the Visual Studio project from the tutorial's GitHub repository and see if you encounter the same issue with that copy of the project. You'll need to set the Visual Studio project to Release x64 mode, update the local path to the OpenCV dependencies and restore the NuGet packages.

Maybe verify that you have the "Desktop development with C++" addon installed through the Visual Studio Installer and install the latest Microsoft Visual C++ Redistributable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants