Open HencyChen opened 7 years ago
Try to set random=0
at the end of your cfg-file.
Also you can try to base your cfg-file on Densenet instead of Resnet: https://pjreddie.com/darknet/imagenet/
Hello Alexey! I want to train YOLOv3 with backbone resnet50, 151,densenet201 and I have 10 classes. Following your instructions, I replace the final convolutional to region layer: [convolutional] size=1 stride=1 pad=1 filters=135 activation=linear
[region] anchors = 10.4090,14.3838, 26.7887,18.7072, 21.0344,35.3030, 47.9646,29.2603, 39.3145,62.3780, 82.8203,51.0651, 70.7212,117.3981, 172.7416,117.0773, 124.6597,252.8465 bias_match=1 classes=10 coords=4 num=9 softmax=1 jitter=.3 rescore=1
object_scale=5 noobject_scale=1 class_scale=1 coord_scale=1
absolute=1 thresh = .6 random=0 But I have a problem that darknet: ./src/shortcut_layer.c:43: resize_shortcut_layer: Assertion `l->w == l->out_w' failed. If set random=1 and If set random=0, it do not happen so can you please explain for me the problem happen? Thank you!
Hi @duynn912 , I also need YOLOv3 with backbone ResNet50. Did you write the cfg file and handle the problem that you got ?
Hi Zeynep Gokce,
I had rewrote cfg YOLOv3 with backbone ResNet50 following some instructions but I don't remember the link. I also tried training YOLOv3 with this cfg and got my results. Here I send you the cfg. If you want to train on your own dataset, you adjust some parameters such as 3 filters of convolutional, anchors and classes.
2018-08-12 22:52 GMT+07:00 Zeynep Gökce notifications@github.com:
Hi @duynn912 https://github.com/duynn912 , I am also need YOLOv3 with backbone ResNet50. Did you write the cfg file and handle the problem that you got ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pjreddie/darknet/issues/187#issuecomment-412351935, or mute the thread https://github.com/notifications/unsubscribe-auth/AlXN0IQU2W152u6sp28NbXgC9EnFJecUks5uQE8qgaJpZM4PPLgH .
@duynn912 , Yeah i tried the YOLOv3 it was good, but i could not write the cfg with ResNet50 backbone. Could you share whole cfg file with me?
This is my e-mail : zzeynepgokce@gmail.com Thanks a lot.
@AlexeyAB thanks setting random=0
at the bottom fixed my issue. Any pointer to why? Thanks
@skyuuka Old version of darknet had some issues with resize of some layers when random=1. Current version of Darknet should work successfully with random=1.
@AlexeyAB thank you! In fact, I am using resnet18 as backbone, and download the weights from this page and this link The tail of my modified cfg looks like below:
.....
[shortcut]
activation=leaky
from=-3
[convolutional]
size=1
stride=1
pad=1
filters=125
activation=linear
[region]
anchors = 1.3221, 1.73145, 3.19275, 4.00944, 5.05587, 8.09892, 9.47112, 4.84053, 11.2364, 10.0071
bias_match=1
classes=20
coords=4
num=5
softmax=1
jitter=.3
rescore=1
object_scale=5
noobject_scale=1
class_scale=1
coord_scale=1
absolute=1
thresh = .6
random=0
If train from scratch using ./darknet detector train cfg/voc-resnet.data cfg/yolov2-resnet18-voc.cfg
, I need to change random=0
as pointed out by you.
But I would like to fine-tune from ImageNet pre-trained model. The command I used looks like ./darknet detector train cfg/voc-resnet.data cfg/yolov2-resnet18-voc.cfg models/resnet18.weights
. There is no error, but the training just does start, and here is the output
yolov2-resnet18-voc
layer filters size input output
0 conv 64 7 x 7 / 2 416 x 416 x 3 -> 208 x 208 x 64 0.814 BFLOPs
1 max 2 x 2 / 2 208 x 208 x 64 -> 104 x 104 x 64
2 conv 64 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 64 0.797 BFLOPs
3 conv 64 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 64 0.797 BFLOPs
4 res 1 104 x 104 x 64 -> 104 x 104 x 64
5 conv 64 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 64 0.797 BFLOPs
6 conv 64 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 64 0.797 BFLOPs
7 res 4 104 x 104 x 64 -> 104 x 104 x 64
8 conv 128 3 x 3 / 2 104 x 104 x 64 -> 52 x 52 x 128 0.399 BFLOPs
9 conv 128 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BFLOPs
10 res 7 104 x 104 x 64 -> 52 x 52 x 128
11 conv 128 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BFLOPs
12 conv 128 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BFLOPs
13 res 10 52 x 52 x 128 -> 52 x 52 x 128
14 conv 256 3 x 3 / 2 52 x 52 x 128 -> 26 x 26 x 256 0.399 BFLOPs
15 conv 256 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BFLOPs
16 res 13 52 x 52 x 128 -> 26 x 26 x 256
17 conv 256 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BFLOPs
18 conv 256 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BFLOPs
19 res 16 26 x 26 x 256 -> 26 x 26 x 256
20 conv 512 3 x 3 / 2 26 x 26 x 256 -> 13 x 13 x 512 0.399 BFLOPs
21 conv 512 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x 512 0.797 BFLOPs
22 res 19 26 x 26 x 256 -> 13 x 13 x 512
23 conv 512 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x 512 0.797 BFLOPs
24 conv 512 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x 512 0.797 BFLOPs
25 res 22 13 x 13 x 512 -> 13 x 13 x 512
26 conv 125 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 125 0.022 BFLOPs
27 detection
mask_scale: Using default '1.000000'
Loading weights from models/resnet18.weights...Done!
Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005
Saving weights to backup/resnet/yolov2-resnet18-voc_final.weights
Any idea why? Thanks
@skyuuka Because resnet18.weights is already trained the number of iterations >= max_batch-param(from your cfg-file)
Or add -clear
flag at the end of command
Or do partial. Extract required number of layers from resnet18.weights
, and then use it for training:
./darknet partial cfg/resnet18.cfg resnet18.weights resnet18.conv.25 25
you will get resnet18.conv.25
file with extracted [0 - 24] layers,
and train by using it
./darknet detector train cfg/voc-resnet.data cfg/yolov2-resnet18-voc.cfg resnet18.conv.25
Use partial-command in such a way as in these examples: https://github.com/AlexeyAB/darknet/blob/master/build/darknet/x64/partial.cmd
Hi AlexeyAB,
I have tried training yolov3 with backbone resnet 151 but the loss around 0,1 then 0,2 again 0,1. The loop still continues after 200k iteration and so on. I don't know reasons why it happens. I have 10 classes and these classes are small object. The number of objects are just about 3900 images for training. So I wonder if the parameters I fine-tune are wrong or the training images are not adequate to serve resnet 151
Hi Zeynep Gokce, I had rewrote cfg YOLOv3 with backbone ResNet50 following some instructions but I don't remember the link. I also tried training YOLOv3 with this cfg and got my results. Here I send you the cfg. If you want to train on your own dataset, you adjust some parameters such as 3 filters of convolutional, anchors and classes. 2018-08-12 22:52 GMT+07:00 Zeynep Gökce notifications@github.com: … Hi @duynn912 https://github.com/duynn912 , I am also need YOLOv3 with backbone ResNet50. Did you write the cfg file and handle the problem that you got ? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#187 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AlXN0IQU2W152u6sp28NbXgC9EnFJecUks5uQE8qgaJpZM4PPLgH . I have tried training yolov3 with backbone resnet34 ,but the training class closed to 1, obj and no obj closed to 0. Would you please send your cfg YOLOv3 with backbone ResNet50 for compared or give me some instructions. TKS my email: 352670487@qq.com
Hi Gotta-C,
I still use my config i uploaded on this discussion and set random=0 for training.
Vào Th 3, 9 thg 10, 2018 vào lúc 10:59 Gotta-C notifications@github.com đã viết:
Hi Zeynep Gokce, I had rewrote cfg YOLOv3 with backbone ResNet50 following some instructions but I don't remember the link. I also tried training YOLOv3 with this cfg and got my results. Here I send you the cfg. If you want to train on your own dataset, you adjust some parameters such as 3 filters of convolutional, anchors and classes. 2018-08-12 22:52 GMT+07:00 Zeynep Gökce notifications@github.com: … <#m-827239785239708231> Hi @duynn912 https://github.com/duynn912 https://github.com/duynn912 , I am also need YOLOv3 with backbone ResNet50. Did you write the cfg file and handle the problem that you got ? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#187 (comment) https://github.com/pjreddie/darknet/issues/187#issuecomment-412351935>, or mute the thread https://github.com/notifications/unsubscribe-auth/AlXN0IQU2W152u6sp28NbXgC9EnFJecUks5uQE8qgaJpZM4PPLgH . I have tried training yolov3 with backbone resnet34 ,but the training class closed to 1, obj and no obj closed to 0. Would you please send your cfg YOLOv3 with backbone ResNet50 or give me some instructions. TKS my email: 352670487@qq.com
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pjreddie/darknet/issues/187#issuecomment-428051458, or mute the thread https://github.com/notifications/unsubscribe-auth/AlXN0DmlsSZx9KPacwBGUYv7hT6hGBcJks5ujB8SgaJpZM4PPLgH .
@AlexeyAB Hi, when we use resnet18 as the backbone, why we only use the first 25[0 -24] layers for pre-train, instead of the first 26[0-25] layers?
Hi @AlexeyAB , I am trying to train the yolov3 model with densenet201 pre-trained weights. Can you help me out with the changes I'll have to make in the yolov3-cfg file in order to train it on COCO dataset with densenet pre trained convolutional weights. Thanks in advance.
Hi @AlexeyAB , I am trying to train the yolov3 model with densenet201 pre-trained weights. Can you help me out with the changes I'll have to make in the yolov3-cfg file in order to train it on COCO dataset with densenet pre trained convolutional weights. Thanks a lot!.
Hi @duynn912 , I also need YOLOv3 with backbone ResNet50. Did you write the cfg file and handle the problem that you got ? my email: 2135247967@qq.com Thanks a lots!
Hi @zeynepgokce , I also need YOLOv3 with backbone ResNet50. Can you share the whole cfg file with me ? my email: 2135247967@qq.com Thanks a lots!
HI @zeynepgokce @duynn912 i research yolo v3. i want to change backbone and then find this git. could you send your resnet cfg in yolo v3? my email is syshin@jlk-inspection.com
Hi, I upload my cfg resnet here. https://drive.google.com/drive/folders/1rof0f8mCNKTYJOCWElTYQLOq513Gh5_V?usp=sharing
Hi, I upload my cfg resnet here. https://drive.google.com/drive/folders/1rof0f8mCNKTYJOCWElTYQLOq513Gh5_V?usp=sharing
I have a question bout your code. i know yolo v3 has 3 yolo layers. but in your codes, there is only one layers. so is that for yolo v2 not for yolo v3.
@AlexeyAB thank you! In fact, I am using resnet18 as backbone, and download the weights from this page and this link The tail of my modified cfg looks like below:
..... [shortcut] activation=leaky from=-3 [convolutional] size=1 stride=1 pad=1 filters=125 activation=linear [region] anchors = 1.3221, 1.73145, 3.19275, 4.00944, 5.05587, 8.09892, 9.47112, 4.84053, 11.2364, 10.0071 bias_match=1 classes=20 coords=4 num=5 softmax=1 jitter=.3 rescore=1 object_scale=5 noobject_scale=1 class_scale=1 coord_scale=1 absolute=1 thresh = .6 random=0
If train from scratch using
./darknet detector train cfg/voc-resnet.data cfg/yolov2-resnet18-voc.cfg
, I need to changerandom=0
as pointed out by you.But I would like to fine-tune from ImageNet pre-trained model. The command I used looks like
./darknet detector train cfg/voc-resnet.data cfg/yolov2-resnet18-voc.cfg models/resnet18.weights
. There is no error, but the training just does start, and here is the outputyolov2-resnet18-voc layer filters size input output 0 conv 64 7 x 7 / 2 416 x 416 x 3 -> 208 x 208 x 64 0.814 BFLOPs 1 max 2 x 2 / 2 208 x 208 x 64 -> 104 x 104 x 64 2 conv 64 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 64 0.797 BFLOPs 3 conv 64 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 64 0.797 BFLOPs 4 res 1 104 x 104 x 64 -> 104 x 104 x 64 5 conv 64 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 64 0.797 BFLOPs 6 conv 64 3 x 3 / 1 104 x 104 x 64 -> 104 x 104 x 64 0.797 BFLOPs 7 res 4 104 x 104 x 64 -> 104 x 104 x 64 8 conv 128 3 x 3 / 2 104 x 104 x 64 -> 52 x 52 x 128 0.399 BFLOPs 9 conv 128 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BFLOPs 10 res 7 104 x 104 x 64 -> 52 x 52 x 128 11 conv 128 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BFLOPs 12 conv 128 3 x 3 / 1 52 x 52 x 128 -> 52 x 52 x 128 0.797 BFLOPs 13 res 10 52 x 52 x 128 -> 52 x 52 x 128 14 conv 256 3 x 3 / 2 52 x 52 x 128 -> 26 x 26 x 256 0.399 BFLOPs 15 conv 256 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BFLOPs 16 res 13 52 x 52 x 128 -> 26 x 26 x 256 17 conv 256 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BFLOPs 18 conv 256 3 x 3 / 1 26 x 26 x 256 -> 26 x 26 x 256 0.797 BFLOPs 19 res 16 26 x 26 x 256 -> 26 x 26 x 256 20 conv 512 3 x 3 / 2 26 x 26 x 256 -> 13 x 13 x 512 0.399 BFLOPs 21 conv 512 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x 512 0.797 BFLOPs 22 res 19 26 x 26 x 256 -> 13 x 13 x 512 23 conv 512 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x 512 0.797 BFLOPs 24 conv 512 3 x 3 / 1 13 x 13 x 512 -> 13 x 13 x 512 0.797 BFLOPs 25 res 22 13 x 13 x 512 -> 13 x 13 x 512 26 conv 125 1 x 1 / 1 13 x 13 x 512 -> 13 x 13 x 125 0.022 BFLOPs 27 detection mask_scale: Using default '1.000000' Loading weights from models/resnet18.weights...Done! Learning Rate: 0.001, Momentum: 0.9, Decay: 0.0005 Saving weights to backup/resnet/yolov2-resnet18-voc_final.weights
Any idea why? Thanks
hello, Can someone tell me how the feature maps at layer 10 in resnet18 are added? The dimensions of the input feature map are inconsistent?
10 res 7 104 x 104 x 64 -> 52 x 52 x 128
Hi AlexeyAB, I'm trying to train resnet50 for faster R-CNN is this supported by the darknet, and is there anything else for the Faster R-CNN I can use in the darknet, and what is the recommended cfg, my work is to detect 4 (objects person, car, bus, motorcycle), I already did that with YOLOv4 and now I need to do it with the Faster R-CNN (comparison).
Hi, I'm going to combine the residual blocks of ResNet to tiny YOLO, and I found that the residual blocks in the .cfg file is " [shortcut] from=-4 activation=leaky " So I add this three lines in the tiny YOLO cfg file. But when I start the training process, it shows these messages: "Cannot resize this type of layer: Permission denied darknet: ./src/utils.c:224: error: Assertion `0' failed. Aborted (core dumped)" Anyone can tell me what's this mean or why it happens? Many thanks!!