gligen / GLIGEN

Open-Set Grounded Text-to-Image Generation
MIT License
1.98k stars 148 forks source link

Question about work with bounding box data #25

Open gzp6688 opened 1 year ago

gzp6688 commented 1 year ago

Hello! Thank you very much for this, it seems really good!

I see the code (def to_valid) in https://github.com/gligen/GLIGEN/blob/master/dataset/base_dataset.py when you're trying to determine if bbox is valid, but x0, y0 should be the top left coordinate. So maybe the code if x0>image_size or y0>image_size or x1<0 or y1<0: should beif x1>image_size or y1>image_size or x0<0 or y0<0: ?

Yuheng-Li commented 1 year ago

The original code should be correct. That line is used to check is it possible to clamp the bounding box to be valid. If x0/y0 is beyond the image right/top or x1/y1 is smaller than 0 due to cropping, then there is no way to make this box valid (since the box is completely outside); thus return False