[英]How can I “see” the model/network when loading a model from tfhub?
[英]Number of parameters of a TFHub model
我想計算從 TensorFlow Hub 加載的對象檢測模型的參數數量,例如https://tfhub.dev/tensorflow/ssd_mobilenet_v2/2 。 我試過這個:
hub_model = hub.load("https://tfhub.dev/tensorflow/ssd_mobilenet_v2/2")
print(len(hub_model.signatures['serving_default'].variables))
但是輸出不是很可讀,我什至不確定它是否正確。 我也試過這種方式:
malli = hub.KerasLayer("https://tfhub.dev/tensorflow/ssd_mobilenet_v2/2")
print("Thickness of the model:", len(malli.weights))
但它只返回一個長度為 0 的空列表 []。
能夠在這些模型上使用 Keras summary() 方法會很好,但不能在 KerasLayer 上調用它,那么將此層合並到具有 Keras.Sequential 的模型中會起作用嗎?
有一個工具可以計算檢查點文件的參數總數: https : //github.com/tensorflow/tensorflow/blob/master/tensorflow/python/tools/inspect_checkpoint.py
$ python inspect_checkpoint.py --file_name=/checkpoint/file/name --all_tensors
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.