pkuCactus / BDCN

The code for the CVPR2019 paper Bi-Directional Cascade Network for Perceptual Edge Detection
MIT License
341 stars 71 forks source link

Why use different lr for each layer? Not converge problem. #19

Open anyuzoey opened 5 years ago

anyuzoey commented 5 years ago

Hi @pkuCactus I'm just read your paper. Your idea is very interesting and shows a very good performance. However, when I try to use your dataset, I saw you use different learning rates for each layer? Does this improve the performance a lot? I'm trying to deal with my datasets with diferent edge detection methods. I tried RCF and yours. RCF works find but yours found loss doesn't decrease much and accuracy doesn't improve much, even though I used pre-trained weights and learning rate decease(0.1) on the plateau. I have my own data preprocessed in a slightly different way. When I try RCF, just replace network part with RCF and change the weighted loss function, optimiser. Yours seems more complex: I switch from RCF to BDCN add sigmoid on results, use RCF loss(cause I think yours and RCF just different on sigmoid location), use different learning rate for each layer. I have inputs of 37272 and labels (1,72,72) batch size originally set 64 for RCF. Now batch size set to 16 iterator size is 1. Since my image is smaller I also tuned the atrous convolution rate from 4 to 3. My dataset is seismic images. Do you have any insights that why my model not converge? Really appreciate your help.

Thanks

xavysp commented 5 years ago

Hi @anyuzoey I think this is a great question, please people correct me if I am wrong. Whenever you are training a deep learning model for edge detection not boundary detection (because I have not evaluated in boundaries) is quite easy (for the model) to train, therefore, there will be overfitting if there is not enough data (actually there is not enough data to train DL models). Hence, a pre-trained model is used (like VGG16 trained on imagenet)... If you do not follow the same LR setting like in HED, CED, RCF, BDCN, your model won't train to detect edges in a given dataset. In the end, I suppose that actually, we are not doing edge detection with the different learning rate setting, because most of the edge detected by the DL model is erased by the same model's settings.

Cheers,

P.S. Please correct me if I am wrong

pkuCactus commented 5 years ago

As @xavysp said, since the training data is insufficient, the pretrained weight have small lr and new added weights has relatively large lr. You should note that the pretrained model are trained in BGR channel.

anyuzoey commented 5 years ago

Hi @xavysp @pkuCactus

Thank you very much for all your kind reply. Sorry for the late reply. In the beginning, I'm confused by this last sentence of @xavysp's answer

In the end, I suppose that actually, we are not doing edge detection with the different learning rate setting, because most of the edge detected by the DL model is erased by the same model's settings.

But with @pkuCactus's latest answer. Is that means actually different learning rate is for adjusting the pre-trained weights for the small edge detection datasets? Not sure if I understand it right. I did follow the same learning rate setting, but my dataset may be too sample for this network (no objects like BSDS500, the left side of an edge are the same as the right side) And BGR channel instead of RGB could be one problem.

Thanks

pkuCactus commented 5 years ago

according to your description

the left side of an edge are the same as the right side

i think the problem should be the approach you preprocess the data, you can check it. Or you can use the pretrained model to produce edges on your dataset directly and check the result.

anyuzoey commented 5 years ago

This is the nature of this dataset, as I said it’s seismic data. Left side and right side just have a offset. Same process works when use HED and RCF. Still debugging. But thank you for your speedy reply

xavysp commented 5 years ago

Hi @anyuzoey, let's see the image 29030 (a car) from BSDS500-test and the corresponding annotated edge-map, as most of the DL based models use yita, the annotation in the edge level will be deleted. At the end, you will be training for contour or boundary detection. As in the training images, there are annotation for edge, contour and boundary, our DL based edge detector will have a serious problem to converge (because you are training a model for edge detection with contour and boundary labels). Therefore, here I am guessing, you need pre-trained weights and set different LRs. By the way, I totally agree with @pkuCactus. Cheers

anyuzoey commented 5 years ago

hi @xavysp I agree this could be the problem. Thank you very much for your answer. Help a lot!

caihongzhiyue01 commented 4 years ago

@xavysp As you say" in the training images, there are annotation for edge, contour and boundary", I want to use the edge detection to assist the stereo matching network. if the network uses the boundary instead of the edge ,the matching precision will have a great improvement? I don't know the distinction between the edge and boundary?Looking forward to your reply. Thank you.

xavysp commented 4 years ago

@xavysp As you say" in the training images, there are annotation for edge, contour and boundary", I want to use the edge detection to assist the stereo matching network. if the network uses the boundary instead of the edge ,the matching precision will have a great improvement? I don't know the distinction between the edge and boundary?Looking forward to your reply. Thank you.

Hi @caihongzhiyue01, in my opinion, using BSDS dataset for edge or even boundary detection is not a good choice. Theoretically, as it has been trained in the wrong data, it won't give you a great precision matching. Regarding your first question, I don't know, we should compare the results (from the edge and boundary detection), with respect to edge you could use my work DexiNed and for boundary this repo is great (BDCN), please let me know the results, because what I am telling you is like a hypothesis. Second question: edge detection is every intensity changes in an image but boundary detection is the intensity changes in an image taking care of the ownership of the object. For example, the boundary detection of a zebra is the edge detected just of the limits of its body; in the edge detection level, the whole edges in the zebra are detected even black-and-white striped coats of its body. We could say that boundary detection of an image is like image segmentation.

Cheers,

Xavier