简体   繁体   中英

Adding new images data to previously trained and saved tensorflow h5 model

I have a pre-trained tensorflow h5 saved model to classify images. here is the block of code:

import tensorflow as tf
model_version = "1"
model_name = "fresh-rotten-model"
model_path = os.path.join(model_name, model_version)
tf.saved_model.save(model, model_path)
model.save("fresh-rotten-model.h5")

I built a back-end that will upload new images every week using a schedule to a node server

Is there any way to add these images as a new data to train the model and build a new model without having to train the whole data set again?

You can't just add data to a model file, a model file contains only weights, not the data used in it, so you'll have to have something (supposedly your backend server) do the training every time you want to update the model. You can kind of update the model by loading it and then doing more training epochs with it with the extended dataset, but other than that, there's not much you can do.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM