tensorflow / tfjs

A WebGL accelerated JavaScript library for training and deploying ML models.
https://js.tensorflow.org
Apache License 2.0
18.35k stars 1.92k forks source link

TypeError: Cannot read properties of undefined (reading 'map') #7337

Closed lebron8dong closed 1 year ago

lebron8dong commented 1 year ago

const model=await tf.loadGraphModel("./model.json")//model: https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/default/1 tfvis.show.modelSummary({name: 'Model Architecture', tab: 'Model'}, model); error: Cannot read properties of undefined (reading 'map')

model.summary(); error:model.summary is not a function

lebron8dong commented 1 year ago

tf.loadGraphModel("https://tfhub.dev/google/tfjs-model/imagenet/mobilenet_v2_050_224/classification/1/default/1", { fromTFHub: true }); tfvis.show.modelSummary({name: 'Model Architecture', tab: 'Model'}, model); error:TypeError: Cannot read properties of undefined (reading 'map')

model.summary(); error:model.summary is not a function

shmishra99 commented 1 year ago

Hi @lebron8dong , I apologize for the delay in my response. tf.loadGraphModel doesn't have a built-in summary() function. Could you please follow this document? If you need to obtain a summary of the model's structure with a graph model, you can use the model.artifacts.modelTopology. modelTopology attribute will provide you with the JSON representation of the model's structure. Please follow the code-snippet :

const model= await tf.loadGraphModel("https://tfhub.dev/tensorflow/tfjs-model/blazeface/1/default/1",{ fromTFHub: true })
console.log(model.artifacts.modelTopology)

Let me know, if i have missed something. Thank You!

github-actions[bot] commented 1 year ago

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

github-actions[bot] commented 1 year ago

This issue was closed due to lack of activity after being marked stale for past 7 days.

google-ml-butler[bot] commented 1 year ago

Are you satisfied with the resolution of your issue? Yes No