Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How do I set the grid size when I use yolo v3? #1042

Closed
developer0hye opened this issue Aug 10, 2018 · 24 comments
Closed

How do I set the grid size when I use yolo v3? #1042

developer0hye opened this issue Aug 10, 2018 · 24 comments

Comments

@developer0hye
Copy link

I can`t find a way to set the grid size in "yolov3.cfg".

@dukeeagle
Copy link

Any news on this?

@developer0hye
Copy link
Author

I solved this problem and have a example for this.
Do you need it?

I just modified cfg file.

@Favi0
Copy link

Favi0 commented Feb 11, 2019

I solved this problem and have a example for this.
Do you need it?

I just modified cfg file.

im interested , which parameter of the cfg file did you modify?

@developer0hye
Copy link
Author

developer0hye commented Feb 11, 2019

If you give me your email address, I will send you some examples for that. It depends on your input size and the position of yolo layer in cfg file. But the grid size cannot be contorlled freely. It has some constraints.

@Favi0
Copy link

Favi0 commented Feb 13, 2019

If you give me your email address, I will send you some examples for that. It depends on your input size and the position of yolo layer in cfg file. But the grid size cannot be contorlled freely. It has some constraints.

hey man i received your message, could you explain it a little more? i cant get to conclusion of what you did , i see you have 3 detection layers

@dukeeagle
Copy link

If you give me your email address, I will send you some examples for that. It depends on your input size and the position of yolo layer in cfg file. But the grid size cannot be contorlled freely. It has some constraints.

Hi there. My email is luke.igel@gmail.com. Could you reach out to me as well? I really appreciate it.

@saksham789
Copy link

If you give me your email address, I will send you some examples for that. It depends on your input size and the position of yolo layer in cfg file. But the grid size cannot be contorlled freely. It has some constraints.

Hi there. My email is saksham.vikram12@gmail.com.Could you please share the code with me as well.

@newforrestgump001
Copy link

I solved this problem and have a example for this.
Do you need it?

I just modified cfg file.

Could you send me a copy of modification of cfg and source code, my e-mail is: newforrestgump@163.com, thanks a lot!

@d-j-kendall
Copy link

If you give me your email address, I will send you some examples for that. It depends on your input size and the position of yolo layer in cfg file. But the grid size cannot be contorlled freely. It has some constraints.

Could you send the file to me as well? dustink.ftw@gmail.com

@riyaj8888
Copy link

please send me also what change has to be done in cfg file.
my email id is r.i.attar8@gmail.com ..help appreciated

@yuval-s
Copy link

yuval-s commented May 21, 2019

I'll be happy if you could send me as well an example on how to do that.
yuval.s@campus.technion.ac.il

@ilyes-hm
Copy link

ilyes-hm commented Jun 24, 2019

Has anyone found a solution to this? please, I need to change the grid size to visualize its effect.
Thank you

@ayush11shivali
Copy link

@developer0hye Hey, kindly share the changes to .cfg file with me as well at ayush11shivali@gmail.com

@developer0hye
Copy link
Author

grid size depends on input image size and feature map size downsampled by convolution with stride or pooling.

@barzan-hayati
Copy link

barzan-hayati commented Jul 29, 2019

@developer0hye Hey man. Please SHARE your .cfg .
Are you able to control maximum number of bounding box for each cell via .cfg file?

@vietnamican
Copy link

@developer0hye. Can you send me tour .cfg file to vietnamican@gmail.com? Thank you!!

@MSJawad
Copy link

MSJawad commented Oct 23, 2019

Hey, can i get a copy of your cfg file to solaimanjawad@gmail.com? thanks!

@ilyes-hm
Copy link

In my oppinion it's not possible to manually change the grid size (unless you change the source code "not sure about that") to do it you need to change the input size (width and height) in cfg file so YOLO will automaticaly output a different grid size to perform detection.

@barzan-hayati
Copy link

It's Completely easy. Just by changing width and height of input size, you could change grid size. For example in YOLO-Lite by chnaging default grid size is 7*7 for input size 224*224. Now by changing input size to 160*224, grid size will be 5*7. I have tested a sample here:

Grid size: 7*7

 compute_capability = 750, cudnn_half = 1 
   layer   filters  size/strd(dil)      input                output
   0 conv     16       3 x 3/ 1    224 x 224 x   3 ->  224 x 224 x  16 0.043 BF
   1 max                2x 2/ 2    224 x 224 x  16 ->  112 x 112 x  16 0.001 BF
   2 conv     32       3 x 3/ 1    112 x 112 x  16 ->  112 x 112 x  32 0.116 BF
   3 max                2x 2/ 2    112 x 112 x  32 ->   56 x  56 x  32 0.000 BF
   4 conv     64       3 x 3/ 1     56 x  56 x  32 ->   56 x  56 x  64 0.116 BF
   5 max                2x 2/ 2     56 x  56 x  64 ->   28 x  28 x  64 0.000 BF
   6 conv    128       3 x 3/ 1     28 x  28 x  64 ->   28 x  28 x 128 0.116 BF
   7 max                2x 2/ 2     28 x  28 x 128 ->   14 x  14 x 128 0.000 BF
   8 conv    128       3 x 3/ 1     14 x  14 x 128 ->   14 x  14 x 128 0.058 BF
   9 max                2x 2/ 2     14 x  14 x 128 ->    7 x   7 x 128 0.000 BF
  10 conv    256       3 x 3/ 1      7 x   7 x 128 ->    7 x   7 x 256 0.029 BF
  11 conv     35       1 x 1/ 1      7 x   7 x 256 ->    7 x   7 x  35 0.001 BF
  12 detection

Grid size: 5*7

 compute_capability = 750, cudnn_half = 1 
   layer   filters  size/strd(dil)      input                output
   0 conv     16       3 x 3/ 1    160 x 224 x   3 ->  160 x 224 x  16 0.031 BF
   1 max                2x 2/ 2    160 x 224 x  16 ->   80 x 112 x  16 0.001 BF
   2 conv     32       3 x 3/ 1     80 x 112 x  16 ->   80 x 112 x  32 0.083 BF
   3 max                2x 2/ 2     80 x 112 x  32 ->   40 x  56 x  32 0.000 BF
   4 conv     64       3 x 3/ 1     40 x  56 x  32 ->   40 x  56 x  64 0.083 BF
   5 max                2x 2/ 2     40 x  56 x  64 ->   20 x  28 x  64 0.000 BF
   6 conv    128       3 x 3/ 1     20 x  28 x  64 ->   20 x  28 x 128 0.083 BF
   7 max                2x 2/ 2     20 x  28 x 128 ->   10 x  14 x 128 0.000 BF
   8 conv    128       3 x 3/ 1     10 x  14 x 128 ->   10 x  14 x 128 0.041 BF
   9 max                2x 2/ 2     10 x  14 x 128 ->    5 x   7 x 128 0.000 BF
  10 conv    256       3 x 3/ 1      5 x   7 x 128 ->    5 x   7 x 256 0.021 BF
  11 conv     35       1 x 1/ 1      5 x   7 x 256 ->    5 x   7 x  35 0.001 BF
  12 detection

As you see, 11th layer shows grid size and 0 layer shows size of input to network.

@blackCmd
Copy link

It's Completely easy. Just by changing width and height of input size, you could change grid size. For example in YOLO-Lite by chnaging default grid size is 7*7 for input size 224*224. Now by changing input size to 160*224, grid size will be 5*7. I have tested a sample here:

Grid size: 7*7

 compute_capability = 750, cudnn_half = 1 
   layer   filters  size/strd(dil)      input                output
   0 conv     16       3 x 3/ 1    224 x 224 x   3 ->  224 x 224 x  16 0.043 BF
   1 max                2x 2/ 2    224 x 224 x  16 ->  112 x 112 x  16 0.001 BF
   2 conv     32       3 x 3/ 1    112 x 112 x  16 ->  112 x 112 x  32 0.116 BF
   3 max                2x 2/ 2    112 x 112 x  32 ->   56 x  56 x  32 0.000 BF
   4 conv     64       3 x 3/ 1     56 x  56 x  32 ->   56 x  56 x  64 0.116 BF
   5 max                2x 2/ 2     56 x  56 x  64 ->   28 x  28 x  64 0.000 BF
   6 conv    128       3 x 3/ 1     28 x  28 x  64 ->   28 x  28 x 128 0.116 BF
   7 max                2x 2/ 2     28 x  28 x 128 ->   14 x  14 x 128 0.000 BF
   8 conv    128       3 x 3/ 1     14 x  14 x 128 ->   14 x  14 x 128 0.058 BF
   9 max                2x 2/ 2     14 x  14 x 128 ->    7 x   7 x 128 0.000 BF
  10 conv    256       3 x 3/ 1      7 x   7 x 128 ->    7 x   7 x 256 0.029 BF
  11 conv     35       1 x 1/ 1      7 x   7 x 256 ->    7 x   7 x  35 0.001 BF
  12 detection

Grid size: 5*7

 compute_capability = 750, cudnn_half = 1 
   layer   filters  size/strd(dil)      input                output
   0 conv     16       3 x 3/ 1    160 x 224 x   3 ->  160 x 224 x  16 0.031 BF
   1 max                2x 2/ 2    160 x 224 x  16 ->   80 x 112 x  16 0.001 BF
   2 conv     32       3 x 3/ 1     80 x 112 x  16 ->   80 x 112 x  32 0.083 BF
   3 max                2x 2/ 2     80 x 112 x  32 ->   40 x  56 x  32 0.000 BF
   4 conv     64       3 x 3/ 1     40 x  56 x  32 ->   40 x  56 x  64 0.083 BF
   5 max                2x 2/ 2     40 x  56 x  64 ->   20 x  28 x  64 0.000 BF
   6 conv    128       3 x 3/ 1     20 x  28 x  64 ->   20 x  28 x 128 0.083 BF
   7 max                2x 2/ 2     20 x  28 x 128 ->   10 x  14 x 128 0.000 BF
   8 conv    128       3 x 3/ 1     10 x  14 x 128 ->   10 x  14 x 128 0.041 BF
   9 max                2x 2/ 2     10 x  14 x 128 ->    5 x   7 x 128 0.000 BF
  10 conv    256       3 x 3/ 1      5 x   7 x 128 ->    5 x   7 x 256 0.021 BF
  11 conv     35       1 x 1/ 1      5 x   7 x 256 ->    5 x   7 x  35 0.001 BF
  12 detection

As you see, 11th layer shows grid size and 0 layer shows size of input to network.

Thank you, u save me 👍 🙋🏻‍♂️

@vietnamican
Copy link

@blackCmd After i investigate, i relize that a cell has size 32x32, so if you want to change the grid cell, you have to change the size of input.

@FrancescoRossi1987
Copy link

just set input size and it will automatically scale based on magic number 32

@d-j-kendall
Copy link

The way I solved this was to use YoloV3 tiny configuration.
With the tiny configuration, I was able to detect smaller objects.

https://github.com/pjreddie/darknet/blob/master/cfg/yolov3-tiny.cfg

I believe that the grid size is indirectly sized by your anchor boxes on the yolo layer in conjunction with the size of your input layer.

@sanjulsharma
Copy link

I solved this problem and have a example for this.
Do you need it?

I just modified cfg file.

Please send it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests