dannyblueliu / YOLO-Face-detection

Other
173 stars 89 forks source link

How does the bounding box coordinate show up when you run it? #17

Open ritwikdubey opened 6 years ago

ritwikdubey commented 6 years ago

Hi @dannyblueliu , I want to use the weight and config files you've shared in the project to perform face detection using https://github.com/AlexeyAB/darknet code. I'm stuck at a place where I can see the face detection getting successful but the bounding box doesn't show up.

The details of the issue are mentioned here

TL;DR, when I use the model and cfg file shared here, I see coordinates of the bounding box as

0 249.953705 193.414719 96.070702 193.903595

which follows the format . However, in the known working case I see the numbers <1.

0 0.572266 0.480556 0.324219 0.569444

So I wonder how you see the bounding boxes and their coordinates.

My command to run darknet is

darknet.exe detector demo data/face.data cfg/yolo-face.cfg backup\yolo-face_final_dropbox.weights -save_labels http://192.168.1.106:8080/video
dannyblueliu commented 6 years ago

Coordinates of the bounding box are actually following the special way how YOLO describe the BBox. It is in the CVPR paper: You Only Look Once: Unified, Real-Time Object Detection.

Or you can follow Kevin Hsiao's suggestion: maybe try add printf("Bounding Box: Left=%d, Top=%d, Right=%d, Bottom=%d\n", left, top, right, bot); in line 220 of src/image.c

Hope that helps. Thank you very much!

svofski commented 6 years ago

I changed these lines in the main darknet (image.c line 285)

            int left  = (b.x-b.w/2.);//*im.w;
            int right = (b.x+b.w/2.);//*im.w;            
            int top   = (b.y-b.h/2.);//*im.h;
            int bot   = (b.y+b.h/2.);//*im.h;

And the boxes seem to appear in the right places. So somehow with this model the bounding boxes tend to come in image coordinates instead of normalised coordinates?

dannyblueliu commented 6 years ago

Thank you very much! @svofski