-
Notifications
You must be signed in to change notification settings - Fork 881
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
Theano Support #47
base: master
Are you sure you want to change the base?
Theano Support #47
Conversation
…into keras_backend
Addresses #1 |
Hi shadySource, thanks for this comprehensive PR that hits a lot of the todos I've put off! I've been super busy lately (just moved and got a new job) and so it will probably take me another few weeks to get around to reviewing and testing your PR. But giving it a quick look, it looks quite nice and like what I had in mind. |
edit: I was building a new computation graph and evaluating it for every image, which takes 0.2 seconds. To avoid this, I made yolo_head_np(), which is about 200x faster than the silliness I was doing before. |
…(), combine data processing functions
Still need to fix the paths in retrain_yolo so it does not look for model stuff in cwd. Besides this, it seems pretty ok. (Future) Adding support for fit generator with full data augmentation for boxes would be cool. (right after that custom loss function) |
x = DarknetConv2D_BN_Leaky(1024, (3, 3))(x) | ||
x = DarknetConv2D(num_anchors * (num_classes + 5), (1, 1))(x) | ||
return Model(inputs, x) | ||
|
||
|
||
def yolo_head(feats, anchors, num_classes): | ||
def yolo_head(feats, anchors, num_classes): # TODO: Turn this into a layer? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could use this if you want.
https://gist.github.com/PavlosMelissinos/162621051c906ea85b772997d982403a
I got
yad2k.py
,test_yolo.py
, and the training part ofretrain_yolo.py
to work using theano backend.The main issue I have come across is converting the output features to final boxes without using the tf session. Also, I could not figure out a way to make non max supression elegantly using the keras backend, so I ended up using a python/numpy implementation someone else made. After doing that, I just converted most of the final box processing code to numpy.
I am not sure if this is a path you want to take, as using numpy to do the final box processing may not be as fast as using custom layers.
This breaks some stuff, so It is not ready to merge yet. The final box prediction parts of
retrain_yolo.py
need to be updated, and I did not touch thetrain_overfit.py
demo.Mostly, I just wanted to share my progress and get some feedback. I did this because I needed to run this on ARM, and TensorFlow does not have support for that architecture.