I am using py-faster-rcnn to train the 2007 VOC dataset. When I run on the original 21 classes, it works fine, but when I change the original number of classes, I get an error..
I am doing this for 1 class ('person'). I made the following changes to the original codes:
layer {
name: "bbox_pred"
type: "InnerProduct"
bottom: "fc7"
top: "bbox_pred"
inner_product_param {
num_output: 8
}
}
line 28:self._classes = ('__background__', # always index 0
'person')
# removed -1's from the lines below
x1 = float(get_data_from_tag(obj, 'xmin'))
y1 = float(get_data_from_tag(obj, 'ymin'))
x2 = float(get_data_from_tag(obj, 'xmax'))
y2 = float(get_data_from_tag(obj, 'ymax'))
VOCopts.classes={...
'person'};
I get the following error after I run this command,
I have also attached a full trace of my program running.
Error:
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(_self._args, *_self._kwargs)
File "./tools/train_faster_rcnn_alt_opt.py", line 123, in train_rpn
roidb, imdb = get_roidb(imdb_name)
File "./tools/train_faster_rcnn_alt_opt.py", line 68, in get_roidb
roidb = get_training_roidb(imdb)
File "/home/microway/test/pytest/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 121, in get_training_roidb
imdb.append_flipped_images()
File "/home/microway/test/pytest/py-faster-rcnn/tools/../lib/datasets/imdb.py", line 108, in append_flipped_images
assert (boxes[:, 2] >= boxes[:, 0]).all()
AssertionError
Hi,
I have also encountered this error. Seems like something is wrong in at least one of the annotations, an artificial solution is the following: in imdb.py
for b in range(len(boxes)):
if boxes[b][2] < boxes[b][0]:
boxes[b][0] = 0
assert (boxes[:, 2] >= boxes[:, 0]).all()
Hope this helps!
@marphil I get the following error:
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python2.7/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python2.7/multiprocessing/process.py", line 114, in run
self._target(_self._args, *_self._kwargs)
File "./tools/train_faster_rcnn_alt_opt.py", line 122, in train_rpn
roidb, imdb = get_roidb(imdb_name)
File "./tools/train_faster_rcnn_alt_opt.py", line 67, in get_roidb
roidb = get_training_roidb(imdb)
File "/media/dl/c0d34b51-8a78-4364-bc19-35003bf01885/RCNN/py-faster-rcnn/tools/../lib/fast_rcnn/train.py", line 118, in get_training_roidb
imdb.append_flipped_images()
File "/media/dl/c0d34b51-8a78-4364-bc19-35003bf01885/RCNN/py-faster-rcnn/tools/../lib/datasets/imdb.py", line 106, in append_flipped_images
boxes = self.roidb[i]['boxes'].copy()
File "/media/dl/c0d34b51-8a78-4364-bc19-35003bf01885/RCNN/py-faster-rcnn/tools/../lib/datasets/imdb.py", line 67, in roidb
self._roidb = self.roidb_handler()
File "/media/dl/c0d34b51-8a78-4364-bc19-35003bf01885/RCNN/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 103, in gt_roidb
for index in self.image_index]
File "/media/dl/c0d34b51-8a78-4364-bc19-35003bf01885/RCNN/py-faster-rcnn/tools/../lib/datasets/pascal_voc.py", line 204, in _load_pascal_annotation
x1 = float(bbox.find('xmin').text)
ValueError: invalid literal for float(): 737,
Hello yawadugyamfi, did you find a solution to your error? Would you share it with us please?
Never mind, I found the answer. There should be no <ymin>0</ymin> nor <xmin>0</xmin> in an object.
I changed that in the Annotations folder with the two commands (./ means the current folder is Annotations):
grep -rl '<ymin>0</ymin>' ./ | xargs sed -i 's#<ymin>0</ymin>#<ymin>1</ymin>#g'
and
grep -rl '<xmin>0</xmin>' ./ | xargs sed -i 's#<xmin>0</xmin>#<xmin>1</xmin>#g'
Now training is running smoothly. .
@marphil in which function you wrote those lines?
@DiegoPortoJaccottet I got sed: no input files
@marphil that worked for me!.
@DiegoPortoJaccottet your fix worked for me, thanks! The @marphil fix produces the same assertion error in my case.
@DiegoPortoJaccottet Even i got sed : no input files. I have my annotation files in that folder ( *.xml)
@harora
You got 'sed: no input files' from the commands I described or from Faster-RCNN?
@moyans I get the same error with you.
y2= float(bbox.find('ymax').text)
ValueError: invalid literal for float(): 196006001002176.jpg
Have you found any solution to it? Thank you
you need check this img and label.
来自 魅族 MX5
-------- 原始邮件 --------
发件人:Xiang notifications@github.com
时间:周五 5月5日 09:52
收件人:rbgirshick/py-faster-rcnn py-faster-rcnn@noreply.github.com
抄送:moyans ice_moyan@163.com,Mention mention@noreply.github.com
主题:Re: [rbgirshick/py-faster-rcnn] AssetionError: training py-faster-rcnn with one class (#34)
@moyans I get the same error with you.
y2= float(bbox.find('ymax').text)
ValueError: invalid literal for float(): 196006001002176.jpgDo you find any solution to it? Thank you
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/rbgirshick/py-faster-rcnn","title":"rbgirshick/py-faster-rcnn","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/rbgirshick/py-faster-rcnn"}},"updates":{"snippets":[{"icon":"PERSON","message":"@XiangyuChu in #34: @moyans I get the same error with you. rnrny2= float(bbox.find('ymax').text)rnValueError: invalid literal for float(): 196006001002176.jpgrnrnDo you find any solution to it? Thank you "}],"action":{"name":"View Issue","url":"https://github.com/rbgirshick/py-faster-rcnn/issues/34#issuecomment-299353335"}}}
@moyans 196006001002176.jpg is very odd. My images are usually "000000.jpg", same as VOC2007.
And I have removed "-1" from the lines below
x1 = float(bbox.find( 'xmin').text)
y1 = float(bbox.find('ymin').text)
x2 = float(bbox.find('xmax').text)
y2 = float(bbox.find('ymax').text)
check the label out of range?
来自 魅族 MX5
-------- 原始邮件 --------
发件人:Xiang notifications@github.com
时间:周五 5月5日 10:32
收件人:rbgirshick/py-faster-rcnn py-faster-rcnn@noreply.github.com
抄送:moyans ice_moyan@163.com,Mention mention@noreply.github.com
主题:Re: [rbgirshick/py-faster-rcnn] AssetionError: training py-faster-rcnn with one class (#34)
@moyans 196006001002176.jpg is very odd. My images are usually "000000.jpg", same as VOC2007.
And I have removed "-1" from the lines below
x1 = float(get_data_from_tag(obj, 'xmin'))
y1 = float(get_data_from_tag(obj, 'ymin'))
x2 = float(get_data_from_tag(obj, 'xmax'))
y2 = float(get_data_from_tag(obj, 'ymax'))—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/rbgirshick/py-faster-rcnn","title":"rbgirshick/py-faster-rcnn","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/rbgirshick/py-faster-rcnn"}},"updates":{"snippets":[{"icon":"PERSON","message":"@XiangyuChu in #34: @moyans 196006001002176.jpg is very odd. My images are usually "000000.jpg", same as VOC2007. rnAnd I have removed "-1" from the lines belowrn x1 = float(get_data_from_tag(obj, 'xmin'))rn y1 = float(get_data_from_tag(obj, 'ymin'))rn x2 = float(get_data_from_tag(obj, 'xmax')) rn y2 = float(get_data_from_tag(obj, 'ymax'))"}],"action":{"name":"View Issue","url":"https://github.com/rbgirshick/py-faster-rcnn/issues/34#issuecomment-299357112"}}}
in the Annotation folder I run
grep -rl '<ymin>0</ymin>' ./ | xargs sed -i 's#<ymin>0</ymin>#<ymin>1</ymin>#g'
I got: sed : no input files just like @harora . I want to know why. @DiegoPortoJaccottet
@moyans Thanks for your help. I have solved the error. I found an error in "output.txt", i.e. 002175.jpg c 669 155 769 **196006001002176.jpg p 207 188 229 257. What puzzles me is that I cannot find error in .xml. Anyway, it is solved. Thank you again!
I replaced xmin 0 and ymin 0 with xmin 1 and ymin 1, all things resolved!
see more https://github.com/rbgirshick/py-faster-rcnn/issues/34
in the Annotation folder I run
grep -rl '<ymin>0</ymin>' ./ | xargs sed -i 's#<ymin>0</ymin>#<ymin>1</ymin>#g'
I got:sed : no input filesjust like @harora . I want to know why. @DiegoPortoJaccottet
replace 0 with 0.0
Most helpful comment
Hi,
I have also encountered this error. Seems like something is wrong in at least one of the annotations, an artificial solution is the following: in imdb.py
Hope this helps!