
function detect() {

    for(let i=0; i < items.length; i++){
        var bbox = items[i]["bbox"];

        drawBox(bbox[0], bbox[1], bbox[2], bbox[3]);
    }

}

const img = document.getElementById('img');
var items;

// Load the model.
cocoSsd.load().then(model => {
  // detect objects in the image.
  model.detect(img).then(predictions => {
    items = predictions;
    console.log('Predictions: ', predictions);
  });
});