nsfw
nsfw copied to clipboard
How to predict using ckpt files?
Hi! I have trained a new model via running nsfw_main_finetune.py and got some ckpt files. But how may I use ckpt files to predict a test image without converting them to pb files? thanks a lot !
if flags_obj.export_dir is not None:
# Exports a saved model for the given classifier.
dtype=flags_core.get_tf_dtype(flags_obj)
input_receiver_fn = export.build_tensor_serving_input_receiver_fn(
shape, batch_size=flags_obj.batch_size, dtype=dtype)
classifier.export_savedmodel(flags_obj.export_dir, input_receiver_fn)
you can set export_dir at predict process to export saved model and use nsfw_predict.py to predict,or you need to restore ckpt files by youself
Thank you for answering. So do I have to export the model during the training process? Or it is also possible if I do it after training, and export the saved model from ckpt to pb files? Thanks