Skip to content

Conversation

@dsmilkov
Copy link
Contributor

@dsmilkov dsmilkov commented Sep 4, 2019

  • Add pre and post-process ops for the model (fast non-max-suppression)
  • Add the API for loading and running on object detection model trained by AutoML
  • Add unit tests for both node and the browser environment using a real model produced by AutoML

This change is Reviewable

Copy link
Contributor

@nsthorat nsthorat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 20 of 20 files at r1.
Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @dsmilkov and @nsthorat)


tfjs-automl/src/object_detection.ts, line 91 at r1 (raw file):

    // Run post process in cpu for speed.
    const prevBackend = getBackend();
    setBackend('cpu');

as we spoke about in person: remove this


tfjs-automl/src/object_detection.ts, line 96 at r1 (raw file):

        boxesTensor as Tensor2D, boxScores, options.topk, options.iou,
        options.score);
    const selectedBoxes = selectedBoxesTensor.dataSync() as Int32Array;

.data()


tfjs-automl/src/object_detection.ts, line 164 at r1 (raw file):

    const boxIndex = selectedBoxes[i];
    const [top, left, bottom, right] =
        Array.from(boxes.slice(boxIndex * 4, boxIndex * 4 + 4));

maybe pull 4 to a constant so it's clear why it's 4


tfjs-automl/src/object_detection_test.ts, line 48 at r1 (raw file):

    const options = {score: 0.11};
    const predictions = await model.detect(img, options);
    const {box: {left, top, width, height}, label, score} = predictions[0];

assert predictions.length = 1


tfjs-automl/src/util.ts, line 26 at r1 (raw file):

/** Loads and parses the dictionary. */
export async function loadDictionary(modelUrl: string): Promise<string[]> {

might be worth testing this

Copy link
Contributor Author

@dsmilkov dsmilkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 1 of 1 approvals obtained (waiting on @nsthorat)


tfjs-automl/src/object_detection.ts, line 91 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

as we spoke about in person: remove this

Done.


tfjs-automl/src/object_detection.ts, line 96 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

.data()

Done.


tfjs-automl/src/object_detection.ts, line 164 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

maybe pull 4 to a constant so it's clear why it's 4

Done.


tfjs-automl/src/object_detection_test.ts, line 48 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

assert predictions.length = 1

Done.


tfjs-automl/src/util.ts, line 26 at r1 (raw file):

Previously, nsthorat (Nikhil Thorat) wrote…

might be worth testing this

I test it via the public API model.dictionary for both models I load.

@dsmilkov dsmilkov merged commit d06dc7e into master Sep 4, 2019
@dsmilkov dsmilkov deleted the automl-test branch September 4, 2019 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants