duanzhiihao / RAPiD

RAPiD: Rotation-Aware People Detection in Overhead Fisheye Images (CVPR 2020 Workshops)
http://vip.bu.edu/rapid/
Other
213 stars 63 forks source link

_predict_pil() got multiple values for argument 'pil_img' #29

Closed seino-tsuyoshi closed 3 years ago

seino-tsuyoshi commented 3 years ago

I tried to estimation from PIL Image. For example:

detector.detect_one(pil_img=<PIL IMAGE>,
                    input_size=1024, conf_thres=0.3,
                    visualize=True)

But I got the error,

_predict_pil() got multiple values for argument 'pil_img'

I confirmed the code, and I found this code,

https://github.com/duanzhiihao/RAPiD/blob/fcb764a308e7e7c8ad7aceeb5de58364a691d9cd/api.py#L130

this variable "pil_img" seems argument of _predict_pil(). But there is another "pil_img" argument in kwargs. this caused the error. So I have changed this variable to "pil_image" and use this.

    def _predict_pil(self, pil_image, **kwargs):
        '''
        Args:
            pil_image: PIL.Image.Image
            input_size: int, input resolution
            conf_thres: float, confidence threshold
        '''
        input_size = kwargs.get('input_size', self.input_size)
        conf_thres = kwargs.get('conf_thres', self.conf_thres)
        assert isinstance(pil_image, Image.Image), 'input must be a PIL.Image'
        assert input_size is not None, 'Please specify the input resolution'
        assert conf_thres is not None, 'Please specify the confidence threshold'

        # pad to square
        input_img, _, pad_info = utils.rect_to_square(pil_image, None, input_size, 0)

If my think is right, could you change this variable to other word? Or if there is different ways, please let me know.

duanzhiihao commented 3 years ago

Hello, thank you for your information! I think a more compact way is to replace "get" with "pop", as in commit 92e6a44b8a0107def055e93c971d78fd548562f8

seino-tsuyoshi commented 3 years ago

I have confirmed that. Thank you for your quick response!!