Skip to content

Theano Support#47

Open
alecGraves wants to merge 23 commits intoallanzelener:masterfrom
alecGraves:keras_backend
Open

Theano Support#47
alecGraves wants to merge 23 commits intoallanzelener:masterfrom
alecGraves:keras_backend

Conversation

@alecGraves
Copy link
Copy Markdown
Contributor

@alecGraves alecGraves commented Jun 30, 2017

I got yad2k.py, test_yolo.py, and the training part of retrain_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 the train_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.

@alecGraves alecGraves changed the title Theano upport (not ready yet) Theano Support (not ready yet) Jun 30, 2017
@alecGraves
Copy link
Copy Markdown
Contributor Author

Addresses #1

@allanzelener
Copy link
Copy Markdown
Owner

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.

@alecGraves
Copy link
Copy Markdown
Contributor Author

alecGraves commented Jul 12, 2017

The changes I made seem to have made running the model 3x slower (probably due to converting all of the post-processing to numpy). It could just be how I set up the final evaluation, but converting final processing to a backend/layers is probably a good idea.

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.

@alecGraves
Copy link
Copy Markdown
Contributor Author

alecGraves commented Jul 19, 2017

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.
Edit: Documentation for retraining should be added to the readme, and switching back to hdf5 for training data might be good.

(Future) Adding support for fit generator with full data augmentation for boxes would be cool. (right after that custom loss function)

@alecGraves alecGraves changed the title Theano Support (not ready yet) Theano Support Jul 19, 2017


def yolo_head(feats, anchors, num_classes):
def yolo_head(feats, anchors, num_classes): # TODO: Turn this into a layer?
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Successfully merging this pull request may close these issues.

3 participants