So when you predict on the model that operation is async so you need to await to that to finish before you attempt to access the result object which may not have resolved yet.
For example:
let result = await objectDetector.predict(input);
let data = await result.data();
console.log(data);