Cannot read property 'children' of undefined with using Tensorflow Object Detection API model in tfjs

Please make sure that this is a bug. As per our
GitHub Policy,
we only address code/doc bugs, performance issues, feature requests and
build/installation issues on GitHub. tag:bug_template

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow.js): Yes
  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 10
  • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: N/A
  • TensorFlow.js installed from (npm or script link): npm install @tensorflow/tfjs
  • TensorFlow.js version (use command below): 3.6.0
  • Browser version: Chrome 90 on Windows 10
  • Tensorflow.js Converter Version: 3.6.0

Hyperlinks are capitalized to prevent confusion(because the color settings(and blue filter) on my monitor make it hard to see the difference between them)

Describe the current behavior
I used transfer learning using a pretrained model from the Tensorflow Object Detection API, which i converted to tensorflow-js using the tensorflow-converter API in python. View the ipynb notebook HERE. I then followed @hugozanini’s REPO which had a template for using your tensorflow object detection models in javascript; I copied the index.json file and put it into a sandbox, replacing his model.json file with mine. The repo which contains it can be found here

Describe the expected behavior
I was expecting the model to work and the program to run normally, like it did in this DEMO. Instead, I got

index.js:1437 TypeError: Cannot read property 'children' of undefined
    at operation_mapper.js:409
    at Array.forEach (<anonymous>)
    at operation_mapper.js:403
    at Array.forEach (<anonymous>)
    at OperationMapper.mapFunction (operation_mapper.js:401)
    at operation_mapper.js:163
    at Array.reduce (<anonymous>)
    at OperationMapper.transformGraph (operation_mapper.js:162)
    at GraphModel.loadSync (graph_model.js:159)
    at GraphModel._callee$ (graph_model.js:119)
    at tryCatch (runtime.js:62)
    at Generator.invoke [as _invoke] (runtime.js:288)
    at Generator.prototype.<computed> [as next] (runtime.js:114)
    at asyncGeneratorStep (asyncToGenerator.js:3)
    at _next (asyncToGenerator.js:25)

Standalone code to reproduce the issue
Provide a reproducible test case that is the bare minimum necessary to generate
the problem. If possible, please share a link to Colab/CodePen/any notebook.

HERE is the colab notebook I used to train my model
HERE is the sandbox where I tried to use the tensorflow.js model

Other info / logs Include any logs or source code that would be helpful to
diagnose the problem. If including tracebacks, please include the full
traceback. Large logs and files should be attached.

Error Message:

index.js:1437 TypeError: Cannot read property 'children' of undefined
    at operation_mapper.js:409
    at Array.forEach (<anonymous>)
    at operation_mapper.js:403
    at Array.forEach (<anonymous>)
    at OperationMapper.mapFunction (operation_mapper.js:401)
    at operation_mapper.js:163
    at Array.reduce (<anonymous>)
    at OperationMapper.transformGraph (operation_mapper.js:162)
    at GraphModel.loadSync (graph_model.js:159)
    at GraphModel._callee$ (graph_model.js:119)
    at tryCatch (runtime.js:62)
    at Generator.invoke [as _invoke] (runtime.js:288)
    at Generator.prototype.<computed> [as next] (runtime.js:114)
    at asyncGeneratorStep (asyncToGenerator.js:3)
    at _next (asyncToGenerator.js:25)
1 Like

Generally I suggest you to select tags from the menu on a new thread cause specialized technical team members could be subscribed only to a tag subset (e.g. in this case I suggest tfjs and help_request)

1 Like

Unfortunately, I don’t have the ability to set tags. I can only set the title, description, and category.

1 Like

Did you ever get this resolved? I’m running into the same error running tfjs-node v3.7.0 or v 3.0.0-rc.1

v3.7.0
TypeError: Cannot read property ‘output’ of undefined

v3.0.0-rc1
TypeError: Cannot read property ‘children’ of undefined