bethgelab/siamese-mask-rcnn

Prediction time during testing

Closed this issue · 4 comments

Hi @mbethge ,
Thank you for sharing your great work.
I just downloaded your pre-trained model and made some tests on my own dataset.
The first thing I can see is that the time this model needs to predict 1 image is quite slow, about more than 7s for 1 image.
What's about your prediction time for 1 image ?

Which model did you download and which function did you use for testing? model.evaluate_dataset or model.detect? The latter one can take a long time for the first image, as it has to initialize some components when the model is called for the first time. I found this behavior to be the same for the original Matterport Mask R-CNN implementation we build upon.

@michaelisc I downloaded large_siamese_mrcnn_coco_full model and used model.detect for detection. I was testing detection for multiple images.
For the first image, it took about 24sec, and approximately 5 to 7sec for each image after that.
Ah, I just figured out that for prediction part, the model takes only 0.5 to 0.7 sec for 1 image. But display_results part takes so much time (at least 3sec for 1 image in my PC).

Between 500ms and 700ms sounds about right. Did that finding answer your question then? I am not sure if I can do anything to speed up the visualization function. I guess the bottleneck there is matplotlib but never profiled it.

@michaelisc Iam trying to use opencv instead to see whether it can boost the visualization time or not. I will report the results later.
Update: I think the problem comes from my PC, after trying several times again with matplotlib and opencv, the total time results ( prediction + visualization ) are the same.
Thank you for your prompt support.