akirasosa / mobile-semantic-segmentation

Real-Time Semantic Segmentation in Mobile device
MIT License
715 stars 135 forks source link

How to verify a check point model? #8

Closed noguxun closed 7 years ago

noguxun commented 7 years ago

I try to verify a check point model by firstly try to convert it to pb format.

python tf-converter.py --input_model_path artifacts/checkpoint_weights.10--0.51.h5

but I got an error like below

Using TensorFlow backend.
Traceback (most recent call last):
  File "tf-converter.py", line 58, in <module>
    main(**vars(args))
  File "tf-converter.py", line 24, in main
    model = load_model(input_model_path, custom_objects=custom_objects())
  File "/home/ubuntu/.pyenv/versions/keras/lib/python3.5/site-packages/keras/models.py", line 238, in load_model
    raise ValueError('No model found in config file.')
ValueError: No model found in config file.

Do you know what could be wrong?

Is there any easy way to verify the h5 model directly on the PC?

akirasosa commented 7 years ago

@noguxun tf-converter.py supposes that the input model is a complete model (model definition + weights).

Your model is weight only. So, you have to build model once, and then you have to load weights into the built model.

 model.load_weights('checkpoint_weights.10--0.51.h5', by_name=True)
noguxun commented 7 years ago

@akirasosa Got it! great many thanks!