Calamari-OCR / calamari

Line based ATR Engine based on OCRopy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

display the gaph of a .ckpt model

Tailor2019 opened this issue · comments

Hello!
@ChWick
@andbue
I'm trying to display the architecture of a .ckpt model
I'm using this code
import tensorflow.compat.v1 as tf tf.disable_v2_behavior() tf.train.import_meta_graph("./0.ckpt.h5") for n in tf.get_default_graph().as_graph_def().node: print(n) with tf.Session() as sess: writer = tf.summary.FileWriter("./output/", sess.graph) writer.close()
But it not working
Please what code to use with these options
--model.layers.0.name --model.layers.0.filters --model.layers.0.kernel_size --model.layers.0.strides --model.layers.0.padding --model.layers.0.activation --model.layers.1.name --model.layers.1.name ................... to display the architecture of a particular model

Have a look at

def from_checkpoint(params: PredictorParams, checkpoint: str, auto_update_checkpoints=True):
DeviceConfig(params.device) # Device must be specified first
ckpt = SavedCalamariModel(checkpoint, auto_update=auto_update_checkpoints)
scenario_params = CalamariScenario.params_from_dict(ckpt.dict)
scenario = CalamariScenario(scenario_params)
predictor = Predictor(params, scenario.create_data())
predictor.set_model(
keras.models.load_model(
ckpt.ckpt_path + ".h5",
custom_objects=CalamariScenario.model_cls().all_custom_objects(),
)
)
return predictor

on how to load a saved model.

Hello!
@andbue
Thanks for your help
But the solution returns me this error :
Data loss: not an sstable (bad magic number): perhaps your file is in a different file format and you need to use a different restore operator?
What can I use as restore operator please to solve this problem?
Thanks a lot!

Without your code I can only guess here: maybe the file path is wrong? It has to be something like "path/to/model/0.ckpt" without any further file endings.

Thanks I resolve this problem.