experiencor / keras-yolo2

Easy training on custom dataset. Various backends (MobileNet and SqueezeNet) supported. A YOLO demo to detect raccoon run entirely in brower is accessible at https://git.io/vF7vI (not on Windows).
MIT License
1.73k stars 784 forks source link

Some doubt with line75 code in frontend.py #235

Closed LBAWMY closed 6 years ago

LBAWMY commented 6 years ago

Hi! I think that this line is used to extract the detection layer to do futher processing, but the detection layer is the last layer, so I just doubt that this code should be "layer = self.model.layers[-1]", rather then "layer = self.model.layers[-4]".

RichardSieg commented 6 years ago

Hi,

I think, self.model.layers[-4] is correct, since the last three layers are the conv layer, a reshape and the lambda and you want to initialize the weights between the last layer of your backend (should be layers[-4]) and your new conv layer, which is responsible for detection.

Note that there is a difference in writing layers in a paper and actual implemented layers. For example, nobody would mention reshapes and lambdas as a layer in a paper but there are still necessary layers for the implementation.

LBAWMY commented 6 years ago

Got it. I was wrong, thank you very much!