Maybe the code cannot evaluate a bunch of images at same time
LaiPiXiong opened this issue · comments
I want to evaluate multi images at same time, but still, I encounter the same error with code show in https://github.com/multimodallearning/pytorch-mask-rcnn
So, this model cann't evaluate several images at the same time ,isn't it?
I guess you mean multiple-image batch evaluating?
I did not work on it. However, you can easily implement it through modifying the function model.detect() by what I have done in the function model. train_model().
Line 356 in 2291627
Yes, I try it. But, it show errors as follows:
torch.Size([10, 2, 4]) Traceback (most recent call last): File "/home/mh/workspace/Mask_RCNN_Pytorch/Combine.py", line 191, in <module> train(opt) File "/home/mh/workspace/Mask_RCNN_Pytorch/Combine.py", line 132, in train Detect_results = Detect_model.detect(molded_images, image_metas, windows, image_sizes) File "/home/mh/workspace/Mask_RCNN_Pytorch/model.py", line 1589, in detect detections, mrcnn_mask = self.predict([molded_images, image_metas], mode='inference') File "/home/mh/workspace/Mask_RCNN_Pytorch/model.py", line 1867, in predict config=self.config) File "/home/mh/workspace/Mask_RCNN_Pytorch/model.py", line 341, in proposal_generator boxes = apply_box_deltas(anchors, deltas) File "/home/mh/workspace/Mask_RCNN_Pytorch/model.py", line 274, in apply_box_deltas height = boxes[:, 2] - boxes[:, 0] IndexError: index 2 is out of bounds for dimension 1 with size 2
(10, 2, 4) is the box shape, and 10 is batch_size
When batch_size is 1, box shape is (6000, 4)
This code is in model.py (apply_box_deltas).
I also try to modify this, but I found it comes down to many other codes. What can I do if I want evaluate several images at same time?
model.predict() was not designed for multiple-image. I kept it because I didn't see the necessity
of multiple-image evaluation. If you want to conduct multiple-image batch evaluating, you could look at the function model.train_model(), which is different from lasseha's implementation.
If you are familiar with caffe2, you could consider https://github.com/facebookresearch/Detectron. This is the official implementation developed the authors of Mask R-CNN.
OK, thanks for your advise