L
lberger

  • Jun 30, 2023
  • Joined Feb 13, 2021
  • 0 best answers
  • Hi,

    I tried to run a model on oak-d without using camera. May be I'm completly wrong…

    first I can run depthaidemo.py

    using depthai module from: C:\Users\laurent\AppData\Roaming\Python\Python310\site-packages\depthai.cp310-win_amd64.pyd

    Depthai version installed: 2.20.2.0

    Setting up demo...

    Available devices:

    [0] 14442C10219C90D000 [X_LINK_UNBOOTED]

    USB Connection speed: UsbSpeed.SUPER

    Stopping demo...

    === TOTAL FPS ===

    [color]: 26.8

    [depthRaw]: 26.8

    [depth]: 26.8

    [left]: 26.1

    [rectifiedLeft]: 25.4

    [right]: 26.1

    [rectifiedRight]: 26.1

    [nn]: 26.1

    [nnInput]: 26.8

    Setting up demo...

    Available devices:

    [0] 14442C10219C90D000 [X_LINK_UNBOOTED]

    USB Connection speed: UsbSpeed.SUPER

    Downloading C:\Users\laurent\.cache\blobconverter\human-pose-estimation-0001_openvino_2021.4_6shave.blob...

    Then I compile and run my c++. In this code I'm using a model given in openvino (omz_downloader --all) 🇦

    string path("C:/Users/laurent/intel/resnet50-binary-0001/FP16-INT1/");

    Net net = readNetFromModelOptimizer(path+"resnet50-binary-0001.xml", path+"resnet50-binary-0001.bin");

    net.setPreferableBackend(DNN_BACKEND_INFERENCE_ENGINE);

    net.setPreferableTarget(DNN_TARGET_MYRIAD);

    cout << "DNN_TARGET_MYRIAD -> OK\n";

    Mat img, dst;

    Image2BlobParams paramMobilenet;

    paramMobilenet.scalefactor = Scalar(1.0 / 58.393, 1.0 / 57.12, 1.0 / 57.375);

    paramMobilenet.size = Size(224, 224);

    paramMobilenet.mean = Scalar(123.68, 116.779, 103.939);

    paramMobilenet.swapRB = true;

    paramMobilenet.datalayout = DNN_LAYOUT_NCHW;

    img = imread(samples::findFile("C:/data/VOC2012/JPEGImages/2007_002227.jpg"));

    Mat blob = blobFromImageWithParams(img, paramMobilenet);

    net.setInput(blob);

    cout << "setInput -> OK\n";

    Mat detect = net.forward();

    cout << "forward -> OK\n";

    I have got an error. My question is must I stop to find an answer because what i'm trying is not possible or somethong is wrong in my intalled or in my program?

    DNN_TARGET_MYRIAD -> OK

    setInput -> OK

    [ INFO:0@2586.433] global ie_ngraph.cpp:860 cv::dnn::InfEngineNgraphNet::initPlugin DNN/IE: Calling LoadNetwork(device=MYRIAD)...

    OpenCV(4.8.0-pre) Error: Unspecified error (> Failed to initialize Inference Engine backend (device = MYRIAD):

    C:\lib\openvino\src\plugins\intel_myriad\common\include\vpu/utils/error.hpp:39 [ GENERAL_ERROR ]

    C:\lib\openvino\src\plugins\intel_myriad\graph_transformer\src\frontend\frontend.cpp:594 Failed to compile layer "610":

    C:\lib\openvino\src\plugins\intel_myriad\common\include\vpu/utils/error.hpp:39 [ GENERAL_ERROR ]

    C:\lib\openvino\src\plugins\intel_myriad\graph_transformer\src\stages\convolution.cpp:47 invalid number of inputs: 3u

    ) in cv::dnn::InfEngineNgraphNet::initPlugin, file C:\lib\opencv\modules\dnn\src\ie_ngraph.cpp, line 865

  • Hi,
    I think it can be usefull to be able to use cv::videocapture to get image from oak :

           cv::VideoCapture capture_left(0,  cv::CAP_OAK_D);
           cv::VideoCapture capture_right(1,  cv::CAP_OAK_D);
           for (;;) {
                capture_left>> frame;
                if (frame.empty())
                    break;
                imshow("left", frame);
                capture_right>> frame;
                if (frame.empty())
                    break;
                imshow("right", frame);
                char key = (char)waitKey(30); //delay N millis, usually long enough to display and capture input

    Is somebody working on this?

  • Brandon One clean way to do this is to use PyCharm, which makes a virtual environment for each example, so then each will have its own version.

    Sorry for delay.

    I don't want to use pycharm.

    Now is oak-d python api is only compatible with pycharm?
    What's about other environement ?

  • Thanks for your answer

    Now it works.

    depth-demo is dead now

    depthai_demo.py
    No calibration file. Using Calibration Defaults.
    Using depthai module from:  F:\Program Files\Python\lib\site-packages\depthai.cp38-win_amd64.pyd
    Depthai version installed:  0.0.2.1+9b7d9364ccb94e26c8754a2e0a69b2dafe6de145
    Version mismatch between installed depthai lib and the required one by the script.
                    Required:  0.4.1.1
                    Installed: 0.0.2.1+9b7d9364ccb94e26c8754a2e0a69b2dafe6de145
                    Run: python3 install_requirements.py

    I think is for the other api. 2 api is really confusing.

    Thanks again for your help

    • I tried to run 01_rgb_preview.py and run_test error

      F:\lib\depthai-python>examples\01_rgb_preview.py
      Traceback (most recent call last):
        File "F:\lib\depthai-python\examples\01_rgb_preview.py", line 8, in <module>
          pipeline = dai.Pipeline()
      TypeError: depthai.Pipeline: No constructor defined!

      What's wrong?

      When I run run_test.py I have got many errors

      Device get data failed: 7
      F: [global] [         0] [EventRead00Thr] dispatcherEventReceive:91     Duplicate id detected.
      
      b_WritePipe: System err 22
      
      WinUsb_WritePipe failed with error:=22
      WinUsb_WritePipe failed with error:=31

      full output

      • @GergelySzabolcs thanks first error is gone now. I certainly missed aline in doc. ( F:/lib/depthai-python/depthai-core does not contain a CMakeLists.txt file.)

        Now a new one

         CMake Error at tools/FindPythonLibsNew.cmake:127 (message):
            Python config failure: Python is 64-bit, chosen compiler is 32-bit
          Call Stack (most recent call first):
            tools/pybind11Tools.cmake:16 (find_package)
            CMakeLists.txt:33 (include)
        
        
          -- Configuring incomplete, errors occurred!
          See also "C:/Users/Laurent/.hunter/_bin/i5Xkd/pybind11/pybind11-Release-prefix/src/pybind11-Release-build/CMakeFiles/CMakeOutput.log".
        C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppCommon.targets(209,5): error MSB6006: Arrêt de "cmd.exe" avec le code 1. [C:\Users\Laurent\.hunter\_bin\i5Xkd\pybind11\pybind11-Release.vcxproj]
        
        [hunter ** FATAL ERROR **] Build step failed (dir: C:/Users/Laurent/.hunter/_Base/062a19a/5dc7e66/ed4733e/Build/pybind11
        [hunter ** FATAL ERROR **] [Directory:C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/projects/pybind11]
        
        ------------------------------ ERROR -----------------------------
            https://hunter.readthedocs.io/en/latest/reference/errors/error.external.build.failed.html
        ------------------------------------------------------------------
        
        CMake Error at C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/modules/hunter_error_page.cmake:12 (message):
        Call Stack (most recent call first):
          C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/modules/hunter_fatal_error.cmake:20 (hunter_error_page)
          C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/modules/hunter_download.cmake:623 (hunter_fatal_error)
          C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/projects/pybind11/hunter.cmake:61 (hunter_download)
          C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/modules/hunter_add_package.cmake:62 (include)
          CMakeLists.txt:37 (hunter_add_package)
        
        
        -- Configuring incomplete, errors occurred!
        See also "F:/lib/depthai-python/build/CMakeFiles/CMakeOutput.log".
        See also "F:/lib/depthai-python/build/CMakeFiles/CMakeError.log".

        I started with -G"Visual Studio 15 2017 Win64" in cmake command line

        Now it seems OK

        loading initial cache file C:/Users/Laurent/.hunter/_Base/062a19a/98a35a0/ed4733e/Build/pybind11/args.cmake
          Completed 'pybind11-Release'
          Building Custom Rule C:/Users/Laurent/.hunter/_Base/062a19a/98a35a0/ed4733e/Build/pybind11/CMakeLists.txt
        -- [hunter] Build step successful (dir: C:/Users/Laurent/.hunter/_Base/062a19a/98a35a0/ed4733e/Build/pybind11)
        -- [hunter] Cache saved: C:/Users/Laurent/.hunter/_Base/Cache/raw/c91c82ea8f0c8e7924a0aa88deea3f7f5ce37fa5.tar.bz2
        CMake Warning (dev) at CMakeLists.txt:43 (find_package):
          Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
          Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
          command to set the policy and suppress this warning.
        
          Environment variable pybind11_ROOT is set to:
        
            C:/Users/Laurent/.hunter/_Base/062a19a/98a35a0/ed4733e/Install
        
          For compatibility, CMake is ignoring the variable.
        This warning is for project developers.  Use -Wno-dev to suppress it.
        
        -- Found PythonInterp: F:/Program Files/Python/python.exe (found version "3.8.5")
        -- Found PythonLibs: F:/Program Files/Python/libs/Python38.lib
        -- Performing Test HAS_MSVC_GL_LTCG
        -- Performing Test HAS_MSVC_GL_LTCG - Success
        -- LTO enabled
        -- Configuring done
        -- Generating done
        -- Build files have been written to: F:/lib/depthai-python/build
      • Hi,
        I start discussion on discord but i don't like discord for that sort a problem
        My configuration is windows 10 and MSVC 2017. Iuse git bash
        my bash log is

        $ git clone https://github.com/luxonis/depthai-python.git --branch gen2_develop
        Cloning into 'depthai-python'...
        remote: Enumerating objects: 11, done.
        remote: Counting objects: 100% (11/11), done.
        remote: Compressing objects: 100% (11/11), done.
        remote: Total 4155 (delta 4), reused 3 (delta 0), pack-reused 4144
        Receiving objects: 100% (4155/4155), 20.49 MiB | 5.34 MiB/s, done.
        Resolving deltas: 100% (2620/2620), done.
        
        Laurent@PC-Laurent-Vision MINGW64 /f/lib
        $ cd depthai-python
        
        Laurent@PC-Laurent-Vision MINGW64 /f/lib/depthai-python (gen2_develop)
        $ mkdir -p build && cd build
        
        Laurent@PC-Laurent-Vision MINGW64 /f/lib/depthai-python/build (gen2_develop)
        $ cmake .. -DDEPTHAI_PYTHON_TEST_EXAMPLES=ON
        -- Building for: Visual Studio 15 2017
        -- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.19041.
        -- The C compiler identification is MSVC 19.16.27041.0
        -- The CXX compiler identification is MSVC 19.16.27041.0
        -- Detecting C compiler ABI info
        -- Detecting C compiler ABI info - done
        -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x86/cl.exe - skipped
        -- Detecting C compile features
        -- Detecting C compile features - done
        -- Detecting CXX compiler ABI info
        -- Detecting CXX compiler ABI info - done
        -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.16.27023/bin/Hostx64/x86/cl.exe - skipped
        -- Detecting CXX compile features
        -- Detecting CXX compile features - done
        CMake Error at CMakeLists.txt:33 (add_subdirectory):
          The source directory
        
            F:/lib/depthai-python/depthai-core
        
          does not contain a CMakeLists.txt file.
        
        
        
        [hunter ** FATAL ERROR **] Config not found: F:/lib/depthai-python/depthai-core/cmake/Hunter/config.cmake
        [hunter ** FATAL ERROR **] [Directory:F:/lib/depthai-python]
        
        ------------------------------ ERROR -----------------------------
            https://hunter.readthedocs.io/en/latest/reference/errors/error.incorrect.input.data.html
        ------------------------------------------------------------------
        
        CMake Error at C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/modules/hunter_error_page.cmake:12 (message):
        Call Stack (most recent call first):
          C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/modules/hunter_fatal_error.cmake:20 (hunter_error_page)
          C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/modules/hunter_user_error.cmake:7 (hunter_fatal_error)
          C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/modules/hunter_set_config_location.cmake:50 (hunter_user_error)
          C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/modules/hunter_apply_gate_settings.cmake:85 (hunter_set_config_location)
          C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/modules/hunter_finalize.cmake:73 (hunter_apply_gate_settings)
          C:/Users/Laurent/.hunter/_Base/Download/Hunter/0.23.258/062a19a/Unpacked/cmake/modules/hunter_add_package.cmake:23 (hunter_finalize)
          CMakeLists.txt:37 (hunter_add_package)
        
        
        -- Configuring incomplete, errors occurred!
        See also "F:/lib/depthai-python/build/CMakeFiles/CMakeOutput.log".

        What's wrong?
        Do I need this to run first example?
        in cmd window now I can ru demo

        F:\lib\depthai-python>G:\Lib\depthai\depthai_demo.py

        I see image and I press q but after

        F:\lib\depthai-python>examples\01_rgb_preview.py
        Traceback (most recent call last):
          File "F:\lib\depthai-python\examples\01_rgb_preview.py", line 8, in <module>
            pipeline = dai.Pipeline()
        TypeError: depthai.Pipeline: No constructor defined!