schwittlick / ofxDarknet

darknet neural network addon for openFrameworks
MIT License
496 stars 89 forks source link

dst[0] = src[2] error in example-imagenet #11

Closed AndreasRef closed 7 years ago

AndreasRef commented 7 years ago

When trying to run the example-imagenet I get an error related to the update function of ofQTKitGrabber

screen shot 2017-01-25 at 11 43 14

Any idea what might be causing this?

schwittlick commented 7 years ago

Hm, this seems to be something related to your webcam setup, this is OF internal code that's having a problem. Can you run the webcam example that comes with OF without errors?

AndreasRef commented 7 years ago

Yes, also the example-yolo with webcam input without any issues

schwittlick commented 7 years ago

Interesting, since the webcam related code is identical in those two examples. I can't really do anything useful to help you, maybe clean and recompile the imagenet example, that sometimes does it for me when mystical errors occur.

AndreasRef commented 7 years ago

Okay, I'll try that. Btw: It runs for 1 frame before it crashes. If I comment out all darknet related stuff (and only draw the webcam image) it runs fine.

schwittlick commented 7 years ago

Any news on this, this seems really strange, as this OF code really has nothing to do with ofxDarknet. I'm simply copying the pixels from the webcam (https://github.com/mrzl/ofxDarknet/blob/master/src/ofxDarknet.cpp#L258-L272), so that should not have any effect here...

genekogan commented 7 years ago

@mrzl @AndreasRef i found the bug and fixed it in the osx branch. imagenet example now working for me (and very fast!). before i merge it to master i'll let marcel review it because there's a couple other changes there including having simplified the init process. marcel can you see if that works for windows and then we can merge it?

the problem was that in ofxDarknet::classify, the internal pixels of the video were being resized without telling the video object -- so when it went to draw all the pixels, they were gone. A quick fix is doing what's done in the yolo example and copying the pixels to a new ofPixels and resizing those.

genekogan commented 7 years ago

the changes are in PR 13

genekogan commented 7 years ago

also just realized, one possible issue with the merge is that one of the changes i made was fixing the following paths at the bottom of yolo9000.cfg.

tree=../../../data/cfg/9k.tree
map=../../../data/cfg/coco9k.map

i think in windows you may need to get rid of the ../../..

genekogan commented 7 years ago

this should now be fixed as of https://github.com/mrzl/ofxDarknet/pull/13, for windows and osx, on the master branch, verified working here. @AndreasRef give it a shot!