# [Tutorial] How to run the code...

What is the most distressing thing in life?

Not money, not paper, but the author released their fantastic code while you do not know how to run it.

So, this tutorial records how I run the code incremental detectors using VOC 2007 dataset.

# Prepare

1. Install Tensorflow 1.5 (conda install tensorflow-gpu==1.5)
2. Install Matlab
3. Clone the code
4. Make folders: datasets,resnet

Well, nothing to say.

Then, make a soft link ln -s XXXX/VOCdevkit ./datasets/voc/VOCdevkit/

Finally, create a folder mkdir -p ./datasets/voc/VOCdevkit/VOC2007/EvalCache/, or you will get an error when evaluating.

# Generate proposals

I HATE MATLAB.

1. cd into the code folder
2. git clone https://github.com/pdollar/edges
3. Download https://pdollar.github.io/toolbox/archive/piotr_toolbox.zip and unzip it
4. Open compute_edgeboxes.m. Comment the COCO part, uncomment VOC part. Change paths. Notice that the result folder should be EdgeBoxesProposals
5. cd edges and compile it follow the instructions:

1. Run compute_edgeboxes.m . It will take a looooooooooooooong time

PS: the toolbox says that it can process images at the speed of 60fps, but in my machine, 0.6 FPS. :sob: 6 hours for VOC, and 37+ hours for COCO.

# Make tfrecord

Well, next, generate tfrecord files.

Open datasets.py, in the end, you can see the __main__. Modify it, or just stay them unchanged.

If your split is not called train, val, trainval or test (For me, I call them train_step_1, test_step_1 and so on), delete the assert in VOCLoader.

Then, run this file.

The result files will show in the datasets folder.

# Run the code! hahaha

For example, I want to train (5+5+5+5) classes.

To start the first session, run

And for the following sessions:

And you can notice that this code only use the first GPU.

BTW: you should change the parameter, like 40K, to your own!!!

# Use on my own dataset

Personally, it is easy to convert other dataset formats to VOC format. Isn't it?

So, the first step, convert your dataset! (For me, I convert COCO to VOC)

Then, replace the class names in voc_loader.py.

Then, search 20 through all codes, and replace into your class numbers. (For me, 20 to 80)

Finally, run python3 dataset.py to generate tfrecord files, and train the net.

WARNING: Maybe you should write a script to re-start training after it crashes due to the annoying NaN loss......

And I think that something wrong in network.py when distilling. So I use the following code:

Thank you again for the amazing code, and have fun.