ShaoqingRen / faster_rcnn

Faster R-CNN
Other
2.71k stars 1.22k forks source link

Training on a separate dataset from scratch #36

Open duygusar opened 9 years ago

duygusar commented 9 years ago

hello ! Thank you for making the code available, much appreciated. I was formerly working with caffe and selective search, instead of using rcnn I had written my own scripts, I have bumped into every problem with computational cost of localization so I want to experiment right away

Anyhow, I went over the code and I thought a mini guide for training a whole new dataset from scratch would be much appreciated as I have a few questions in my head. Is it possible to start training without finetuning from a pretrained model? (I do have a one class (pos or neg/object or b.g. (not object)) problem which is not an object in any of the classes of VOC or imagenet, so I believe I need a separate model for objectness trained on my dataset) Do I train a network originally defined as in caffe paper using annotation boxes as positives? Do I need to compute image mean myself? If so, is the image mean of the whole frame or the annotation box? I am assuming it should be in caffe channels order? Since I keep getting the libprotobuf error it is making it difficult to trace in debug mode ( I can't run any function twice on matlab)

I would really appreciate the tips to train on a whole new dataset (which I can arrange in voc format ) if anyone has already attempted to do so.Thanks !

athus1990 commented 9 years ago

Or we could start from FAST RCNN and then denote the changes required for Faster RCNN

duygusar commented 9 years ago

@athus1990 Can you elaborate? I have taken a leap of faith to faster rcnn without working with fast rcnn, I took a look at the paper. The experiments there also initializes from pretrained networks right? Is it only for time concern (or well better objectness)? Do you suggest that I train a fast rcnn model and then add the layers introduced in faster rcnn using the weights from the initial fast rcnn? Or can I just use do_proposal_train and then do_fast_rcnn_train with those proposals for 1st and 2nd stages? - edit:that is where I stumble do_proposal_train initializes with the pretrained models, trying to go over proposal_train to see

duygusar commented 9 years ago

update: the vgg16 on imagenet comes from caffe model zoo so I think it is this one: https://gist.github.com/ksimonyan/211839e770f7b538e2d8 The ZF one is said to be trained on MSRA, I think the architecture should be Zeiler & Fergus paper they refer to, so it seems like they are not random models. However since I have one class and it is not any of the objects in those datasets I need to somehow skip initializing

Astrosun commented 8 years ago

@duygusar May I know how you deal with the image mean part? So for my own data set, do we need to compute the image means of our own images? Do we still need to normalize the input?

Thanks a lot!

duygusar commented 8 years ago

@Astrosun You don't "have to" but it is recommended that you do for better performance. I have written a script to calculate the mean of all training data and I used that. To be honest, since the training dataset is big, it doesn't make much difference if you assign just some average numbers, around say 100 to 120 for each channel (rgb). It does help when you subtract it from the image, so at least use those random numbers even if you don't calculate the mean. Well take this advice with a grain of salt if you have a peculiar dataset :)

Astrosun commented 8 years ago

@duygusar

Thanks so much for your valuable advice and it will be the greatest help!

By the way, one more question, when you calculate the mean of your training data using your own script, do you add them up together then calculate the average value? I am wondering that whether it will cost a lot of time?

Thanks again!

duygusar commented 8 years ago

@Astrosun It was a long time ago, so I don't exactly remember but I did read in a list on images so I must have done it with a loop, since it is a simple computation, it didn't take that long. You also need to change the order of rgb and reshape the output though.

Astrosun commented 8 years ago

@duygusar

Thanks a lot for your valuable advice and I will try it!