AlexeyAB / darknet

YOLOv4 / Scaled-YOLOv4 / YOLO - Neural Networks for Object Detection (Windows and Linux version of Darknet )
http://pjreddie.com/darknet/
Other
21.75k stars 7.96k forks source link

pretrained model 'darknet53.conv.74' #5433

Open jcdubron opened 4 years ago

jcdubron commented 4 years ago

I find that darknet53.conv.74 is not the same as darknet53.weights and darknet53_448.weights. Is darknet53.conv.74 trained in ImageNet with different settings or other random seed?

WongKinYiu commented 4 years ago

darknet53.weights train imagenet from scratch with image size 256x256. darknet53.conv.74 is the weights of first 74 layers of darknet53.weights. darknet53_448.weights is fine-tune with image size 448x448 on darknet53.weights.

jcdubron commented 4 years ago

But I find the values in darknet53.conv.74 is not the same as the first 74 layers of darknet53.weights. The first 5 weights in darknet53.weights is [-0.11338928 1.1283484 1.2455083 1.9338647 -4.148237] and the first 5 weights in darknet53.conv.74 is [-4.1455936 -0.99273944 -2.060937 1.2925771 -0.89972943].

WongKinYiu commented 4 years ago

what is the first 5 weights of darknet53_448.weights?

jcdubron commented 4 years ago

The first 5 weights of darknet53_448.weights are [-0.10601279 1.1518075 1.2749087 1.9374714 -4.1375694].

WongKinYiu commented 4 years ago

well, it becomes a mystery. image maybe you are correct.

AlexeyAB commented 4 years ago

Just to know the first 20 bytes from .weights-file are not the weights: https://github.com/AlexeyAB/darknet/blob/f14054ec2b49440ad488c3e28612e7a76780bc5f/src/parser.c#L1763-L1767

jcdubron commented 4 years ago

@AlexeyAB That's right. I ignore the first 20 bytes but they are still not the same. All these three files have the same major = 0, minor = 2, revision = 0 but the net.seen are 102400000, 0 and 12800000 respectively.

AlexeyAB commented 4 years ago

This is a question for Joe)

WongKinYiu commented 4 years ago

darknet53: 102400000 = 128x800000 darknet53.conv.74: partial will clean the information darknet53_448: 12800000 = 128x800000 (darknet53 pre-train)+ 128x200000 (448 fine-tune)

nguyenanhtuan1008 commented 4 years ago

I have a question. What is the relationship between 53 and 74? How I get the number with darknet19_448?

WongKinYiu commented 4 years ago

53 means there are totally 53 convolutional layers in darknet53. 74 means 53-1 (convolution for classify) + 23-1 (last shortcut layer has no weights) = totally 74 layers.

for darknet19, you can get number by calculate 19-1 (convolution for classify) + number of maxpooling layers. image

nguyenanhtuan1008 commented 4 years ago

53 means there are totally 53 convolutional layers in darknet53. 74 means 53-1 (convolution for classify) + 23-1 (last shortcut layer has no weights) = totally 74 layers.

for darknet19, you can get number by calculate 19-1 (convolution for classify) + number of maxpooling layers. image

Thank you so much for your answer. So, in this case, darknet19 will be 19-1 + 5-1 = 22, right?

WongKinYiu commented 4 years ago

23

nguyenanhtuan1008 commented 4 years ago

23 Thank you! So what is the layer name of ”last shortcut layer has no weights” in darknet53 image

WongKinYiu commented 4 years ago

the layer just before avgpol. image

nguyenanhtuan1008 commented 4 years ago

@WongKinYiu Thank you for your answer!