nsfw icon indicating copy to clipboard operation
nsfw copied to clipboard

How to predict using ckpt files?

Open zealot5209 opened this issue 6 years ago • 2 comments

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 !

zealot5209 avatar Feb 22 '19 10:02 zealot5209

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

rockyzhengwu avatar Feb 22 '19 14:02 rockyzhengwu

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

zealot5209 avatar Feb 28 '19 11:02 zealot5209