Entity icon indicating copy to clipboard operation
Entity copied to clipboard

Why use 'BGR' to input image in demo_crop, set cfg.INPUT.FORMAT = 'RGB', and then flip image to 'RGB' before the image is fed into the network? Doesn't this cause confusion, or is there something special going on

Open Clear-3d opened this issue 2 years ago • 1 comments

First of all, many thanks to the authors for open sourcing such a great project. I was a little confused about the image format conversion. Why use 'BGR' to input image in demo_crop, set cfg.INPUT.FORMAT = 'RGB', and then flip image to 'RGB' before the image is fed into the network? Doesn't this cause confusion, or is there something special going on.

  1. In detectron2/projects/CropFormer/demo_cropformer/demo_from_dirs.py img = read_image(path, format="BGR")
  2. at this time cfg.INPUT.FORMAT = 'RGB'
  3. and in detectron2/projects/CropFormer/demo_cropformer/predictor.py if self.input_format == "RGB": # whether the model expects BGR inputs or RGB original_image = original_image[:, :, ::-1] While the end result is correct, the process is confusing. If there is any special purpose, I really look forward to your explanation for me. Thank you again for such a good work. image

image

Clear-3d avatar Oct 09 '23 14:10 Clear-3d

My problem is from https://github.com/qqlu/Entity/blob/main/Entityv2/CropFormer/demo_cropformer/demo_from_dirs.py when I tried to use that demo.

Clear-3d avatar Oct 09 '23 15:10 Clear-3d