Keras-yolo3: Why "185" , and Why inferior to original YOLOv3 ?

Created on 24 Jul 2018  ·  4Comments  ·  Source: qqwweee/keras-yolo3

Hi qqwweee and everyone,

I have two questions. Would you please give some information to me?


  1. The following sentence is in def create_model (...),
    num = (185, len(model_body.layers)-3)[freeze_body-1]

Why "185", and What does the "185" mean?
If it represents a layer-number, but the total number of layers in Darknet53 is smaller than 185.


  1. It is said,
    the detection performance of keras-yolo3 implementation is
    inferior in accuracy/precision to original YOLOv3 imp(written by C & Darknet ).
    What are the possible reasons?

Most helpful comment

aha, maybe I can answer why it is 185. because I printed out all 252 layers of yolo body. 185 is exactly DarkNet-53 without fully-connected layer. Freezing the first 185 layers means freezing function of darknet. In keras, 185 contains layers including 1 input layer, 52 conv layers, 23 add layers, 52 leaky relu layers , 52 batch norm layers and 5 zero padding layers. 185 = 1+52+23+52+52+5

All 4 comments

when freeze_body is 1, it's "finetune" mode, the model will freeze top 185 layers, then num = 185, so the num denote the number of layers you want to freeze. By the way, in keras number of yolo-v3 layers is larger than 185 for it includes maxpooling, activation... .And when freeze_body is 2, it's "training" mode, model will freee all layers but last three. in this case, num = len(model_body.layers)-3.

Indeed, I compared the performance of original YOLOv3 with this(keras-yolo3), the accuracy of keras-yolo3 is a little lower(about 2%), I think maybe it's because I trained the model with original YOLOv3, but tested with keras-yolo3(already convert the model to h5 format).So I'm going to train the model with keras-yolo3 and test it. Hope this could achieve the same performance as original YOLOv3.

aha, maybe I can answer why it is 185. because I printed out all 252 layers of yolo body. 185 is exactly DarkNet-53 without fully-connected layer. Freezing the first 185 layers means freezing function of darknet. In keras, 185 contains layers including 1 input layer, 52 conv layers, 23 add layers, 52 leaky relu layers , 52 batch norm layers and 5 zero padding layers. 185 = 1+52+23+52+52+5

aha, maybe I can answer why it is 185. because I printed out all 252 layers of yolo body. 185 is exactly DarkNet-53 without fully-connected layer. Freezing the first 185 layers means freezing function of darknet. In keras, 185 contains layers including 1 input layer, 52 conv layers, 23 add layers, 52 leaky relu layers , 52 batch norm layers and 5 zero padding layers. 185 = 1+52+23+52+52+5

@leviome How can I modify the [route] layers in 'yolov3.cfg' according to the 185 layers? Thanks~

Was this page helpful?
0 / 5 - 0 ratings