OpenCVTensorflowExample icon indicating copy to clipboard operation
OpenCVTensorflowExample copied to clipboard

Why don't we need to convert BGR to RGB and resize the input image?

Open kid-pc-chen opened this issue 7 years ago • 2 comments

Thanks for sharing this tutorial. However, I still got some questions; I would appreciate it if you could elaborate a little bit more.

  1. You mentioned “ OpenCV uses BGR whereas Tensorflow uses RGB” in https://medium.com/greppy/object-detection-using-a-ssd-mobilenet-coco-model-with-opencv-3-3-tensorflow-1-4-in-c-and-xcode-28b3e1d955db …but I didn’t find the related code to convert the input image into RGB in your code.
  2. Could you please tell me how you figured out the input and output tensor names of the COCO graphs?
  3. Why don’t we need to resize the input image (e.g. 300x300 for SSD, 299x299 for Faster RCNN) for the input tensor? I didn’t find the related code to resize the input image in your code.

kid-pc-chen avatar Jan 31 '18 05:01 kid-pc-chen

  1. You're right, I didn't need to convert it here. I think I had to for my webcam version of this code, as opposed to JPG version.

  2. I looked at https://github.com/ActiveState/gococo . I believe I could have figured it out by browsing the graph as well, but I haven't setup anything to do that.

  3. I'm not sure the reasons behind it, but you don't need to resize it for the program to work.

moorage avatar Jan 31 '18 15:01 moorage

@moorage Thanks for your reply. By the way, I found a post (https://stackoverflow.com/questions/35336648/list-of-tensor-names-in-graph-in-tensorflow) that shows a way to see the names of all operation names in the graph.

kid-pc-chen avatar Feb 01 '18 06:02 kid-pc-chen