hanoonaR / object-centric-ovd

[NeurIPS 2022] Official repository of paper titled "Bridging the Gap between Object and Image-level Representations for Open-Vocabulary Detection".
Apache License 2.0
284 stars 19 forks source link

Error during class-specific IN-21K proposal generation for LVIS #5

Closed muzairkhattak closed 2 years ago

muzairkhattak commented 2 years ago

Hi, While generating class-specific ILS proposals for ImageNet-21k using get_ils_labels.py, one might encounter the following error:

RuntimeError: The size of tensor a (4) must match the size of tensor b (3) at non-singleton dimension 0

This error occurs for some ImageNet-21k images which are not RGB by default.

To fix this, replace this line of modulated_detection.py (directory path: object-centric-ovd/external/mavl/inference) with im = Image.open(image_path).convert('RGB'). It will make sure every loaded image is converted to RGB format.