Jump to content

marco@bigsis.tech

Members
  • Content Count

    14
  • Joined

  • Last visited

Posts posted by marco@bigsis.tech


  1. Hi All,

    I understand that in order to run an AI model on the NPU I have to convert it to RKNN, but whenever I do that my model (tf-lite) looses accuracy up to 15-20%.

     I have checked Rockchip_Trouble_Shooting_RKNN_Toolkit_V1.7.3_EN.pdf  document in section 8.1 and it says that this issue might be related to setting mean_values/std_values incorrectly.

    then I found the below section in  Rockchip_Trouble_Shooting_RKNN_Toolkit_V1.3.2_EN.pdf on how to set mean_values/std_values, but still don't quite understand it:

    image.png

    I have 3 questions:

    1) I am doing a binary classification and my Input data is (240,240,3) for training,  would this be my (Cin0, Cin1,Cin2) ?

    2) how do I set the Scale parameter ?

    3)how do I get (Cout0,Cout1, Cout2) ?

     

    thank you,

    I would really appreciate your help


  2. On 4/8/2022 at 2:12 AM, MThompson said:

    Nevermind.  I got it working.  I needed to follow the steps below:

    • install a previous version of Debian for the Tinker Board Edge R (ie. v1.0.4)
    • connect the Edge R to my PC via a USBC cable
    • reboot the Edge R into UMS mode
    • finally, use balenaEtcher to write the v2.0.5 image from my PC

     

    Hi MThompson,

    I have tried to follow your suggestion.

    first, i have installed succesfully Tinker Edge R Debian V1.0.1 into the board. then whilst the board is connected to laptop via a USBC cable, i executed the command ''sudo reboot ums'' in the linux terminal on the tinker edge r.

     I can find the tinker edge r in the device manager but cannot find it in the balena etcher when selecting the target.

    Do you have any suggestion?

    thank you in advance

    image.png


  3. if i do      ret = rknn.build(do_quantization=True, dataset='./dataset.txt', pre_compile=False)

     

    i get the below error but the model get built at the end.

    to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/conv5_block2_add/add_113:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/conv5_block2_add/add_114:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/conv5_block3_1_conv/Conv2D_115:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/conv5_block3_1_conv/Conv2D_116:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/conv5_block3_2_conv/Conv2D_117:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/conv5_block3_2_conv/Conv2D_118:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/conv5_block3_3_conv/BiasAdd1_119:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/conv5_block3_add/add_120:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/conv5_block3_add/add_121:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/avg_pool/Mean_122:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/dense/BiasAdd_123:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @StatefulPartitionedCall/0_124:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/conv2_block1_add/add_12_concat_126:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    [33mW tensor @sequential/resnet50/conv2_block1_add/add_12_conv_127:out0 seems to be always 0, user might try to remove the correlative layer manually[0m
    done
    --> Export RKNN model
    done


  4. On 12/5/2022 at 10:42 AM, tooz said:

    hello @marco@bigsis.tech

    this is processed by cpu only. 

    this is the reference for rknn-toolkit for model conversion, inferene ... etc

    https://github.com/rockchip-linux/rknn-toolkit

    here's an example on converting tflite model to rknn model: 

    https://github.com/rockchip-linux/rknn-toolkit/tree/master/examples/tflite/mobilenet_v1 

    Hi Tooz,

    Thank you very much for your response it was very helpful.

    I have converted the tf lite model to a rknn model and i had an improvement from 2 sec to 0.72 sec  for inference. however is that the best that the tinker edge r can achieve? I didn't do the quantization in the rknn.build function, does it affect the speed in the inference?

    below is the code I used:

     

    rknn = RKNN()


    print('--> Loading model')
    ret = rknn.load_tflite(model = '/home/linaro/AI-big-data-1b.tflite')
    if ret != 0:
        print('Load failed!')
        exit(ret)
    print('done')

    # Build model
    print('--> Building model')
    ret = rknn.build(do_quantization=True)
    if ret != 0:
        print('Build *.rknn failed!')
        exit(ret)
    print('done')

    # Export rknn model
    print('--> Export RKNN model')
    ret = rknn.export_rknn("ai-module2.rknn")
    if ret != 0:
        print('Export *.rknn failed!')
        exit(ret)
    print('done')
     


  5. I have developed a CNN model for image classification with TensorFlow and then converted it to TensorFlow-lite. I have done a comparison between the inferencing time in the tinker edge and RPi 4B 4GB. It turned out that on the RPi 4 the inferencing time is faster ~ 1sec compared to the tinker edge r which is ~ 2sec. How is that possible. shouldn't the tinker edge have an AI accelerator unit?  Am I missing something? 

    I would please appreciate your help.

     

    thanks


  6. the camera module cable for this board is not as the rpi one, this one is smaller from one side. I would please like to know what is the camera cable type that comes with the tinker edge r and where I can buy a 3/5 meters cable of it. 

     


  7. 1 hour ago, tooz said:

    hello @marco@bigsis.tech

    so the version of opencv-python was upgraded, if you've encountered import cv2.imshow() error, please remove the build-in opencv-python:

    
    python3 -m pip uninstall opencv-python

    then re-install:

    
    python3 -m pip install opencv-python --user 

     

    Hi,

    thank you again for your quick response.

    at the end I was able to solve the error by re-compiling opencv  following the same tutorial  BUT  installing  libgtk2.0-dev  instead of libgtk-3-dev.

    I will try your suggestion as well.

    However I am currently facing another problem..

    I am trying to capture videos from 4 usb cameras.  I am able to preview only 3 cameras together, but if I try with 4 I gets the following error:

    (-215:Assertion failed) size.width>0 && size.height>0 in function 'cv::imshow

    Any suggestion please?

     

     

    WhatsApp Image 2022-11-24 at 10.22.13.jpeg


  8. 2 minutes ago, tooz said:

    hello @marco@bigsis.tech

    i was testing tinker board 2s and did manage to compile opencv:

    sudo apt-get update
    sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev


    git clone https://github.com/opencv/opencv.git
    cd opencv/
    git checkout 4.1
    mkdir build
    cd build
    cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D INSTALL_C_EXAMPLES=OFF \
    -D PYTHON_EXECUTABLE=$(which python3) \
    -D BUILD_opencv_python2=OFF \
    -D PYTHON3_EXECUTABLE=$(which python3) \
    -D WITH_GSTREAMER=ON ..
    make && sudo make install

     

    will check on tinker edge r and let you know 

    thank you for your response, I will try uninstall opencv and recompile it with your modification and let you know as well


  9. 19 minutes ago, tooz said:

    hello @marco@bigsis.tech

    which version of opencv were you building? were you building it on tinker board 2s?

    Hi,

    thank you for your reply. No, I am building it on the Tinker Edge R, and the downloaded version of opencv after following that  tutorial is 4.6.0.

    I also tried to execute the RKNN toolkit which gives opencv 4.4.0 and still got that error me


  10. Hi,

    thank you for your reply. No, I am building it on the Tinker Edge R, and the downloaded version of opencv after following that  tutorial is 4.6.0.

    I also tried to execute the RKNN toolkit which gives opencv 4.4.0 and still got that error message.


  11. On 9/2/2022 at 9:07 AM, tooz said:

    just tested the cv2.imshow() function on my side and no errors shown. if the debian 10 os you're using is the official release from our website, python/ opencv pakages are built in the image; if you're using a third party debian 10 os, maybe follow this tutorial to get all the necessary libs/ pkgs installed: https://linuxize.com/post/how-to-install-opencv-on-debian-10/

    i have downloaded the debian 10 official realease from tinker board asus website and then followed your suggested tutorial to install opencv but i am still getting the error:

    error: (-2:Unspecified error) The function is not implemented.
    Rebuild the library with Windows, GTK+ 2.x or Cocoa support.
    If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config,
    then re-run cmake or configure script in function 'cvShowImage'

     

×
×
  • Create New...