qqwweee / keras-yolo3

A Keras implementation of YOLOv3 (Tensorflow backend)
MIT License
7.14k stars 3.45k forks source link

tiny yolo v3 anchors? #526

Open saichandrareddy1 opened 5 years ago

saichandrareddy1 commented 5 years ago

1)I have created anchors with the gen_anchors for my yolov3-tiny.config file 2) I kept default clusters 9 and I got 3.38,3.38, 3.83,5.01, 3.94,7.48, 4.95,4.75, 5.53,5.67, 6.45,4.06, 6.47,8.23, 7.45,5.94, 10.96,8.63 0.858832 above answer 3) What does this(numbers) mean and 0.858832? 4) How to set anchors in the config file because I got 18 anchors and when I kept this number in the config I'm getting an error core dump 5) How to set these 18 anchors?

jamie0618 commented 5 years ago
  1. Each pair is the width and height of default anchors. For example, 3.38,3.38 means that this anchor has the same height and width 3.38. 0.858832 is the accuracy of the kmeans algorithm. (YOLO uses kmeans to get default anchors)

4 5. Just replace anchor values and change the 'num' parameter to 9 in yolov3-tiny.config file

saichandrareddy1 commented 5 years ago

yolov3-tiny layer filters size input output 0 conv 16 3 x 3 / 1 416 x 416 x 3 -> 416 x 416 x 16 0.150 BFLOPs 1 max 2 x 2 / 2 416 x 416 x 16 -> 208 x 208 x 16 2 conv 32 3 x 3 / 1 208 x 208 x 16 -> 208 x 208 x 32 0.399 BFLOPs 3 max 2 x 2 / 2 208 x 208 x 32 -> 104 x 104 x 32 4 conv 64 3 x 3 / 1 104 x 104 x 32 -> 104 x 104 x 64 0.399 BFLOPs 5 max 2 x 2 / 2 104 x 104 x 64 -> 52 x 52 x 64 6 conv 128 3 x 3 / 1 52 x 52 x 64 -> 52 x 52 x 128 0.399 BFLOPs 7 max 2 x 2 / 2 52 x 52 x 128 -> 26 x 26 x 128 8 conv 256 3 x 3 / 1 26 x 26 x 128 -> 26 x 26 x 256 0.399 BFLOPs 9 max 2 x 2 / 2 26 x 26 x 256 -> 13 x 13 x 256 10 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs 11 max 2 x 2 / 1 13 x 13 x 512 -> 13 x 13 x 512 12 conv 1024 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BFLOPs 13 conv 256 1 x 1 / 1 13 x 13 x1024 -> 13 x 13 x 256 0.089 BFLOPs 14 conv 512 3 x 3 / 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BFLOPs 15 conv 18 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 18 0.003 BFLOPs 16 yolo 17 route 13 18 conv 128 1 x 1 / 1 13 x 13 x 256 -> 13 x 13 x 128 0.011 BFLOPs 19 upsample 2x 13 x 13 x 128 -> 26 x 26 x 128 20 route 19 8 21 conv 256 3 x 3 / 1 26 x 26 x 384 -> 26 x 26 x 256 1.196 BFLOPs 22 conv 18 1 x 1 / 1 26 x 26 x 256 -> 26 x 26 x 18 0.006 BFLOPs 23 yolo Loading weights from yolov3-tiny.conv.15...Done! Learning Rate: 0.0001, Momentum: 0.9, Decay: 0.0005 Resizing 544 Loaded: 0.603201 seconds Region 16 Avg IOU: -nan, Class: -nan, Obj: -nan, No Obj: 0.653091, .5R: -nan, .75R: -nan, count: 0 Region 23 Avg IOU: -nan, Class: -nan, Obj: -nan, No Obj: 0.494134, .5R: -nan, .75R: -nan, count: 0

Bro showing this error

How to solve this issue, i tried with the mask in yolo layer

Thanks for helping @jamie0618

saichandrareddy1 commented 5 years ago

i just entered that 9 pair of values and also changed num=9

need to multiply with any value to the 9 pairs of anchors?

sandramateska commented 5 years ago

What if I have just to choose from object and no object in the image(i don't have several classes) ? will I go with anchor boxes or just with labels for the photos.. and can I skip the anchor boxes and just find out if the object is in the picture or not ?

saichandrareddy1 commented 5 years ago

@sandramateska

If you need any anchor boxes then go with TensorFlow API or Yolo if you don't need any anchor boxes then go with basic CNN with any framework like Keras, PyTorch

I think you have got it what I'm saying