Skip to content

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

@dewball345

Description

@dewball345

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions