frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Converting SSD-mobilenet

Hi guys,

I am trying to covert the SSD mobilenet in ncappzoo/caffe/SSD_MobileNet

I followed the instructions on git to finetune the model on my own data. Once I had the model I tried to compile it for movidius:

mvNCCompile -w mobilenet-ssd-deploy.caffemodel -s 12 MobileNetSSD_deploy.prototxt

but getting this:

mvNCCompile v02.00, Copyright @ Movidius Ltd 2016
[Error 17] Toolkit Error: Internal Error: Could not build graph. Missing link: conv11_mbox_conf

Do you have any idea why I am seeing this? When I check the prototxt it does have that layer but it has '_new' appended to it so it would be e.g. conv11_mbox_conf_new
I dont know why is it looking for conv11_mbox_conf when the prototxt has conv11_mbox_conf...

Thanks for your help!

Comments

  • 12 Comments sorted by Votes Date Added
  • @huxh10 I think the fix should be:

    if '_new' in name:
          self.alias.append(name[0:-4])
    

    at line 86, name[0:len(name) - 1] works the same as line 85

    self.alias = [name]
    
  • I found the cause. When mvNCCompile parses the caffe model, it builds a tree. But it only attaches the bottom blob and uses layer name as top blob. The compiler has logic to deal with renaming, while it fails in this condition.

    My temporary solution is:

    sudo find / -name NetworkStage.py
    # /usr/local/bin/ncsdk/Models/NetworkStage.py in my server
    # insert the following lines at line 86
    if ''_new' in name:
        self.alias.append(name[0:len(name) - 1])
    

    Then it works.

  • I manged to compile a ncs model with the solution above,

    if '_new' in name:
          self.alias.append(name[0:-4])
    

    but when I run the model on Raspberry with NCS for detection, I got such ERROR:

    [INFO] finding NCS devices...
    [INFO] found 1 devices. device0 will be used. opening device0...
    [INFO] loading the graph file into RPi memory...
    [INFO] allocating the graph on the NCS...
    Traceback (most recent call last):
      File "count_for_video_ncs.py", line 267, in <module>
        count_for_video_ncs(img_dir, start_index, end_index)
      File "count_for_video_ncs.py", line 183, in count_for_video_ncs
        predictions = predict(image_np, detection_graph)
      File "count_for_video_ncs.py", line 58, in predict
        (output, _) = graph.GetResult()
      File "/usr/local/lib/python2.7/dist-packages/mvnc/mvncapi.py", line 264, in GetResult
        raise Exception(Status(status))
    Exception: mvncStatus.MYRIAD_ERROR
    
  • @cweihang Can you provide your model files (caffemodel and prototxt) and your python script?

  • @Tome_at_Intel I follow this repository https://github.com/chuanqi305/MobileNet-SSD ,
    - use gen_model.sh to create prototxt,
    - use prototxt like MobileNetSSD_train_template.prototxt for training,
    - usemerge_bn.py to generate a model without bn layer,
    - and use this command to generate a ncs model:

    mvNCCompile template/MobileNetSSD_deploy.prototxt -w MobileNetSSD_deploy.caffemodel -s 12 -is 300 300 -o ncs_mobilenet_ssd_graph
    

    and meet the ERROR in the question

    [Error 17] Toolkit Error: Internal Error: Could not build graph. Missing link: conv11_mbox_conf
    

    and try to fix with this alia replacement

    if '_new' in name:
          self.alias.append(name[0:-4])
    

    but fail to run the model with this Exception:

    [INFO] finding NCS devices...
    [INFO] found 1 devices. device0 will be used. opening device0...
    [INFO] loading the graph file into RPi memory...
    [INFO] allocating the graph on the NCS...
    Traceback (most recent call last):
      File "count_for_video_ncs.py", line 267, in <module>
        count_for_video_ncs(img_dir, start_index, end_index)
      File "count_for_video_ncs.py", line 183, in count_for_video_ncs
        predictions = predict(image_np, detection_graph)
      File "count_for_video_ncs.py", line 58, in predict
        (output, _) = graph.GetResult()
      File "/usr/local/lib/python2.7/dist-packages/mvnc/mvncapi.py", line 264, in GetResult
        raise Exception(Status(status))
    Exception: mvncStatus.MYRIAD_ERROR
    
  • I met mvncStatus.MYRIAD_ERROR with the ncsdk in python2, after I reinstalled the sdk in python3, the runttime problem disappeared.

    And it's really necessary for this fix in NetworkStage when your model contain layer named '*****_new':

    if '_new' in name:
          self.alias.append(name[0:-4])
    
  • @cweihang So you actually succeeded in deploying a finetuned SSD MobileNet on the NCS following these steps above? What FPS can you get?

  • Was anybody able to achieve the above? Let us know.

  • @cweihang At which line should i add these lines?

  • I got the same error mentioned and was fixed after editing /usr/local/bin/ncsdk/Models/NetworkStage.py as mentioned. I have a 4.5 fps for my custom object detection.

  • This has been very helpful!

Sign In or Register to comment.