Retrain Tensorflow final layer but still use previous Imagenet classes
Asked Answered
L

2

11

My objective is to "add" more classes to the existing 1000 Imagenet classes that came with Tensorflow Inception. Now I could just re-run the whole thing by training from scratch using bazel-bin/inception/imagenet_train but that would take a long time especially each time I want to add a new class.

Is it possible to use bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir ~/flower_photos but then add to the existing label output file?

Sorry I am a newbie.

Lyman answered 5/5, 2017 at 7:10 Comment(2)
I want to emphasize for others who are attempting to answer this question that you are looking to add new classes and keep the existing classes. Great question.Argentic
Hi. I would like to know if there is something new in this field?Genova
L
1

You could brazenly add a second last layer, that also refers to the second to last layer... Of course, that's kind of a hack and not practical if you wanna do the procedure multiple times...

Alternatively, you replace the output layer and before you do that, you save the previous weights for that layer manually and, then reload the whole net with something like this optimistic restore and add the old weights, that you also have to reload separately, to your now bigger weight-matrix manually.

enter image description here

Lomasi answered 6/8, 2017 at 7:43 Comment(0)
P
0

There is no standard solution to adding new classes to a trained classifier network and it is not a trivial task. I would suggest reading Learning Without Forgetting and its related work to get an overview of existing methods and choose one of those afterwards.

Precedential answered 8/8, 2017 at 11:35 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.