JialianW / GRiT

GRiT: A Generative Region-to-text Transformer for Object Understanding (https://arxiv.org/abs/2212.00280)
MIT License
293 stars 30 forks source link

Support for Batch-Inference #14

Open alphacoder01 opened 8 months ago

alphacoder01 commented 8 months ago

Hi,

I need to perform batch inference for my use-case. I followed this thread here that extends the DefaultPredictor class to enable batched inputs. But I end up with this error

grit/modeling/roi_heads/grit_roi_heads.py:230, in GRiTROIHeadsAndTextDecoder._forward_box(self, features, proposals, targets, task)
    227 predictor, predictions, proposals = head_outputs[-1]
    228 boxes = predictor.predict_boxes(
    229     (predictions[0], predictions[1]), proposals)
--> 230 assert len(boxes) == 1
    231 pred_instances, _ = self.fast_rcnn_inference_GRiT(
    232     boxes,
    233     scores,
   (...)
    239     self.soft_nms_enabled,
    240 )
    242 assert len(pred_instances) == 1, "Only support one image"

AssertionError: 

Uncommenting the assertion doesn't help either.

linkangheng commented 5 months ago

May I ask if you have solved this problem? I have also encountered this problem