Open mahavird opened 6 years ago
It could be done by implementing your own data set, see example of: https://github.com/chenyuntc/simple-faster-rcnn-pytorch/blob/master/data/voc_dataset.py
it should return
then replace it it in data/dataset.py
Hi @chenyuntc,
To train my dataset over your model I structured my dataset similar to VOC2007 format .
For the getting started purpose I took only 100 images and their respective annotation files. I placed the Images into a folder called JPEGImages of VOC2007 directory.
Similarly, I placed the corresponding annotations into a folder called Annotations of VOC 2007 directory.
Later I divided the dataset into train, test, val by placing them into four different text files(train.txt, test.txt,val.txt, trainval.txt) of VOC2007/Imagesets/Main directory.
As suggested by you I changed the labels (VOC_BBOX_LABEL_NAMES ) in voc_dataset.py with my labels.
But after making all the above changes I am getting the following error.
**`python3 train.py train --env='fasterrcnn-caffe' --plot-every=100 --caffe-pretrain
======user config========
{'caffe_pretrain': True,
'caffe_pretrain_path': 'checkpoints/vgg16_caffe.pth',
'data': 'voc',
'debug_file': '/tmp/debugf',
'env': 'fasterrcnn-caffe',
'epoch': 14,
'load_path': None,
'lr': 0.001,
'lr_decay': 0.1,
'max_size': 1000,
'min_size': 600,
'num_workers': 8,
'plot_every': 100,
'port': 8097,
'pretrained_model': 'vgg16',
'roi_sigma': 1.0,
'rpn_sigma': 3.0,
'test_num': 10000,
'test_num_workers': 8,
'use_adam': False,
'use_chainer': False,
'use_drop': False,
'voc_data_dir': '/home/mahavircingularity/simple-faster-rcnn-pytorch/VOCdevkit/VOCdevkit/VOC2007/',
'weight_decay': 0.0005}
==========end============
load data
model construct completed
0it [00:00, ?it/s]Traceback (most recent call last):
File "train.py", line 131, in
Do let me know what else changes to be made in your code.I am training on a dataset which contains 36 classes/labels.Also I have used LabelImg to create annotaions in PascalVOC format.
Do let me know if you need further info at my end.
Thanks in advance.
As indicated in the error message:
label.append(VOC_BBOX_LABEL_NAMES.index(name))
ValueError: tuple.index(x): x not in tuple
I think the annotation file is somewhat wrong
so that the name
is not in VOC_BBOX_LABEL_NAMES
.
BTW, you don't need to exactly turn your data to the format of xml
. Just write a function and return required items may be easier;
Hi @chenyuntc,
Thanks for your reply. It was very helpful.
Finally, I am able to use your implementation for training over my own dataset, but still, I have one major issue:
Can you point out where I might be going wrong?
Regards, Mahavir
shep
comes from https://github.com/chenyuntc/simple-faster-rcnn-pytorch/blob/master/utils/vis_tool.py#L31 these are the brief names(i.e. sheep->shep cat->c dog->d) I being lazy...Hi @chenyuntc,
Thanks for the reply. I am looking into the above issue, will keep you posted on the same.
Meanwhile, what is the size (resolution) of images which I should use for training my network?
Regards, Mahavir
what is the size (resolution) of images which I should use for training my network
It depends. In my experiments I crop image in preprocess
Hi, seems like there are quite a few hard-coded things that prevent custom datasets from being used that have a different number of classes from VOC2007. Namely, trainer.py hardcodes the confusion matrix with 21 classes (20 + 1), train doesn't load the number of classes from the dataset class names. Are you able to fix this?
Hi, have you solve this problem yet?@penguinshin
@LDoubleZhi have you solve this problem yet?
I solved in that I just changed the classes in the dataset file and the utility file that specifies class-related attributes. But I think there should be an update to the code that makes it easily customizable.
@mahavird Can you please share your dataset-related codes with which you were able to run this model? Thanks.
@mahavird Can you please share your dataset-related codes with which you were able to run this model? Thanks.
Hi @chenyuntc,
Thanks for your simplified(simple) implementation of Faster R-CNN in pytorch.
Going by your instructions, I was successfully able to train/test the simple-faster-rcnn-pytorch setup on my system.
Now, I have a custom dataset which has 36 classes, I would like to train a Simple-Faster-R-CNN model (VGG/RES101) for that? I think loading the dataset is the trickiest part, it would be great if you can suggest some tutorial/blog/link for the same.
Where do I get started, what changes need to be made?
I will make sure I open source the work I do during this process.
Thanks!