snowzach / doods2

API for detecting objects in images and video streams using Tensorflow
MIT License
232 stars 30 forks source link

Deepstack Openlogo failing with tensor dimension error #102

Open chrisgilldc opened 7 months ago

chrisgilldc commented 7 months ago

Good evening!

Tried to build my own models a while back and since they're not that reliable, trying to give Moses Olafenwa's OpenLogo model a try.

Problem is, I'm slamming into the same error raised by ozett in issue 38.

RuntimeError: The expanded size of the tensor (1) must match the existing size (80) at non-singleton dimension 3. Target sizes: [1, 3, 1, 1, 2]. Tensor sizes: [3, 52, 80, 2]

I'm testing with the openlogo reference image.

The proffered solution there was to load deepstack prior to any pytorch/yolo models....

...which doesn't apply to me since I'm not loading any yolo models.

My Doods config is below. tflite coco can detect fine, both deepstack models error in the same way. I also get the error if the deepstack model is the only one loaded. So there's something going on here beyond just pytorch loading order which I'm not able to figure out.

I've made sure to pull the latest DOODS2 and am clearing my cache before each test, so am pretty sure things aren't poisoned with bad yolo versions.

Any insight would be appreciated.

doods:
  log: detection
  boxes:
    enabled: False
  detectors:
    - name: default
      type: tflite
      modelFile: models/coco_ssd_mobilenet_v1_1.0_quant.tflite
      labelFile: models/coco_labels.txt
      numThreads: 4
      numConcurrent: 4
      hwAccel: false
      timeout: 2m
    - name: ds_openlogo
      type: deepstack
      modelFile: models/openlogo.pt
      width: 640
      height: 640
      numThreads: 0
      numConcurrent: 4
    - name: ds_openlogo_usps
      type: deepstack
      modelFile: models/USPS.pt