-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
nonMaxSuppressionAsync extremely slow #8320
Comments
Hi, @JijaProGamer I apologize for the delayed response and thank you for bringing this issue to our attention, could you please help us with minimal code snippet/codepen example or your Github repo with complete steps to replicate the same behavior from our end to investigate this issue further as soon as possible ? Thank you for your cooperation and patience. |
I'll reply one ASAP as I get home in a hour or two, thanks |
I've made a small github repo (100 lines of code) so you can debug it fastly - https://github.com/JijaProGamer/NMS-Issue/blob/master/page.html Just download the html file, press to upload a image, and for the second upload look at the console at console.time for NMS and Model. For images smaller than 512x512 the model takes 15ms or under, while NMS takes in a good case 10MS, and usually up to 20-25MS (rx 6750 xt, i5 12600kf, 32GB Ram if specs needed). |
Any progress on this issue? |
Hi @JijaProGamer , Sorry for the late reply! I ran your code on a few different images, and here's the breakdown on how long each part took to run:
The model size is smaller and has fewer parameters, which generally results in faster execution times. Additionally, Thank You!! |
This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you. |
I use nonMaxSuppressionAsync in my code for getting rid of useless bounding boxes from a detection model, but this simple line of code:
console.time("nms") const nms = await tf.image.nonMaxSuppressionAsync(boxes, scores, 30, detectionSettings.iouThreshold, detectionSettings.scoreThreshold); console.timeEnd("nms")
Takes 20ms !!! That's 4 times the duration of the actual model running:
console.time("model") const res = model.execute(imgTensor); console.timeEnd("model")
since the model is pretty small and only 256x256, I would expect it to be slow, but nonMaxSuppressionAsync should be fast even with thousands of bounding boxes, I cannot implement one myself because tensor.data() for the boxes, scores and classes seem to take out 32 ms out of themselfs, even more than NMS
The text was updated successfully, but these errors were encountered: