Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deepstack model error #38

Closed
JustinGeorgi opened this issue Mar 12, 2022 · 42 comments
Closed

Deepstack model error #38

JustinGeorgi opened this issue Mar 12, 2022 · 42 comments

Comments

@JustinGeorgi
Copy link

Love the new rewrite! I'd been using v1 for some time and just moved over to v2 container recently. Great stuff!

The recent addition of the deepstack models does not seem to be working. I see in issue #28 after it was closed that there's a report that trying to get a deepstack model working resulted in a error. I'm getting the same error with two different .pt models

Error:

2022-03-12 21:30:35,452 - uvicorn.access - INFO - 172.17.0.1:36888 - "POST /detect HTTP/1.1" 500
2022-03-12 21:30:35,452 - uvicorn.error - ERROR - Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 181, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in __call__
    task_group.cancel_scope.cancel()
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 574, in __aexit__
    raise exceptions[0]
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
    await self.app(scope, request.receive, send_stream.send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 226, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 159, in run_endpoint_function
    return await dependant.call(**values)
  File "/opt/doods/api.py", line 40, in detect
    detect_response = self.doods.detect(detect_request)
  File "/opt/doods/doods.py", line 127, in detect
    ret = detector.detect(image)
  File "/opt/doods/detectors/deepstack.py", line 45, in detect
    results = self.torch_model(image, augment=False)[0]
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/root/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py", line 126, in forward
    return self._forward_once(x, profile, visualize)  # single-scale inference, train
  File "/root/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py", line 149, in _forward_once
    x = m(x)  # run
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/root/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py", line 61, in forward
    if self.inplace:
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1177, in __getattr__
    raise AttributeError("'{}' object has no attribute '{}'".format(
AttributeError: 'Detect' object has no attribute 'inplace'

Both of the models work with the deepstack service itself, and doods properly reports the labels embedded in the models

    {
      "name": "dark",
      "type": "deepstack",
      "model": "external/models/dark.pt",
      "labels": [
        "Bicycle",
        "Boat",
        "Bottle",
        "Bus",
        "Car",
        "Cat",
        "Chair",
        "Cup",
        "Dog",
        "Motorbike",
        "People",
        "Table"
      ],
      "width": 0,
      "height": 0
    },
    {
      "name": "combined",
      "type": "deepstack",
      "model": "external/models/combined.pt",
      "labels": [
        "person",
        "bicycle",
        "car",
        "motorcycle",
        "bus",
        "truck",
        "bird",
        "cat",
        "dog",
        "horse",
        "sheep",
        "cow",
        "bear",
        "deer",
        "rabbit",
        "raccoon",
        "fox",
        "coyote",
        "possum",
        "skunk",
        "squirrel",
        "pig",
        ""
      ],
      "width": 0,
      "height": 0
    }

so the models seem intact.

My config for the two models is minimal:

    - name: dark
      type: deepstack
      modelFile: external/models/dark.pt
    - name: combined
      type: deepstack
      modelFile: external/models/combined.pt

do I need more than that or is there some issue with the deepstack integration at the moment?

@ozett
Copy link

ozett commented Mar 19, 2022

maybe needs to investigate it its a compatible-bug between models trained on older yolo versions?

see -> ultralytics/yolov5#5234 (comment)
or my comment on openlogo.pt-model -> #28 (comment)

@snowzach
Copy link
Owner

I am wondering if this is the same issue where it's trying to use Yolo6 and I need to figure out how to make it use yolo5

@snowzach
Copy link
Owner

snowzach commented Mar 20, 2022

Okay.... I just looked into this more.. the OpenLogo detector is working fine for me. I suspect that this is an issue where it cannot properly convert whatever image type you are working with into the one that Deepstack expects. Where are you getting your image data? Do you know if it's just normal RGB data or maybe has an Alpha channel or something? Can you share an image file?

@ozett
Copy link

ozett commented Mar 20, 2022

no-panic-6-250x250

does this image features survive here?
as i upload it, i see that i looks like alpha-channel image... maybe thats it?
this image works well with yolo5

@ozett
Copy link

ozett commented Mar 20, 2022

maybe an interference with some models from my config?

root@ub-doods2:/usr/src# cat example.yaml
doods:
  detectors:
    - name: default-org
      type: tflite
      modelFile: models/coco_ssd_mobilenet_v1_1.0_quant.tflite
      labelFile: models/coco_labels0.txt
      numThreads: 0
      numConcurrent: 4
    - name: edgetpu
      type: tflite
      modelFile: models/mobilenet_ssd_v2_coco_quant_postprocess_edgetpu.tflite
      labelFile: models/coco_labels0.txt
      numThreads: 0
      numConcurrent: 4
      hwAccel: false
    - 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: default
      type: tflite
      modelFile: models/lite-model_aiy_vision_classifier_birds_V1_3.tflite
      labelFile: models/aiy_birds_V1_labelmap.csv
      width: 224
      height: 224
      numThreads: 0
      numConcurrent: 4
      hwAccel: false
    - name: pybirds
      type: pytorch
      modelFile: nicolalandro/ntsnet-cub200,ntsnet
      width: 600
      height: 600
      numThreads: 0
      numConcurrent: 4
    - name: yolo5
      type: pytorch
      modelFile: ultralytics/yolov5,yolov5s
      width: 224
      height: 224
      numThreads: 0
      numConcurrent: 4
    - name: logodeep
      type: deepstack
      modelFile: models/openlogo.pt
      width: 640
      height: 640
      numThreads: 0
      numConcurrent: 4

@ozett
Copy link

ozett commented Mar 20, 2022

Oops, whats this?
i left only openlogo in the config alone:

image

@ozett
Copy link

ozett commented Mar 20, 2022

my config:

doods:
  detectors:
    - name: yolo5
      type: pytorch
      modelFile: ultralytics/yolov5,yolov5s
      width: 224
      height: 224
      numThreads: 0
      numConcurrent: 4
    - name: logodeep
      type: pytorch
      modelFile: models/openlogo.pt
      width: 640
      height: 640
      numThreads: 0
      numConcurrent: 4

now this:

image

@ozett
Copy link

ozett commented Mar 20, 2022

i have to have yolo5 in the config,
than no error on startup. but still processing error

image

config (now openlogo as deepstack-type):

doods:
  detectors:
    - name: yolo5
      type: pytorch
      modelFile: ultralytics/yolov5,yolov5s
      width: 224
      height: 224
      numThreads: 0
      numConcurrent: 4
    - name: logodeep
      type: deepstack
      modelFile: models/openlogo.pt
      width: 640
      height: 640
      numThreads: 0
      numConcurrent: 4

@ozett
Copy link

ozett commented Mar 20, 2022

i test with the image from the openlogo-site, but still that error

Testimage:
https://github.com/OlafenwaMoses/DeepStack_OpenLogo/blob/main/images/fedex_detected.jpg?raw=true

Error:
image

@ozett
Copy link

ozett commented Mar 20, 2022

Uhhhh, i was behind the "latest" docker...

PULL!
image

and test now...

@ozett
Copy link

ozett commented Mar 20, 2022

did not help:

image

@ozett
Copy link

ozett commented Mar 20, 2022

testimage still not work.
seems to be interference with yolo5 (verstion 6= yolo5s6 did also not help)

TESTIMAGE:
https://raw.githubusercontent.com/OlafenwaMoses/DeepStack_OpenLogo/main/images/fedex.jpg

@JustinGeorgi
Copy link
Author

I get the same failure of the doods deepstack models no matter what image I use.

*doods2 (tensorflow model) -> success
*doods2 (pytorch model) -> success
*deepstack instance -> success
*doods2 (deepstack model) -> error

Occasionally the error is different, so maybe there is more than one issue here. Most of the time I get the error in my original post

AttributeError: 'Detect' object has no attribute 'inplace'

but on some images I get the same error ozett has just reported in several posts

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

Here's one of my example images

@snowzach
Copy link
Owner

Soooo this is interesting... It appears to be some sort of collision with having a pytorch detector enabled along with the deepstack detector. If I disable pytorch the logo detector works fine. That gives me something reproducible to look into at least.

@ozett
Copy link

ozett commented Mar 20, 2022

single config of deepstack-type with openlogo throws error on my install.
cannot confirm that it works. see this error:

image

@JustinGeorgi
Copy link
Author

I can confirm that deepstack models fail to load if I remove pytorch from my configuration.

2022-03-20 16:41:30,151 - doods.doods - ERROR - Could not create detector deepstack/dark: No module named 'models.yolo'
2022-03-20 16:41:30,151 - doods.doods - ERROR - Could not create detector deepstack/combined: No module named 'models.yolo'

@snowzach
Copy link
Owner

Are you able to share a model?

@JustinGeorgi
Copy link
Author

My deepstack/dark model is based on the pt file that can be downloaded here: https://github.com/OlafenwaMoses/DeepStack_ExDark/releases/tag/v1

Given that I do get it to work with the deepstack server, I assume the file I downloaded is complete and intact. But here's my local copy as well:
https://drive.google.com/file/d/1lM4QAEQx83Tb7j1Hxqz4Yv9mGW3mYq16

@snowzach
Copy link
Owner

Okay, I think I fixed part of the issue. It was missing some of the deepstack trainer files it needed to start the dark model. I pushed an image if you want to try that. The issue still remains if you also load the latest yolo model as well, it will print the other error about mismatched tensor sizes. I am still trying to figure that one out.

@JustinGeorgi
Copy link
Author

JustinGeorgi commented Mar 21, 2022

The new image works as advertised. As long as I don't load up pytorch, both my deepstack based models now work without errors so that's big step in the right direction.

@ozett
Copy link

ozett commented Mar 21, 2022

i got the downloaded openlogo.pt model to work
with the yolo5 "detect.py" script. in my first experiments:

#28 (comment)

so i assume, i could be working like yolo5 in the doods2-envrionment . without changing the model.pt file.
but i am not capable to analyse the "detect.py " loading process.

but maybe that hint helps you

@snowzach
Copy link
Owner

Okay, I hacked together something. I don't love it but it works. It basically tries the new model way of doing it and if fails it reverts back to the old way. It shouldn't add too much delay. Let me know if it works for you.

@ozett
Copy link

ozett commented Mar 22, 2022

image

@ozett
Copy link

ozett commented Mar 22, 2022

nope. not really....

image

@ozett
Copy link

ozett commented Mar 22, 2022

works with openlogo config only....

image

not with more config-options like normal -> #38 (comment)
than still a failure:

Toggle the Error-Report

2022-03-22 07:38:46,418 - uvicorn.error - ERROR - Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in __call__
    task_group.cancel_scope.cancel()
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 572, in __aexit__
    raise ExceptionGroup(exceptions)
anyio._backends._asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
----------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in __call__
    response = await self.dispatch_func(request, call_next)
  File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
    raise e from None
  File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
    response = await call_next(request)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
    raise RuntimeError("No response returned.")
RuntimeError: No response returned.
----------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
    await self.app(scope, request.receive, send_stream.send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 226, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 159, in run_endpoint_function
    return await dependant.call(**values)
  File "/opt/doods/api.py", line 111, in image
    detect_response = self.doods.detect(detect_request)
  File "/opt/doods/doods.py", line 127, in detect
    ret = detector.detect(image)
  File "/opt/doods/detectors/deepstack.py", line 45, in detect
    results = self.torch_model(image, augment=False)[0]
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/root/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py", line 126, in forward
    return self._forward_once(x, profile, visualize)  # single-scale inference, train
  File "/root/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py", line 149, in _forward_once
    x = m(x)  # run
  File "/usr/local/lib/python3.8/dist-packages/torch/nn/modules/module.py", line 1102, in _call_impl
    return forward_call(*input, **kwargs)
  File "/root/.cache/torch/hub/ultralytics_yolov5_master/models/yolo.py", line 58, in forward
    self.grid[i], self.anchor_grid[i] = self._make_grid(nx, ny, i)
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]

2022-03-22 07:38:46,423 - uvicorn.access - INFO - 192.168.14.135:49687 - "POST /image HTTP/1.1" 500

@snowzach
Copy link
Owner

I had to fix an issue with no detections but it seems to work fine for me with this config

logger:
  level: debug
doods:
  detectors:
    - name: default
      type: tflite
      modelFile: models/coco_ssd_mobilenet_v1_1.0_quant.tflite
      labelFile: models/coco_labels0.txt
    - name: logos
      type: deepstack
      modelFile: models/openlogo.pt
    - name: dark
      type: deepstack
      modelFile: models/dark.pt
    - name: lp
      type: deepstack
      modelFile: models/licence-plate.pt
    - name: yolo5
      type: pytorch
      modelFile: ultralytics/yolov5,yolov5s

Make sure you don't have the yolo source files sitting around anywhere, especially in your models directory as it can inadvertently import that.

@snowzach
Copy link
Owner

So this is interesting... If you load pytorch/yolo before deepstack models, it will fail. If you load deepstack models first, it works fine...

@ozett
Copy link

ozett commented Mar 22, 2022

So this is interesting... If you load pytorch/yolo before deepstack models, it will fail. If you load deepstack models first, it works fine...

i will try this order, seems doable

@ozett
Copy link

ozett commented Mar 22, 2022

looks like a hit.

then i would like to thank you very much for this. i am so glad that you found time to look for it. maybe you will also find the real error. then just post here. i like to test .
now i'll try to build a node-red flow that will be fed with the logos. thanks again so much!

image

@JustinGeorgi
Copy link
Author

Thank you! That works for me too (as long as the config order is correct). I'll consider this issue closed, even if this is only a temporary fix till you find a solution you like better.

@ozett
Copy link

ozett commented Mar 22, 2022

sorry to bother again, but please try this image (will fail):

thumbnail

with this:

image

@ozett
Copy link

ozett commented Mar 22, 2022

log-output:

Toggle the Error-Report

Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in __call__
    response = await self.dispatch_func(request, call_next)
  File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
    raise e from None
  File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
    response = await call_next(request)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
    raise RuntimeError("No response returned.")
RuntimeError: No response returned.
----------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
    await self.app(scope, request.receive, send_stream.send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 226, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 159, in run_endpoint_function
    return await dependant.call(**values)
  File "/opt/doods/api.py", line 46, in detect
    detect_response = self.doods.detect(detect_request)
  File "/opt/doods/doods.py", line 127, in detect
    ret = detector.detect(image)
  File "/opt/doods/detectors/deepstack.py", line 49, in detect
    for *xyxy, conf, cls in reversed(results):
TypeError: 'NoneType' object is not reversible

2022-03-22 15:30:43,582 - uvicorn.access - INFO - 192.168.14.211:36942 - "POST /detect HTTP/1.1" 500
2022-03-22 15:31:29,990 - uvicorn.error - ERROR - Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/protocols/http/h11_impl.py", line 373, in run_asgi
    result = await app(self.scope, self.receive, self.send)
  File "/usr/local/lib/python3.8/dist-packages/uvicorn/middleware/proxy_headers.py", line 75, in __call__
    return await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/applications.py", line 208, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/applications.py", line 112, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/errors.py", line 159, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 57, in __call__
    task_group.cancel_scope.cancel()
  File "/usr/local/lib/python3.8/dist-packages/anyio/_backends/_asyncio.py", line 572, in __aexit__
    raise ExceptionGroup(exceptions)
anyio._backends._asyncio.ExceptionGroup: 2 exceptions were raised in the task group:
----------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 55, in __call__
    response = await self.dispatch_func(request, call_next)
  File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 172, in dispatch_middleware
    raise e from None
  File "/usr/local/lib/python3.8/dist-packages/prometheus_fastapi_instrumentator/instrumentation.py", line 169, in dispatch_middleware
    response = await call_next(request)
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 37, in call_next
    raise RuntimeError("No response returned.")
RuntimeError: No response returned.
----------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/dist-packages/starlette/middleware/base.py", line 30, in coro
    await self.app(scope, request.receive, send_stream.send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 82, in __call__
    raise exc
  File "/usr/local/lib/python3.8/dist-packages/starlette/exceptions.py", line 71, in __call__
    await self.app(scope, receive, sender)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 656, in __call__
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 259, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.8/dist-packages/starlette/routing.py", line 61, in app
    response = await func(request)
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 226, in app
    raw_response = await run_endpoint_function(
  File "/usr/local/lib/python3.8/dist-packages/fastapi/routing.py", line 159, in run_endpoint_function
    return await dependant.call(**values)
  File "/opt/doods/api.py", line 111, in image
    detect_response = self.doods.detect(detect_request)
  File "/opt/doods/doods.py", line 127, in detect
    ret = detector.detect(image)
  File "/opt/doods/detectors/deepstack.py", line 49, in detect
    for *xyxy, conf, cls in reversed(results):
TypeError: 'NoneType' object is not reversible


<details>

@ozett
Copy link

ozett commented Mar 22, 2022

its not because of the tiny size.

logotest3

this is 10px smaller than the tumbnail.jpg, but still works.
must be something else

@ozett
Copy link

ozett commented Mar 22, 2022

a bigger image, that dont work

logotest-snapshot

@themoment some github failures?

@ozett
Copy link

ozett commented Mar 22, 2022

sometimes its working,

but somehow i miss the marked image in the response.
do i miss an option in the request?
edit: found the option for image-request. sorry, my bad

image

@snowzach snowzach reopened this Mar 23, 2022
@snowzach
Copy link
Owner

@ozett make sure you are pulling the latest image. I made a change that should fix the NoneType error you see. @JustinGeorgi it should automatically reorder the detectors so you don't need to worry about the order you put in your config.

@ozett
Copy link

ozett commented Mar 23, 2022

i will try next 60 minutes... thx. (great news!)

@ozett
Copy link

ozett commented Mar 23, 2022

pulled in milliseconds, running fine now with my first failure-image.
will let my new flow run over it for today for test.
really GREAT, thanks a lot, appreciate this!

doods2 is getting more and more multifunctional and failsafe!

image

@ozett
Copy link

ozett commented Mar 23, 2022

flow is running, needs fine-tuning and for croping the region
i was wondering where is your image origin ?
where is top and bottom of the image? like on opencv?

i need to provide region-coordinates for detections of x,y,w,h and cant fiddle it right

TESTIMAGE
https://www.clickedstudios.com/wp-content/uploads/2019/02/2019-luxury-top-brands-feature.png

image

@ozett
Copy link

ozett commented Mar 23, 2022

figured it out, activated lost memory.
coordinates are nomalized.. -> https://www.tensorflow.org/api_docs/python/tf/image/draw_bounding_boxes

@snowzach
Copy link
Owner

Okay, closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants