moorage / OpenCVTensorflowExample

Object Detection using a ssd_mobilenet_coco model with OpenCV 3.3 & TensorFlow 1.4 in C++ and XCode
https://medium.com/greppy/object-detection-using-a-ssd-mobilenet-coco-model-with-opencv-3-3-tensorflow-1-4-in-c-and-xcode-28b3e1d955db
39 stars 12 forks source link

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

Open kid-pc-chen opened 6 years ago

kid-pc-chen commented 6 years ago

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.
moorage commented 6 years ago
  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.

kid-pc-chen commented 6 years ago

@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.