snowzach / doods

DOODS - Dedicated Open Object Detection Service
MIT License
303 stars 31 forks source link

Cannot load custom classification models #32

Closed jasonmadigan closed 2 years ago

jasonmadigan commented 4 years ago

Trying to load the "MobileNet V2 (ImageNet)" model from https://coral.ai/models/.

https://github.com/google-coral/edgetpu/raw/master/test_data/mobilenet_v2_1.0_224_quant_edgetpu.tflite https://github.com/google-coral/edgetpu/raw/master/test_data/imagenet_labels.txt

config.yaml:

doods:
  detectors:
    - name: default
      type: tflite
      modelFile: models/coco_ssd_mobilenet_v1_1.0_quant.tflite
      labelFile: models/coco_labels0.txt
      numThreads: 0
      numConcurrent: 4 
    - name: tensorflow
      type: tensorflow
      modelFile: models/faster_rcnn_inception_v2_coco_2018_01_28.pb
      labelFile: models/coco_labels1.txt
      width: 224
      height: 224
      numThreads: 0
      numConcurrent: 4
    - name: mobilenet
      type: tflite
      modelFile: models/mobilenet_v2_1.0_224_quant_edgetpu.tflite
      labelFile: models/mobilenet_v2_labels.txt
      width: 224
      height: 224
      numThreads: 0
      numConcurrent: 4 

But I get an error at startup:

2020-08-06T19:31:00.348Z WARN tflite/detector.go:189 Error {"package": "detector.tflite", "name": "mobilenet", "message": "Encountered unresolved custom op: \u0010.", "user_data": null}

2020-08-06T19:31:00.348Z WARN tflite/detector.go:189 Error {"package": "detector.tflite", "name": "mobilenet", "message": "Node number -1798026136 (Node number %d (%s) %s.\n) failed to prepare.\n", "user_data": null}

2020-08-06T19:31:00.348Z ERROR detector/detector.go:73 Could not initialize detector mobilenet: interpreter allocate failed {"package": "detector"}

2020-08-06T19:31:00.349Z INFO server/server.go:274 API Listening {"package": "server", "address": ":8080", "tls": false, "version": "v0.2.1-0-g91828a0-dirty"}
snowzach commented 4 years ago

I assume you have a EdgeTPU attached? Add hwAccel: true to your mobilenet detector. You need to tell DOODS it's an EdgeTPU model.

jasonmadigan commented 4 years ago

Hey, sorry - just spotted that after I submitted. Added it but get the same error. I think my problem may be that I'm using the classification models rather than the object detection ones.

The thing I'm working on needs more than the smaller coco types, so I was looking at using the image classification ones instead. I'm guessing that's not supported?

snowzach commented 3 years ago

@jasonmadigan It's not currently supported... I can look at doing that... But it's designed to look at the whole image and determine one thing that it sees. Ie, here's a picture of a flower, determine what kind of flower it is... I don't think it would work well for security footage which is what doods was built for. If you have a use case, I can look at adding support for them.

snowzach commented 2 years ago

If you're still interested in trying, check out https://github.com/snowzach/doods2