snowzach / doods2

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

[FR]: Openlogo-model: logo-detection with pytorch #28

Closed ozett closed 2 years ago

ozett commented 2 years ago

maybe this is a pytorch model like yolo5 and can be integrated? is not on the torch-hub. so this must be done manually?

Modell: https://github.com/OlafenwaMoses/DeepStack_OpenLogo/releases/download/v1/openlogo.pt

Site: https://github.com/OlafenwaMoses/DeepStack_OpenLogo

image

ozett commented 2 years ago

looks like it could be done like yolov5

image

snowzach commented 2 years ago

Yeah, Deepstack looks to be a lot of helper stuff around the yolo models. I was able to add support for it. I added a new model type of deepstack. You can download the .pt model and set type: deepstack and modelFile: models/openlogo.pt

ozett commented 2 years ago

whats this?

doods.doods - ERROR - Could not create detector deepstack/logo: PytorchStreamReader failed reading zip archive: failed finding central directory

image

config.yaml (unsure what image-size needed for openlogo.pt...)

    - name: logo
      type: deepstack
      modelFile: models/openlogo.pt
      width: 224
      height: 224
      numThreads: 0
      numConcurrent: 4
ozett commented 2 years ago

my model file was incomplete from a broken download. downloaded it again. and looks better.

can you cache the downloaded models (like yolov5 does it), so they are not re-downloaded every start? edit: found this: image maybe you show an explicit example for clarification purpose?

image

ozett commented 2 years ago

image size error? what size did you use in the config.yaml for testing?

edit: 640 is correct? https://github.com/snowzach/doods2/blob/9dcda621cec9c1ddb487737383194f0c02dcde99/detectors/deepstack.py#L60

image

ozett commented 2 years ago

yolov5 works fine: image

ozett commented 2 years ago

whats this error?

image

ozett commented 2 years ago

as openlogo.pt worked in my test like a yolo model, may i have to configure it in dood2.yaml simply as yolov5?

edit: Another ❓ arises: HOW ould i configure yolov5 with self-trained weights for yolov5? I have a cat-model trained for yolov5. whats the syntax for dood2.yaml?

edit: can not configure like yolov5. image

   - name: logotorch
      type: pytorch
      modelFile: models/openlogo.pt,openlogo.pt
      width: 640
      height: 640
      numThreads: 0
      numConcurrent: 4
ozett commented 2 years ago

maybe related? -> https://github.com/ultralytics/yolov5/issues/5234#issuecomment-946854334

openlogo still throws error:

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, 48, 80, 2]

.

image

config:

   - name: logodeep
      type: deepstack
      modelFile: models/openlogo.pt
      width: 640
      height: 640
      numThreads: 0
      numConcurrent: 4
snowzach commented 2 years ago

I don't totally understand the deepstack framework but at a glance it definitely looks like it's related. It looks like something changed from Yolov6. I will try to figure out how to make it use a yolo5 model. I am buried at the moment, not sure how soon I can get to it though.

snowzach commented 2 years ago

I think this might be a different issue. Openlogo works fine for me.

ozett commented 2 years ago

what causes my error? i tested only with one image. maybe that image? i will check

snowzach commented 2 years ago

Yeah, any image that fails will help me.

ozett commented 2 years ago

https://github.com/snowzach/doods2/issues/38#issuecomment-1073282096

snowzach commented 2 years ago

Okay, closing this ticket again in favor of the other one