TensorFlow.js returning TypeError: Cannot read property 'concat' of undefined when loading models

白昼怎懂夜的黑 提交于 2019-12-10 12:04:58

问题


Trying to recreate the emoji scavenger hunt from google and it returned me the following error:

Here is my only code that is running at the moment:

import * as tf from '@tensorflow/tfjs';
import { loadFrozenModel, FrozenModel } from '@tensorflow/tfjs-converter';

export default class MobileNet {
    constructor() { }

    async load() {
        const MODEL_URL = '/assets/project-gaea/models/web_model.pb';
        const WEIGHTS_URL = '/assets/project-gaea/models/weights_manifest.json';
        const model = await loadFrozenModel(MODEL_URL, WEIGHTS_URL);
        const cat = document.getElementById('cat');
        model.execute({input: tf.fromPixels(cat)});
    }
}

回答1:


Discovered that the error was being caused by an upgraded version of tfjs-core and tfjs-converter. I downgraded it according to the demo and seems to be working. a long term solution as it still doesnt solve the problem for new developers. Raised it in GitHub too



来源:https://stackoverflow.com/questions/50521961/tensorflow-js-returning-typeerror-cannot-read-property-concat-of-undefined-wh

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!