Skip to content

Commit e3a4ee7

Browse files
authored
topk fix (#179)
1 parent f363340 commit e3a4ee7

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/ImageClassifier/index.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ class ImageClassifier {
248248
"image",
249249
"No input image provided. If you want to classify a video, use classifyStart."
250250
);
251-
return callCallback(this.classifyInternal(image, number), callback);
251+
return callCallback(this.classifyInternal(image, number || this.topk), callback);
252252
}
253253

254254
/**
@@ -269,10 +269,9 @@ class ImageClassifier {
269269
// Function to classify a single frame
270270
const classifyFrame = async () => {
271271
await mediaReady(image, true);
272-
await this.classifyInternal(image, number);
273272
// call the callback function
274-
callCallback(this.classifyInternal(image, number), callback);
275-
273+
await callCallback(this.classifyInternal(image, number || this.topk), callback);
274+
276275
// call recursively for continuous classification
277276
if (!this.signalStop) {
278277
requestAnimationFrame(classifyFrame);

0 commit comments

Comments
 (0)