-
Notifications
You must be signed in to change notification settings - Fork 2k
Add object detection API for AutoML #1971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
nsthorat
left a comment
There was a problem hiding this 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: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
dsmilkov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status:
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.
This change is