thtrieu / darkflow

Translate darknet to tensorflow. Load trained weights, retrain/fine-tune using tensorflow, export constant graph def to mobile devices
GNU General Public License v3.0
6.13k stars 2.08k forks source link

how should i set defaults.py ,if i want to train tiny-yolo-voc.cfg loading tiny-yolo-voc.weights. #666

Open junxuezheng opened 6 years ago

junxuezheng commented 6 years ago

how should i set defaults.py ,if i want to train tiny-yolo-voc.cfg loading tiny-yolo-voc.weights. def setDefaults(self): self.define('imgdir', './sample_img/', 'path to testing directory with images') self.define('binary', './bin/', 'path to .weights directory') self.define('config', './cfg/', 'path to .cfg directory') self.define('dataset', '../pascal/VOCdevkit/IMG/', 'path to dataset directory') self.define('labels', 'labels.txt', 'path to labels file') self.define('backup', './ckpt/', 'path to backup folder') self.define('summary', '', 'path to TensorBoard summaries directory') self.define('annotation', '../pascal/VOCdevkit/ANN/', 'path to annotation directory') self.define('threshold', -0.1, 'detection threshold') self.define('model', '', 'configuration of choice') self.define('trainer', 'rmsprop', 'training algorithm') self.define('momentum', 0.0, 'applicable for rmsprop and momentum optimizers') self.define('verbalise', True, 'say out loud while building graph') self.define('train', False, 'train the whole net') self.define('load', '', 'how to initialize the net? Either from .weights or a checkpoint, or even from scratch') self.define('savepb', False, 'save net and weight to a .pb file') self.define('gpu', 0.0, 'how much gpu (from 0.0 to 1.0)') self.define('gpuName', '/gpu:0', 'GPU device name') self.define('lr', 1e-5, 'learning rate') self.define('keep',20,'Number of most recent training results to save') self.define('batch', 16, 'batch size') self.define('epoch', 1000, 'number of epoch') self.define('save', 2000, 'save checkpoint every ? training examples') self.define('demo', '', 'demo on webcam') self.define('queue', 1, 'process demo in batch') self.define('json', False, 'Outputs bounding box information in json format.') self.define('saveVideo', False, 'Records video from input video or camera') self.define('pbLoad', '', 'path to .pb protobuf file (metaLoad must also be specified)') self.define('metaLoad', '', 'path to .meta file generated during --savepb that corresponds to .pb file')

sandeeprepakula commented 6 years ago

You can override the defaults using command line parameters For example : To change the default learning rate use as below --lr 0.001 Similarly for other values. Check darkflow --help for more information.

junxuezheng commented 6 years ago

@sandeeprepakula thanks, i have know how to change the defaults with it .but i don't know how much should i set values about 'lr'/'threshold'/'momentum'/batch/'epoch'/'save', it can get a good results when training tiny-yolo-voc.cfg and yolo-voc.cfg on voc2007+2012 .

sandeeprepakula commented 6 years ago

They are the hyper parameters, purely depends on your data set. Atleast for VOC the values given in the cfg files work better to start with. You have to play with all the hyper parameters and chose values which work better for your validation dataset and test on test dataset to see if chosen hyper parameters are able to generalise.

junxuezheng commented 6 years ago

@sandeeprepakula hey. i want to train tiny-yolo-voc.cfg loading tiny-yolo-voc.weights . training on voc2007+voc2012. test on voc 2007. if i set as tiny-yolo-voc.cfg(lr 0.001 ,epoch 30( 40000steps)) ,but the loss will be num at step 327. 0 1 2

sandeeprepakula commented 6 years ago

As you can see the loss is increasing as we progress, first thing you can do try to fix is by decreasing the learning rate further to 0.00001.

Malouke commented 6 years ago

Hi i am so sorry about my comment, but realy the documentation it s realy sucks why you we don't have any kind of explaination for each flags it's not clear how we can save all data between each steps for example .