rbgirshick / voc-dpm

Object detection system using deformable part models (DPMs) and latent SVM (voc-release5). You may want to use the latest tarball on my website. The github code may include code changes that have not been tested as thoroughly and will not necessarily reproduce the results on the website.
http://www.cs.berkeley.edu/~rbg/latent/
MIT License
582 stars 308 forks source link

How to train a model for dataset other than Pascal dataset for eg. some tiger dataset for detecting tigers? #16

Open das007 opened 8 years ago

das007 commented 8 years ago

Hi, I am working on a project "Tiger Detection with Body Part Localization". So I want to detect and localize body parts of tiger using Deformable Part Models. I read your ReadMe file in which you have only discussed how to train and learn a model using Pascal Dataset. Can you please tell me how can I use your code to learn and model my dataset?

Thanks.

primetang commented 8 years ago

It is possible to train models using your own dataset. I recommend taking a look at data/pascal_data.m, which defines the function that we use for loading the PASCAL data into the internal data structures used by our code. To support your own data, you will need to define your own function that reads in your positive and negative examples and returns the same data structures as the function pascal_data(). After that, you can train and evaluate a model by pascal.m.

jlevis73 commented 8 years ago

@das007 were you successful in training on your Tiger dataset? I'm working on a similar project

das007 commented 8 years ago

I didn't use the DPM in my project because I got the above reply from primetang just 2 days back. So I used texture detection "Texton theoryrevisited:Abag-of-wordsapproachtocombinetextons" method to detect tiger location and then ran a Breadth First Search from that location to the surrounding regions of the image to detect the complete tiger.

jlevis73 commented 8 years ago

If you're still interested in using DPM, I've successfully trained on my own images. I was able to just insert my images into the PASCAL 2007 devkit and augment a few configuration files to reflect the additional images being inserted. Basically I just tricked the training program into thinking the PASCAL dataset had an additional class. After that it was as simple as running:

pascal_train('helmet', 2);

The object I was trying to detect was helmet so you would put 'tiger' instead, but I'm sure you get the idea.

das007 commented 8 years ago

Thanks, I will surely try it.

adekoerniawan commented 7 years ago

hi.. @jlevis73 could you help me please, Currently I am doing a thesis on object detection using deformable part model that requires me to train a new model to detect a certain object. However I have no idea how to direct the system to use my dataset(a collection of images and annotation) which is different from the the PASCAL datasets so as to train a new model. In this case i made some folders that i filled out with some images and anotations. those folders, divided :

  1. sample positif images

  2. Sample Negative Images

  3. Anotations

i use Voc-release 3.1. the library i got here : https://github.com/ApprenticeZ/voc-release-3.1-win, and pascal voc 2007,

I tried looking at their Readme and documentation guides but unfortunetly they do not make any mention detaily. Do correct me if I am wrong.

Let me know if I have not made my problem clear enough. Would you like to give me a simple tutorial how to train a new model in pascal voc for dpm method, i use it in windows 64 bit.

for your attention i appreciated and thanks in advance

cherishtttz commented 7 years ago

@jlevis73 Hello! I want to train my own dataset, but I don't know how to start training when I have made the dataset. could you please tell me about the functions you have modified and how to modify them?

jlevis73 commented 7 years ago

@adekurniawan44 I encountered that attempting to direct the system to my own file structure was incredibly difficult due to the depth of file path variables that depend on the PASCAL VOC file structure. To work around this I simply added my images into the PASCAL VOC's main image folder and created test.txt, train.txt, trainval.txt and val.txt files for each of my objects in the ImageSets/Main folder.

By doing this you are effectively expanding the number of objects in the PASCAL dataset to include the ones that you wish to train models for. Also, I used a Linux 64 bit environment so I can imagine you might encounter some other issues.

If you are still encountering errors or if I was unclear I'd be more than happy to help further.

jlevis73 commented 7 years ago

@cherishtttz I did not actually have to modify any functions, instead I modified the PASCAL dataset that the dpm software was built around to contain the objects that I desired models for. My previous couple posts outline a little bit of how I did it, but if you still have any questions let me know!

zackKassem commented 7 years ago

I wish i can see a video that explain how to modify the PASCAL dataset as Joel did , am a bit stuck .

cherishtttz commented 7 years ago

@jlevis73 Thank you for your reply, I guess I know what you mean, and I have tried to modify the function in voc-release5,it's pascal_data(),I think maybe you have used this function,too.Do you mean that?

adekoerniawan commented 7 years ago

@jlevis73 @jlevis thankyou so much for your reply, this is my email (ade.curniawan@gmail.com), could you send me the project which you have ever tried and got successfull including PASCAL VOC's main image folder, also test.txt, train.txt, trainval.txt and val.txt files for each of your objects in the ImageSets/Main folder, i wish those has been structured(path location for those files) based on your trying, i wanna try it in linux too, i hope i'll finding the answer, i think DPM is a new method for object detection, so it'll be a general issue, for the result i'll share it here, so everyone can learn and try it. once more thankyou so much

shaozhefeng commented 7 years ago

I have the same problem of using my own data to train the dpm model.could you please show me an example?code details may be better. thank you. @jlevis73

thanasissdr commented 7 years ago

@jlevis73 Sorry for this (naive) question, but for the objection we need only these 4 files, i.e. train.txt, val.txt, trainval.txt and test.txt, right?