Closed JustinGeorgi closed 2 years ago
maybe needs to investigate it its a compatible-bug between models trained on older yolo versions?
see -> https://github.com/ultralytics/yolov5/issues/5234#issuecomment-946854334 or my comment on openlogo.pt-model -> https://github.com/snowzach/doods2/issues/28#issuecomment-1072968647
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
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?
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
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
Oops, whats this? i left only openlogo in the config alone:
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:
i have to have yolo5 in the config, than no error on startup. but still processing error
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
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:
Uhhhh, i was behind the "latest" docker...
PULL!
and test now...
did not help:
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
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
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.
single config of deepstack-type with openlogo throws error on my install. cannot confirm that it works. see this error:
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'
Are you able to share a model?
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
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.
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.
i got the downloaded openlogo.pt model to work with the yolo5 "detect.py" script. in my first experiments:
https://github.com/snowzach/doods2/issues/28#issuecomment-1024890510
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
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.
nope. not really....
works with openlogo config only....
not with more config-options like normal -> https://github.com/snowzach/doods2/issues/38#issuecomment-1073274642 than still a failure:
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.
So this is interesting... If you load pytorch/yolo before deepstack models, it will fail. If you load deepstack models first, it works fine...
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
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!
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.
sorry to bother again, but please try this image (will fail):
with this:
log-output:
testimage still works: https://raw.githubusercontent.com/OlafenwaMoses/DeepStack_OpenLogo/main/images/fedex.jpg
new testimage also works: https://assets.entrepreneur.com/content/3x2/2000/20160210172912-branding-logos-companies-businesses-identity.jpeg
myimage fails:
https://user-images.githubusercontent.com/5937811/159519375-f4d7ece2-6b81-49a4-b8f5-2a909661e752.jpg
its not because of the tiny size.
this is 10px smaller than the tumbnail.jpg, but still works. must be something else
a bigger image, that dont work
@themoment some github failures?
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
@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.
i will try next 60 minutes... thx. (great news!)
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!
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
figured it out, activated lost memory. coordinates are nomalized.. -> https://www.tensorflow.org/api_docs/python/tf/image/draw_bounding_boxes
Okay, closing this issue.
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:
Both of the models work with the deepstack service itself, and doods properly reports the labels embedded in the models
so the models seem intact.
My config for the two models is minimal:
do I need more than that or is there some issue with the deepstack integration at the moment?