openvinotoolkit / openvino

OpenVINO™ is an open-source toolkit for optimizing and deploying AI inference
https://docs.openvino.ai
Apache License 2.0
7.33k stars 2.29k forks source link

Inference-engine build fails on ARM/Raspberry Pi #3

Closed fnoop closed 5 years ago

fnoop commented 6 years ago
[dev] [mav@maverick-raspberry ~/var/build/opencv_dldt/inference-engine/build]$ cmake ..
-- BUILD_CONFIGURATION: Release
-- INTEL_VTUNE_DIR is not defined
-- Could NOT find INTEL_ITT (missing:  Located_ITT_INCLUDE_DIRS Located_ITT_LIBS)
-- INTEL_ITT is disabled
-- Detected 32 bit architecture
CMake Error at cmake/linux_name.cmake:22 (string):
  string sub-command REGEX, mode MATCH needs at least 5 arguments total to
  command.
Call Stack (most recent call first):
  cmake/check_features.cmake:50 (get_linux_name)
  cmake/dependencies.cmake:9 (include)
  CMakeLists.txt:90 (include)

CMake Warning at cmake/check_features.cmake:58 (message):
  Cannot detect Linux OS via reading /etc/*-release:

Call Stack (most recent call first):
  cmake/dependencies.cmake:9 (include)
  CMakeLists.txt:90 (include)

-- CI_BUILD_NUMBER: custom_HEAD_eae43f84291492e5e6094eb7efa6077f68d7aca8
-- ENABLE_MKL_DNN = OFF
-- ENABLE_CLDNN = OFF
-- ENABLE_CLDNN_BUILD = OFF
-- ENABLE_PROFILING_ITT = ON
-- ENABLE_PROFILING_RAW = OFF
-- ENABLE_OMP = ON
-- ENABLE_INTEL_OMP = ON
-- ENABLE_TESTS = OFF
-- ENABLE_SAMPLES_CORE = ON
-- ENABLE_SANITIZER = OFF
-- COVERAGE = OFF
-- ENABLE_STRESS_UNIT_TESTS = OFF
-- VERBOSE_BUILD = OFF
-- ENABLE_UNSAFE_LOCATIONS = OFF
-- ENABLE_ALTERNATIVE_TEMP = ON
-- ENABLE_SEGMENTATION_TESTS = ON
-- ENABLE_OBJECT_DETECTION_TESTS = ON
-- ENABLE_OPENCV = ON
-- OS_FOLDER = OFF
-- ENABLE_PLUGIN_RPATH = ON
-- GEMM = OPENBLAS
-- DL_SDK_TEMP envionment not set
-- A library with BLAS API found.
CMake Error at cmake/dependencies.cmake:97 (if):
  if given arguments:

    "STREQUAL" "Ubuntu 16.04"

  Unknown arguments specified
Call Stack (most recent call first):
  CMakeLists.txt:90 (include)

-- Configuring incomplete, errors occurred!
See also "/srv/maverick/var/build/opencv_dldt/inference-engine/build/CMakeFiles/CMakeOutput.log".
See also "/srv/maverick/var/build/opencv_dldt/inference-engine/build/CMakeFiles/CMakeError.log".

Is this project intended for Intel-only architecture, or should/will it work on ARM?

r0l1 commented 5 years ago

@dkurt no I didn't, because a minimal custom linux system is running on the ODroid and everything is statically linked. That's why building from source would be great...

larrylart commented 5 years ago

@dkurt, I have the same as @r0l1 the XU4, also a C2 (which is a 64bit) I tried the RPI package, on XU4 / ubuntu 16.04, I had to change the some raspberry paths and I got as far a attempting to compile object_detection_sample_ssd and i get "undefined reference to `cv::imread(std::string const&, int)'" I see reference in to opencv4 ? was there a release for version 4 recently?

dkurt commented 5 years ago

@larrylart, perhaps the problem is in hardcoded OS names in setupvars.sh and cmake configs. I think that the simplest way is to start with python bindings.

Unfortunately I have no board with this OS so I cannot say which steps can help you to enable the package. But it seems to me possible because it has the same CPU arch.

tedchina commented 5 years ago

@dkurt, here are some links to ODROID-XU4: https://www.hardkernel.com/shop/odroid-xu4-special-price-limited-quantity/ https://magazine.odroid.com/odroid-xu4 Its cores are Cortex™-A15 2Ghz and Cortex™-A7 Octa core CPUs, IMO its computation power is above Raspberry Pi 3B+ and below UP Squared. Hope this helps ...

blitzvb commented 5 years ago

@larrylart you can download/compile/install opencv 4 from here :

https://github.com/opencv/opencv

mpeniak commented 5 years ago

Hi @moslex, thanks for your help. I heard you are looking for exciting projects based on Pi and NCS2. Well, check what I have managed to do in less than two days!

https://www.timeless.ninja/blog/the-world-s-first-ai-edge-camera-powered-by-two-intel-myriad-x-vpus

Let me know what you think!

nikogamulin commented 5 years ago

@dkurt , I have tried use another model (vehicle-license-plate-detection-barrier-0106) but it didn't detect anything and haven't figured out yet what's wrong. Below is the code:

import cv2

def predict(frame, net):
    # Prepare input blob and perform an inference
    blob = cv2.dnn.blobFromImage(frame, size=(300, 300), ddepth=cv2.CV_8U)
    net.setInput(blob)
    out = net.forward()

    predictions = []

    # The net outputs a blob with the shape: [1, 1, N, 7], where N is the number of detected bounding boxes.
    # For each detection, the description has the format: [image_id, label, conf, x_min, y_min, x_max, y_max]

    # Draw detected faces on the frame
    for detection in out.reshape(-1, 7):
        image_id, label, conf, x_min, y_min, x_max, y_max = detection

        if conf > 0.5:
            predictions.append(detection)

    # return the list of predictions to the calling function
    return predictions

# Load the model
net = cv2.dnn.readNet('models/vehicle-license-plate-detection-barrier-0106.xml', 'models/vehicle-license-plate-detection-barrier-0106.bin')

# Specify target device
net.setPreferableTarget(cv2.dnn.DNN_TARGET_MYRIAD)

# Read an image
frame = cv2.imread('screenshots/mercedes.jpg')

predictions = predict(frame, net)

# Draw detected faces on the frame
for prediction in predictions:
    confidence = float(detection[2])
    xmin = int(detection[3] * frame.shape[1])
    ymin = int(detection[4] * frame.shape[0])
    xmax = int(detection[5] * frame.shape[1])
    ymax = int(detection[6] * frame.shape[0])

    cv2.rectangle(frame, (xmin, ymin), (xmax, ymax), color=(0, 255, 0))

# Save the frame to an image file
cv2.imwrite('out.png', frame)

Basically, I have downloaded the model files from this adddress and then modified input dimensions according to specifications.

dkurt commented 5 years ago

@nikogamulin, let's keep things separate. I'd like to ask you to copy you question to the forum where OpenCV community can help you: http://answers.opencv.org/.

jcolafrancesco commented 5 years ago

Hi, Do you know if there any chance for this new release to work on RPI zero or RPI zero wifi ? This tutorials requiers ARMV7 : https://software.intel.com/articles/OpenVINO-Install-RaspberryPI But pi zero is ARMV6.

Thanks for your help.

larrylart commented 5 years ago

@blitzvb, thanks! I didn't realised that the master branch was switched to 4.0.0 already, however I noticed that this toolkit links to 4.0.1. However I managed in the to compile the example without linking errors. @dkurt, while trying to run the object_detection_sample_ssd I got segmentation fault, did strace on the process and noticed it was trying to load libusb-1.0.so.0 which didn't had a proper link as per defautl install on my device. I created the link manually and not I am getting 'Bus error'. I can query the device with NCSDK2 call, however the ncsdk functions don't match this firmware so it will only report partial information - but enough to confirm the device is working. Any ideas? Perhaps myriad and other dynamic libraries should statically link to avoid conflicts if source not provided ?

dkurt commented 5 years ago

@larrylart, Am I right that we are talking about ODROID OS?

Please check the following steps:

  1. Output of cat /proc/cpuinfo shows ARMv7 CPUs
  2. You've added -DCMAKE_CXX_FLAGS="-march=armv7-a" compiler flag
  3. Try to run python sample (see the guide). Does it work or not?
hzxiaobo commented 5 years ago

An install guide: https://software.intel.com/articles/OpenVINO-Install-RaspberryPI

Will ARMv8 (aarch64) support be added in the future?

dkurt commented 5 years ago

@hzxiaobo, looks good for a feature proposal. I think it's better to open a separate issue for it.

larrylart commented 5 years ago

@dkurt, Odroid XU4 is running Ubuntu 16.04

  1. The /proc/cpuinfo was show above by @r0l1 - ARMv7 Processor rev 3 (v7l)
  2. I did compile with the proper flags as per documentation
  3. I'm getting an error when I run the python example:

Traceback (most recent call last): File "./openvino_fd_myriad.py", line 1, in import cv2 as cv File "/root/kits/opencv4/opencv/build/python_loader/cv2/init.py", line 89, in bootstrap() File "/root/kits/opencv4/opencv/build/python_loader/cv2/init.py", line 79, in bootstrap import cv2 ImportError: /root/kits/opencv4/opencv/build/lib/libopencv_dnn.so.4.0: undefined symbol: _ZN15InferenceEngine4DataC1ERKSsRKSt6vectorIjSaIjEENS_9PrecisionENS_6LayoutE

dkurt commented 5 years ago

@larrylart, There is pre-built OpenCV in the package. Is there a path to it in the PYTHONPATH?

mpeniak commented 5 years ago

Hi guys what FPS are you getting on rpi and ncs2?

dkurt commented 5 years ago

@mpeniak, If you have a question about specific model - let's create a separate thread

@larrylart, I'd like to ask you to do the same. You know, it'll be easier for other users to find solution this way.

neuralmimicry commented 5 years ago

I'm trying to get OpenVino/NCS2 combination running on a PINE64 SoPine Clusterboard ( 7 x 4-core Arm64). Combatting all the little gotchas in getting the SoPine (SoDimm format) single unit to load OpenVino right to the point of:

root@pine64:~/Developer/inference_engine_vpu_arm/deployment_tools/inference_engine/samples/build# make -j2 object_detection_sample_ssd Scanning dependencies of target format_reader Scanning dependencies of target ie_cpu_extension [ 0%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_argmax.cpp.o [ 0%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/MnistUbyte.cpp.o [ 4%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/bmp.cpp.o [ 8%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/format_reader.cpp.o [ 12%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_base.cpp.o [ 16%] Building CXX object common/format_reader/CMakeFiles/format_reader.dir/opencv_wraper.cpp.o [ 20%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_ctc_greedy.cpp.o [ 24%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_detectionoutput.cpp.o [ 24%] Linking CXX shared library ../../intel64/Release/lib/libformat_reader.so /home/ubuntu/Developer/inference_engine_vpu_arm/opencv/lib/libopencv_imgcodecs.so.4.0.1: error adding symbols: File in wrong format clang: error: linker command failed with exit code 1 (use -v to see invocation) common/format_reader/CMakeFiles/format_reader.dir/build.make:175: recipe for target 'intel64/Release/lib/libformat_reader.so' failed make[3]: *** [intel64/Release/lib/libformat_reader.so] Error 1 CMakeFiles/Makefile2:190: recipe for target 'common/format_reader/CMakeFiles/format_reader.dir/all' failed make[2]: *** [common/format_reader/CMakeFiles/format_reader.dir/all] Error 2 make[2]: *** Waiting for unfinished jobs.... [ 24%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_gather.cpp.o [ 28%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_grn.cpp.o [ 32%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_interp.cpp.o [ 36%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_list.cpp.o [ 36%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_mvn.cpp.o [ 40%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_normalize.cpp.o [ 44%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_pad.cpp.o [ 44%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_powerfile.cpp.o [ 48%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_priorbox.cpp.o [ 52%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_priorbox_clustered.cpp.o [ 56%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_proposal.cpp.o [ 56%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_psroi.cpp.o [ 60%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_region_yolo.cpp.o [ 64%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_reorg_yolo.cpp.o [ 68%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_resample.cpp.o [ 68%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_simplernms.cpp.o [ 72%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/ext_spatial_transformer.cpp.o [ 76%] Building CXX object ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/simple_copy.cpp.o [ 80%] Linking CXX shared library ../intel64/Release/lib/libcpu_extension.so /home/ubuntu/Developer/inference_engine_vpu_arm/deployment_tools/inference_engine/lib/ubuntu_18.04/libinference_engine.so: error adding symbols: File in wrong format clang: error: linker command failed with exit code 1 (use -v to see invocation) ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/build.make:642: recipe for target 'intel64/Release/lib/libcpu_extension.so' failed make[3]: *** [intel64/Release/lib/libcpu_extension.so] Error 1 CMakeFiles/Makefile2:85: recipe for target 'ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/all' failed make[2]: *** [ie_cpu_extension/CMakeFiles/ie_cpu_extension.dir/all] Error 2 CMakeFiles/Makefile2:1343: recipe for target 'object_detection_sample_ssd/CMakeFiles/object_detection_sample_ssd.dir/rule' failed make[1]: *** [object_detection_sample_ssd/CMakeFiles/object_detection_sample_ssd.dir/rule] Error 2 Makefile:450: recipe for target 'object_detection_sample_ssd' failed make: *** [object_detection_sample_ssd] Error 2

Which basically means that obviously trying to link 32-bit arm7-a libraries to 64-bit aarch64 architecture doesn't work...

Please release the source for these libraries so I can recompile for aarch64... Please Intel!

fnoop commented 5 years ago

@yury-gorbachev Could you please tag a release in github for R5?

alalek commented 5 years ago

@fnoop R5 publishing is in progress: #72

eejlny commented 5 years ago

Hello,

I also have a ARM64 target and I am getting to the point: inference_engine.so: error adding symbols: File in wrong format

I would like to request that Intel adds support for ARM64, please, since new boards tend to use this.

Thanks,

r0l1 commented 5 years ago

I can confirm, that the inference engine runs on an O-Droid XU4

skhameneh commented 5 years ago

I started a repo to share how I setup OpenVINO R5 on ARM64 / AARCH64 using Schroot, I can imagine this will help many of you while we wait for more from Intel. Feel free to help contribute! https://github.com/skhameneh/OpenVINO-ARM64

I have a number of details I need to collect from my devices and add. Most specifically the many cmake flags needed and the schroot config. I should have most of the details added in the next day or so.

pabloe4993 commented 5 years ago

I can confirm, that the inference engine runs on an O-Droid XU4

You have successfully run NCS2 with XU4? If so, can you share?