DrSleep / tensorflow-deeplab-resnet

DeepLab-ResNet rebuilt in TensorFlow
MIT License
1.25k stars 429 forks source link

In train.py how to do validation as well as training #157

Closed mokii closed 6 years ago

mokii commented 6 years ago

I want to do validation every 1000 iters to select the model. But in the train.py code, the data is feed into the model when initializing the model net = DeepLabResNetModel({'data': image_batch}, is_training=args.is_training, num_classes=args.num_classes) Does this mean I have to build a model to feed the training data and reload the newest parameters to build another model to feed my val data? Is it possible to ues only one model or is there some idea more efficient.

DrSleep commented 6 years ago

You do not need to reload new parameters, but you will need to build another copy of the model with `tf.variable_scope('', reuse=True)'. After that, you analogously feed the validation batch into this copy (do not forget to set is_training to False here).

On 10 January 2018 at 23:33, mokii notifications@github.com wrote:

I want to do validation every 1000 iters to select the model. But in the train.py code, the data is feed into the model when initializing the model net = DeepLabResNetModel({'data': image_batch}, is_training=args.is_training, num_classes=args.num_classes) Is this mean I have to build a model to feed the training data and reload the newest parameters to build another model to feed my val data? Is it possible to ues only one model or is there some idea more efficient.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/DrSleep/tensorflow-deeplab-resnet/issues/157, or mute the thread https://github.com/notifications/unsubscribe-auth/AHemmOhL0X0R-orrOwzvPvuAPGl-UsY2ks5tJLUvgaJpZM4RZSaK .

mokii commented 6 years ago

@DrSleep Thank you very much. Helped me a lot!