-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ResNet Implementation for Faster-rcnn #62
Comments
Hi @twtygqyy, what training error and validation error are you obtaining for your ResNet? |
Hi @victorhcm I'm still working on it and I found it is not easy to train a Faster-rcnn model from scratch with ResNet. Fortunately, the author released the pre-trained models yesterday, you can download them from https://github.com/KaimingHe/deep-residual-networks to fine-tune a fater-rcnn model |
Thank you, @twtygqyy! |
@twtygqyy the 2nd question is, have you achieved any success in finetuning ResNET? can you pls share your experience |
@kshalini For the second question, in order to use ResNet model for fine-tuning, it is necessary to update the current caffe fork in py-faster-rcnn since it is using an old version without BN and scaling layers which ResNet requires. |
I've just updated the caffe submodule to one rebased onto Caffe master as of this morning (commit 33f2445). |
@rbgirshick Thanks! |
1 similar comment
@rbgirshick Thanks! |
Was someone successful in training ResNet Faster-RCNN models? If so, could you upload the prototxt and solvers. |
a naive question here. is there any comparative study on using plain resNet vs doing a pyfasterRCNN+resNet? on the VOC datasets, the resNET-51 seems to give >80% accuracy already. in case we are dealing with lesser no. of object categories (say < 100), what would be better recommendation - just go with resNET (34, 51 etc.) or to go with resNET + pyFasterRCNN? |
Hi @kshalini, do you need the localization of the objects? If that is the case, I think you should go with resNET + pyFasterRCNN, as resNET alone just provides the object class scores. |
@victorhcm in order to train pyFasterRCNN with resNET, we also need the (resnet) train_val.prototxt which am not able to locate anywhere yet. only deploy.prototxt seems to be available. does someone have one? (maybe @twtygqyy ?) |
@kshalini : Take a look at models/VGG/faster_rcnn_alt_opt/ . The solvers and train-val equivalents are there. For eg: in stage1_fast_rcnn_solver30k40k.pt the train prototxt is |
@kshalini Actually MSRA used ResNet with RPN layer from Faster-rcnn paper to do object detection on MSCOCO object detection challenge (80 categories), I'm not quite understand your question about the selection between ResNet or ResNet Faster-rcnn to deal with lesser no. of object categories. |
@kshalini There is not region proposal networks in ResNet train_val prototxt, you have to insert RPN layers for object detection instead of only ResNet for classification. |
@twtygqyy @siddharthm83 @victorhcm thanks! actually i had managed to get a pyFasterRCNN trained by finetuning the VGGnet using the end2end method, about a month ago and the results were quite decent (>85% classification for my dataset with about 50 categories). i now want to try this using resNET for classification. just that I am struggling to locate a train_val.prototxt for resNet. The Kaiming He, Github link just has the deploy.prototxt. I don't know yet how to modify that and make it into a train_val (i think some edits needs to go in at the top and bottom) that's where I am looking for some help. |
@kshalini |
@twtygqyy awesome!!! thanks a lot. will try this out shortly. as a first step - to train as a simple Caffe model and then step-2, in combination with fasterRCNN, just so that I know if am getting anything wrong along the path. are there any additional instructions to keep in mind while training? (like flip or other data augmentations like skew, scale etc.) |
@kshalini ; i dont completely understand your question. I thought you wanted to do detection and hence asking your question here (faster-rcnn). Can you explain what your use case is? |
@siddharthm83 my use case is to classify types of cars. initially i tried basic finetuning (no rcnn) and got up to a certain level of accuracy (~70%). later i tried out faster-rcnn (finetuned vgg) and i got around ~80% classification accuracy. now am exploring if i can use resNet for the same. so i want to try this out in steps - first without rcnn and then with faster-rcnn. I am comparing accuracy and speed of these approaches. though the primary objective is classification, the reason i am interested in localization also is to analyze the failure cases (false +ves etc.) to understand where it is going wrong. pls advice if i am missing something. thanks. |
@kshalini , good problem to solve. Check Hinton's paper on dark knowledge where he talks about building specialist nets to classify datasets where the datasets can be easily confused (too similar). |
@kshalini How did you finetune the pyfasterrcnn with VGG16? |
@arushk1 |
Are you able to replace VGG16 with Resent in py-faster-rcnn and use Kaiming's pretrained models to finetune py-faster-rcnn successfully? |
@kaishijeng Yes, I did, just by inserting RPN layers after conv5 and I add one additional conv layer for size normalization. I'm not sure whether I did it in a right way but it seems work for me. |
Which pretrained resnet model (50, 101 or 152) do you use? Do you mind sharing your trained model and train.prototxt? I like to compare performance with VGG16. |
@kaishijeng |
@twtygqyy Why did you insert RPN layers after conv5 and not before conv5? see quote from paper bellow.
|
@SilverWaveGL Thanks for pointing out that, it should be like the quote you mentioned for reproducing the result in the paper. In my case, just for a quick test, I removed several repeated blocks in early convs since I do not have enough memory on my machine for a full ResNet faster-rcnn training. |
I'm training faster-rcnn with ResNet-50 layers on ms coco, train.prototxt provided by @siddharthm83. However, I'm getting loss_bbox = 0 and loss_cls = 0. Any insight would be appreciated. I0531 13:21:11.898075 32392 solver.cpp:229] Iteration 1860, loss = 0.474211 I0531 13:21:11.898149 32392 solver.cpp:245] Train net output #0: loss_bbox = 0 (* 1 = 0 loss) I0531 13:21:11.898160 32392 solver.cpp:245] Train net output #1: loss_cls = 0 (* 1 = 0 loss) I0531 13:21:11.898170 32392 solver.cpp:245] Train net output #2: rpn_cls_loss = 0.501028 (* 1 = 0.501028 loss) I0531 13:21:11.898180 32392 solver.cpp:245] Train net output #3: rpn_loss_bbox = 0.286518 (* 1 = 0.286518 loss) |
@liuchang8am , I am not sure what you are doing wrong. Hard to tell from the 4 lines you have pasted. Is your classifier loss 0 from the first iteration, or gradually converges to 0? |
@siddharthm83 The loss_bbox is 0 since the first iteration. I test the trained model, and it can't detect any objects in the pre-defined categories. Full experiment log is attached, hope it shows my error somewhere. |
@siddharthm83 I also followed a similar approach when merging resNet and py faster rcnn, however can you please explain me the reason why you removed the ( fc -relu - dropout ) layers and added a conv layer between rpn - ROI and rcnn modules |
@siddharthm83 I cannot think exactly why the output size of conv5_3 in VGG16 is 7 * 7. For example, if the size of input image is 600 * 1000,shouldn't it be 39*64 ? |
In order to get a pretrained resnet model for PASCAL VOC dataset (since py-faster-rcnn needs a pretrained model), should I train the Images after cropping the images based on annotations or should I train using whole images? |
@kristellmarisse You should use the ResNet model trained on Imagenet and train on whole images without cropping so as to generate negative samples. |
@abhirevan, when you got resnet-50 working with faster-rcnn, which dataset did you train on. I want to train on VOC being with. I can find imageNet models trained with resnet-50. should I first fine-tune imagenet for VOC (using plain resnet-50) and then use that model to train the rcnn? Or can I start the rcnn training with the imageNet model itself? |
@SilverWaveGL set the lr_mult and decay_mult to be zero in training stage? or in testing stage? can you mind explaining it? thanks. |
@siddharthm83 ,can you help me solve this problem?Thank you |
@janakipj you mentioned "For testing, I use the net.forward (standard python code) and try to interpret the output of the last layer using the key "fc3" which is the last layer in your trainval. And I get all equal values". Do you find why the values all equal ? I met same |
i am doing work on ResNet model for fixation prediction,i deploy ResNet model for one image but after input layer data is not feeding to the model? |
@twtygqyy |
Hi, everyone, I have release a Implementation of ResNet-101 based Faster-RCNN, which also used OHEM (Online Hard Example Mining) while training, you can find the code and model weights here |
@abhirevan @kshalini @twtygqyy @siddharthm83 @rbgirshick I'm trying to train the ResNet-50 model on PASCAL VOC 2007 trainval dataset. I'm using this command to start the training
I'm using the solver/train prototxt files from @twtygqyy repo However, I'm getting this error:
I'm on the latest commit of Pardon my lack of knowledge, but would you guys mind helping me resolve this error, please? Appreciate it. Thanks. |
That's a weird error, the error that it is giving is that the LayerParameter type has no field named Does VGG16 work properly then? |
No, I suppose not. I'm able to train and test VGG_CNN_M_1024 model successfully. However, the
Anyways, this is the output snippet from my VGG_CNN_M_1024 training:
##########################################################################
FYI, I'm using caffe-fast-rcnn from @rbgirshick repo and I think it does not have a Thanks for reaching out, though. Let me know if you need any other information. Thank you very much. |
@kshalini, how did you find the accuracy value for pyFasterRCNN trained by finetuning the VGGnet using the end2end method? What additional codes you used to get accuracy value? |
@onkarganjewar ,hi,why do you remove the BN from the original ResNet? I.m confused |
Hi everyone, I open source my implementation of Faster RCNN with ResNet for ImageNet Detection here. Hope it is useful for someone. Thanks! |
@tianzhi0549 On testing, the mAP is very low.Also detecting only class with bigger boundingboxes correctly in majority cases.Also has issue with overlapping cases.Can you please help me to trigger the issue. Thanks in advance. |
@twtygqyy Could you please give me your resnet files for faster rcnn?i saw someone find your train.prototxt and test.protxt,but i can not find them.I try to modify my .prototxt file,but failed.Thank you very much!!! |
Have found the reason of training very slow?I met the same problem. @twtygqyy |
@sulth something wrong with the method of calculate the AP, you need to implement your owns. |
@siddharthm83 Can we remain pooled_w & pooled_h params in the ROIpooling layer to equal 7 and just set spatio_scale=1/8 instead of spatio_scale=1/16? |
Hi I am trying to train Resnet-18 I have used train.prototxt as - name: "ResNet-18" layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { Add RPN networklayer { layer { layer { layer { layer { layer { layer { #========= RoI Proposal ============ layer { layer { layer { top: 'rpn_scores'
} #layer { name: 'debug-data'type: 'Python'bottom: 'data'bottom: 'rpn_rois'bottom: 'rpn_scores'python_param {module: 'rpn.debug_layer'layer: 'RPNDebugLayer'}#} layer { Stop Resnet till conv4x and add ROIpoolinglayer { Resume Resnet conv5x layers after ROIpooling layerslayer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { ######### Add faster RCNN cls and bbox layer layer { layer { layer { layer { And the test.prototxt file is - name: "ResNet-18" input: "data" input: "im_info" layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { Add RPN networklayer { layer { layer { layer { layer { layer { layer { #========= RoI Proposal ============ layer { layer { layer { top: 'rpn_scores'
} Stop Resnet till conv4x and add ROIpoolinglayer { Resume Resnet conv5x layers after ROIpooling layerslayer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { layer { ######### Add faster RCNN cls and bbox layer layer { layer { layer { When running test.prototxt I am facing as issue as - |
Recently, I'm trying to combine ResNet network with Faster-rcnn. As the first step, I tried to train a model with ResNet 34 networks without bottleneck architectures. There is no error during training process, however, the detection result is very bad. I believe there is something wrong in my implementation, here is the prototxt I used for training, can anybody offer some help about how should I modify it?
The text was updated successfully, but these errors were encountered: