TFJS-object-detection icon indicating copy to clipboard operation
TFJS-object-detection copied to clipboard

[Solved] Unknown op 'TensorListFromTensor'

Open linxi-1214 opened this issue 5 years ago • 12 comments

Unhandled Rejection (TypeError): Unknown op 'TensorListFromTensor'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp()
▼ 22 stack frames were expanded.
(anonymous function)
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:5048
executeOp$16
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:5050
l
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:5420
e.processStack
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:5428
e.<anonymous>
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:5398
(anonymous function)
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:137
next
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:150
(anonymous function)
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:57
__awaiter
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:34
e.executeWithControlFlow
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:5360
e.<anonymous>
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:5342
(anonymous function)
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:137
next
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:150
(anonymous function)
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:57
__awaiter
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:34
e.executeAsync
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:5331
e.<anonymous>
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:5601
(anonymous function)
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:137
next
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:150
(anonymous function)
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:57
__awaiter
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:34
e.executeAsync
node_modules/@tensorflow/tfjs-converter/dist/tf-converter.esm.js:5596
▲ 22 stack frames were expanded.
App._this.detectFrame
src/index.js:67
  64 | 
  65 | detectFrame = (video, model) => {
  66 |     tf.engine().startScope();
> 67 |     model.executeAsync(this.process_input(video)).then(predictions => {
     | ^  68 |     this.renderPredictions(predictions, video);
  69 |     requestAnimationFrame(() => {
  70 |       this.detectFrame(video, model);
View compiled
(anonymous function)
src/index.js:57
  54 | 
  55 | Promise.all([modelPromise, webCamPromise])
  56 |   .then(values => {
> 57 |     this.detectFrame(this.videoRef.current, values[0]);
     | ^  58 |   })
  59 |   .catch(error => {
  60 |     console.error(error);
View compiled

linxi-1214 avatar Mar 26 '21 08:03 linxi-1214

It worked well with the kangaroo-dector, but not workered with web_model. and tree of my web_model directory like:

-rw-r--r--  1 qing  staff  4194304  3 26 16:19 group1-shard1of5.bin
-rw-r--r--  1 qing  staff  4194304  3 26 16:19 group1-shard2of5.bin
-rw-r--r--  1 qing  staff  4194304  3 26 16:19 group1-shard3of5.bin
-rw-r--r--  1 qing  staff  4194304  3 26 16:19 group1-shard4of5.bin
-rw-r--r--  1 qing  staff  1647884  3 26 16:19 group1-shard5of5.bin
-rw-r--r--  1 qing  staff   376285  3 26 16:19 model.json

the size of group1-shard5of5.bin is not same with kangaroo-detector, is it the reason?

linxi-1214 avatar Mar 26 '21 08:03 linxi-1214

Hi @linxi-1214, not all TensorFlow operations are supported so some models can be incompatible with TensorFlow.js — See this list for which ops are currently supported.

The reason why the mobile-net is used is that all the model operations are compatible with tensorflow.js. it looks like you're using a different model containing an incompatible operation.

hugozanini avatar Mar 29 '21 23:03 hugozanini

Hi @hugozanini , I have encountered the same issue but working on your model and data (I followed your tutorial on tensorflow blog). It's a very strange behaviour because your model from github works like a charm but my model crashes during conversion with log: ValueError: Unsupported Ops in the model before optimization TensorListReserve, TensorListFromTensor, TensorListStack

How comes that exact same step by step solution results in different model? I would very much appriciate your help.

TrybusRafalJan avatar Apr 19 '21 11:04 TrybusRafalJan

Hi, @TrybusRafalJan that's really strange.... I guess it could be a different choice that you made during the model conversion to the tf.js layers format. Do you mind sharing how you choose the parameters?

hugozanini avatar Apr 25 '21 15:04 hugozanini

Hi @hugozanini , thanks for your answer. I manage to solve this issue. It was caused by the mix of minor errors.(versions incompatibility ) Finally I made sure that I was running the latest tfjsconverter (in virtual env) and the latest tfjs library in my npm project and all went well. Best regards

TrybusRafalJan avatar May 02 '21 16:05 TrybusRafalJan

hi @TrybusRafalJan , I am trying to reproduce the results or checking the inference on server using the provided json files in kangaroo directory but there are no predictions or bboxes showing, can you please share the json or model files and steps to test inference on local webcam?

kalagulla111 avatar Oct 04 '21 12:10 kalagulla111

The same problem (Unknown op 'TensorListFromTensor') occurs to me when following your tutorial from https://towardsdatascience.com/custom-real-time-object-detection-in-the-browser-using-tensorflow-js-5ca90538eace does anyone know why this happens?

pandadom avatar Dec 15 '21 08:12 pandadom

it turns out that the tensorflow javascript in npm need to be forced to updated to the latest version (>3.x) then this error does not occur any longer

pandadom avatar Dec 16 '21 11:12 pandadom

can you provide your currently code please

Script-hpp avatar Jan 31 '23 22:01 Script-hpp

I cannot whatsoever get Glitch to do any inferencing with my model. I trained it on Google Colab and it does detection when I test the saved model but I follow the steps in his guide and it doesn't work.

FirstOrderCoder avatar Apr 19 '23 19:04 FirstOrderCoder

who was able to solve this problem ? × Unhandled Rejection (TypeError): Unknown op 'TensorListFromTensor'. File an issue at https://github.com/tensorflow/tfjs/issues so we can add it, or register a custom execution with tf.registerOp() ▶ 22 stack frames were collapsed. App._this.detectFrame D:/TFJS-object-detection/src/index.js:66 63 | 64 | detectFrame = (video, model) => { 65 | tf.engine().startScope();

66 | model.executeAsync(this.process_input(video)).then(predictions => { | ^ 67 | this.renderPredictions(predictions, video); 68 | requestAnimationFrame(() => { 69 | this.detectFrame(video, model); View compiled (anonymous function) D:/TFJS-object-detection/src/index.js:56 53 | 54 | Promise.all([modelPromise, webCamPromise]) 55 | .then(values => { 56 | this.detectFrame(this.videoRef.current, values[0]); | ^ 57 | }) 58 | .catch(error => { 59 | console.error(error);

ElyorKHodjimetov avatar Aug 03 '23 11:08 ElyorKHodjimetov

it turns out that the tensorflow javascript in npm need to be forced to updated to the latest version (>3.x) then this error does not occur any longer

Can you elaborate on how you solved the problem

ElyorKHodjimetov avatar Aug 03 '23 11:08 ElyorKHodjimetov