Open 10183308 opened 7 years ago
Thank you for sharing the code!
./examples/indoor/train.prototxt last layer has som 'biases:xxx' parameters, I want to know these parameters come from, could you give me some advice?
biases: 0.738768 biases: 0.874946 biases: 2.42204 biases: 2.65704 biases: 4.30971 biases: 7.04493 biases: 10.246 biases: 4.59428 biases: 12.6868 biases: 11.8741
how to convert yolo.cfg to yolo.prototxt? Have you solved it? please
@opyk Convert yolo.cfg to yolo.prototxt is unnecessary. Author had provide the file. I have tried the code, but cannot got good enough results.
I use convert_weights_to_caffemodel.py ,but I always fail to convert code。。。。 Is there any good way?
@opyk weights is not match with cfg. Firstly,I trained my own yolo.weights through yolov2 framework. Then, I adjust author's prototxt according to my own yolo-voc.cfg. After that, I use convert_weights_to_caffemodel.py. You can try this way.
@CBIR-LL I did it this way ,I review my own prototxt ,but weights is not match with cfg,I guess my prototxt error,but I can't know how to change it。
Can I have a look at your modified prototxt file?
xinlhw@sina.com is my E-mail address 。
@opyk I have send it to you. please check it.
@CBIR-LL thank you
@CBIR-LL I want to train mode, Do you know how to make labels?
@opyk Authos has provide his file. Following files are my file.
(label_map.txt) car 0 tv 1
(training.txt) 001002 001003 001004 001005 001006
(trainval.txt) mydata/images/001002.jpg mydata/Annotations/001002.xml mydata/images/001003.jpg mydata/Annotations/001003.xml
@CBIR-LL Using the author's test program to parse the output of 30X13X13, but it can not achieve good results Excuse me, do you have a better idea?
@opyk If it's for studying, you can debug the code. If it's for engineering, just use Darknet directly! I tried it and it didn't work well, so I still use Darknet. If you have any good ideas, you can tell me.
@CBIR-LL I feel that the author's code has a problem, I use his code training, region_loss_layer layer output, avg_noobj: 0.11454, avg_obj:, -nan, avg_iou:,-nan, avg_cat:, -nan, recall:, -nan, class_count:, it is difficult to understand... Have you ever trained with his code?
@CBIR-LL hello, I have a question, when I run the convert_weights_to_caffemodel.py with the yolo.prototxt provide by the author and the weight file, but it failed with (Error parsing text-format caffe.NetParameter: 1015:15: Message type "caffe.LayerParameter" has no field named "reorg_param".) , I don't why, can you help me?
@opyk Do you convert the weight file to caffemodel file sucess?
I have the same problem with @Zhaixuejun .
@Katherinexx I think you should export the right path of caffe(after you cmd: make all)
@Zhaixuejun Do you convert it successfully? Could you please send me the final prototxt? Thank you so much! Here are my email:xxiaoac@ust.hk
@Katherinexx I don't catch your meaning, the prototxt file is provided in ../example/indoor/convent, you need finall caffemodel?
@CBIR-LL Could you please send me a copy of your modified prototxt? Thank you so much! xxiaoac@ust.hk
@Zhaixuejun I have tried the prototxt the author provided, but it doesn't work and report shape check failed error , I guess some parameters need to be modified. Do you have the prototxt that can work? Thanks.
I also have the same problem with Zhaixuejun. @Katherinexx Did you solve the problem? Thanks.
@r06631001 Maybe you should modify the caffe path in .bashrc.
Hi, guys. I failed to convert model file.
any suggestion?
@Zhaixuejun I have the same problem.Do you have some ways to sol out?Thanks
@mychina75 Have you solve the problem of converting the yolo weights model into caffemodel? When I run the following command:
python convert_weights_to_caffemodel.py yolo.prototxt yolo.weights yolo.caffemodel
I always get the error "Error parsing text-format caffe.NetParameter: 1060:15: Message type "caffe.LayerParameter" has no field named "reorg_param." Can you tell me how you solve it?
I have reviewed the Caffe layer list and found that the Rerog and RegionLoss layer is not appeared in the list. So I guess that these two layers should be transferred into other layers which is contained in the Caffe layer. @Zhaixuejun @mychina75 @windghoul
The author has achieved the layers, Rerog and Region layers, in Caffe. @nalan210
@Zhaixuejun Sorry to disturb you again that I am still confused. As you say the author has achieved the layers including Rerog and Region layer, do you mean that the Caffe itself or the author gklz1982 who provided these codes?
the same problem with you @nalan210 , Have you solve it ? caffe.LayerParameter" has no field named "reorg_param."
I have the same problem in converting the yolo.weights(coco-80class) model with the yolo.prototxt
as below error
conv21(conv)
Traceback (most recent call last):
File "convert_weights_to_caffemodel.py", line 74, in
first, yolo prototxt's count(67465630) and yolo weights' netshape( 50983561 ) doesn't match. yolo weights are downloaded from official darknet site and it's trained on coco db.
plus, I don't understand why label dim is 30*5... just 5 would be enough for one box. there is 30 boxes?
I tried to use all deploy or test prototxts to see the conversion working fine or not, and the result was strange. in case of yolo.prototxt, the total param size is calculated as 67465630(bigger than 50983561) , but in all other cases including gnet_region_test_darknet_deploy.prototxt, gnet_region_test_darknet_v3.prototxt, train_test_yolo.prototxt, the expected sizes are all 48591262(smaller than the actual weight's total param size, 50983561) Of course I changed the last filter number/class number to 425 and 80 in advance. But, I found that there is no difference between yolo.prototxt and other prototxts regarding the params of all layers. Even though that, it calculates blob/tensor size of concat/reorg layers differently. in case of yolo.prototxt, it thinks the 3 layers (all have 1024 filters) are concatenated into one(so 3072 filters to 1024 filters). But, in other prototxt cases, it just treat it like 1:1 concatenation(1024 to 1024)....This difference made the different results ( 67465630 vs 48591262 ) Sooo strange...
Ha! it's really weird! suddnely all prototoxt failed with the same over param size, 67465630. I didn't changed anytying;;;;
Darknet saves weights only for conv(batchnorm included) regarding yolov2( no fc, no local, no stand-alone batchnorm layers).
void save/load_convolutional_weights(layer l, FILE fp) fwrite/fread(l.biases, sizeof(float), l.n, fp); // l.n == filter count == num_output fwrite/fread(l.scales, sizeof(float), l.n, fp); fwrite/fread(l.rolling_mean, sizeof(float), l.n, fp); fwrite/fread(l.rolling_variance, sizeof(float), l.n, fp); fwrite/fread(l.weights, sizeof(float), num, fp); // c/groupsnsizesize, groups==1 => num_inputnum_outputkernel_size^2
and first 4 major/minior,revision, net->seen are saved in front of all weights.
I found that, the covertor py is almost same as yolov1 convertor py from , https://github.com/xingwangsfu/caffe-yolo/blob/master/create_yolo_caffemodel.py and I logged the actual saved sizes of each layer as below; So, converter should read/save the values exactly same size and order as the original weights. l.biases : 32 l.scales + l.rolling_mean + l.rolling_variance : 96 l.weights : 864 l.biases : 64 l.scales + l.rolling_mean + l.rolling_variance : 192 l.weights : 18432 l.biases : 128 l.scales + l.rolling_mean + l.rolling_variance : 384 l.weights : 73728 l.biases : 64 l.scales + l.rolling_mean + l.rolling_variance : 192 l.weights : 8192 l.biases : 128 l.scales + l.rolling_mean + l.rolling_variance : 384 l.weights : 73728 l.biases : 256 l.scales + l.rolling_mean + l.rolling_variance : 768 l.weights : 294912 l.biases : 128 l.scales + l.rolling_mean + l.rolling_variance : 384 l.weights : 32768 l.biases : 256 l.scales + l.rolling_mean + l.rolling_variance : 768 l.weights : 294912 l.biases : 512 l.scales + l.rolling_mean + l.rolling_variance : 1536 l.weights : 1179648 l.biases : 256 l.scales + l.rolling_mean + l.rolling_variance : 768 l.weights : 131072 l.biases : 512 l.scales + l.rolling_mean + l.rolling_variance : 1536 l.weights : 1179648 l.biases : 256 l.scales + l.rolling_mean + l.rolling_variance : 768 l.weights : 131072 l.biases : 512 l.scales + l.rolling_mean + l.rolling_variance : 1536 l.weights : 1179648 l.biases : 1024 l.scales + l.rolling_mean + l.rolling_variance : 3072 l.weights : 4718592 l.biases : 512 l.scales + l.rolling_mean + l.rolling_variance : 1536 l.weights : 524288 l.biases : 1024 l.scales + l.rolling_mean + l.rolling_variance : 3072 l.weights : 4718592 l.biases : 512 l.scales + l.rolling_mean + l.rolling_variance : 1536 l.weights : 524288 l.biases : 1024 l.scales + l.rolling_mean + l.rolling_variance : 3072 l.weights : 4718592 l.biases : 1024 l.scales + l.rolling_mean + l.rolling_variance : 3072 l.weights : 9437184 l.biases : 1024 l.scales + l.rolling_mean + l.rolling_variance : 3072 l.weights : 9437184 l.biases : 64 l.scales + l.rolling_mean + l.rolling_variance : 192 l.weights : 32768 l.biases : 1024 l.scales + l.rolling_mean + l.rolling_variance : 3072 l.weights : 11796480 l.biases : 425 l.weights : 435200
@CBIR-LL @opyk I have trained the weights under darknet ,and used tiny-yolo.cfg.Now I want to convert the cfg to prototxt,how can I do that?
@mychina75 I used yolo.weights , and got the same problem with you ,did you solve the problem?
@dedoogong Did you slove the convert problem?
I have a question about the difference between yolo2.cfg and caffe proto. In yolov2.cfg, the last block contains activation layer "linear", where this layer may not be considered in caffe proto, does this layer contain some extra params ?
@lvboodvl in caffe you don't need and extra layer for the linear layer that appear in darknet. The linear layer in this case is the identity function.
could you release the script?
thank you very much