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.

HP.
  • 19,226
  • 53
  • 154
  • 253
  • 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. – Anton Codes May 16 '17 at 12:57
  • Hi. I would like to know if there is something new in this field? – Marion Oct 06 '17 at 15:25

2 Answers2

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

Xethoras
  • 26
  • 5
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.

BlueSun
  • 3,541
  • 1
  • 18
  • 37