thtrieu / darkflow

Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices
GNU General Public License v3.0
6.13k stars 2.08k forks source link

training layer selection #163

Open ghost opened 7 years ago

ghost commented 7 years ago

hi is there any way to train selected layers only and fix the rest of the layers by setting their "trainable" option to False? i heard that in CNN, lower layers can be widely used for general objects but higher and deeper layers are very specific to recent training datasets. so fixing lower layers and only fine-tuning higher or the highest layer not only saves a lot of time but also give

ghost commented 7 years ago

not so bad performance

thtrieu commented 7 years ago

I had the intention to build this long ago, if I remember correctly, just uncomment https://github.com/thtrieu/darkflow/blob/master/net/build.py#L48 for training only last layer, change 1 to any other number for training that many last layer. You can see the result in the printed table of layers, column Train?.

Someone could certainly add a FLAGS for this.

ghost commented 7 years ago

um i will check as soon as class ends! thanks!

crazylyf commented 7 years ago

@thtrieu It's easy to add an FLAG to control the range of training, but the saved checkpoints could not be loaded, and throw errors like:

2017-06-30 13:17:23.109268: W tensorflow/core/framework/op_kernel.cc:1158] Not found: Key 0-convolutional/biases not found in checkpoint

Any suggestion? thx!