Faster-RCNN-TensorFlow-Python3 icon indicating copy to clipboard operation
Faster-RCNN-TensorFlow-Python3 copied to clipboard

can't train my datasets

Open mp168 opened this issue 5 years ago • 9 comments

  File "D:/mp_code/smog_faster_rcnn/train.py", line 154, in train
    blobs = self.data_layer.forward()
  File "D:\mp_code\smog_faster_rcnn\lib\layer_utils\roi_data_layer.py", line 75, in forward
    blobs = self._get_next_minibatch()
  File "D:\mp_code\smog_faster_rcnn\lib\layer_utils\roi_data_layer.py", line 71, in _get_next_minibatch
    return get_minibatch(minibatch_db, self._num_classes)
  File "D:\mp_code\smog_faster_rcnn\lib\utils\minibatch.py", line 36, in get_minibatch
    im_blob, im_scales = _get_image_blob(roidb, random_scale_inds)
  File "D:\mp_code\smog_faster_rcnn\lib\utils\minibatch.py", line 70, in _get_image_blob
    im = cv2.imread(roidb[i]['image'])
KeyError: 'image'

I had seen the same questions, but i still can't solve it, I try to my data as yours, can you help me?

mp168 avatar Jul 16 '19 01:07 mp168

As I answered in the previous question this depends on you dataset, probably it is not good for this net.

The only way to solve it is to add the missing key in each xml file

morpheusthewhite avatar Jul 16 '19 06:07 morpheusthewhite

-

VOC2007

000001.jpg

-

The VOC2007 Database

PASCAL VOC2007

flickr

-

Fried Camels

Jinky the Fruit Bat

-

704

576

3

0

-

smog

Unspecified

0

0

-

83

335

148

396

this is my xml. and i only recognite one class,I can't find my datasets where is wrong??!!

mp168 avatar Jul 16 '19 06:07 mp168

Did you open it with a text editor (notepad if Windows or kate on linux) to paste the content here?

If not, do it and paste the content here

morpheusthewhite avatar Jul 16 '19 06:07 morpheusthewhite

VOC2007 000007.jpg The VOC2007 Database PASCAL VOC2007 flickr Fried Camels Jinky the Fruit Bat 704 576 3 0 smog Unspecified 0 0 176 260 209 293 smog Unspecified 0 0 221 260 250 296

mp168 avatar Jul 16 '19 06:07 mp168

Again, the keys are missing. I need it in the form

<key1>
    <key2>value</key2>
etc.
</key1>

morpheusthewhite avatar Jul 16 '19 06:07 morpheusthewhite

<annotation>
    <folder>VOC2007</folder>
    <filename>000007.jpg</filename>
    <source>
        <database>The VOC2007 Database</database>
		<annotation>PASCAL VOC2007</annotation>
		<image>flickr</image>
    </source>
	<owner>
		<flickrid>Fried Camels</flickrid>
		<name>Jinky the Fruit Bat</name>
	</owner>
    <size>
        <width>704</width>
        <height>576</height>
        <depth>3</depth>
    </size>
    <segmented>0</segmented>
    <object>
        <name>smog</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>176</xmin>
            <ymin>260</ymin>
            <xmax>209</xmax>
            <ymax>293</ymax>
        </bndbox>
    </object>
    <object>
        <name>smog</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>221</xmin>
            <ymin>260</ymin>
            <xmax>250</xmax>
            <ymax>296</ymax>
        </bndbox>
    </object>
</annotation>

mp168 avatar Jul 16 '19 07:07 mp168

The xml file is correct, so it should work

Make sure you placed the files in the right location (see https://github.com/dBeker/Faster-RCNN-TensorFlow-Python3/issues/82)

morpheusthewhite avatar Jul 16 '19 11:07 morpheusthewhite

when i run the train.py,TypeError: argument of type 'NoneType' is not iterable

lw17809213284 avatar Oct 23 '19 08:10 lw17809213284

  File "D:/mp_code/smog_faster_rcnn/train.py", line 154, in train
    blobs = self.data_layer.forward()
  File "D:\mp_code\smog_faster_rcnn\lib\layer_utils\roi_data_layer.py", line 75, in forward
    blobs = self._get_next_minibatch()
  File "D:\mp_code\smog_faster_rcnn\lib\layer_utils\roi_data_layer.py", line 71, in _get_next_minibatch
    return get_minibatch(minibatch_db, self._num_classes)
  File "D:\mp_code\smog_faster_rcnn\lib\utils\minibatch.py", line 36, in get_minibatch
    im_blob, im_scales = _get_image_blob(roidb, random_scale_inds)
  File "D:\mp_code\smog_faster_rcnn\lib\utils\minibatch.py", line 70, in _get_image_blob
    im = cv2.imread(roidb[i]['image'])
KeyError: 'image'
<annotation>
    <folder>VOC2007</folder>
    <filename>000007.jpg</filename>
    <source>
        <database>The VOC2007 Database</database>
		<annotation>PASCAL VOC2007</annotation>
		<image>flickr</image>
    </source>
	<owner>
		<flickrid>Fried Camels</flickrid>
		<name>Jinky the Fruit Bat</name>
	</owner>
    <size>
        <width>704</width>
        <height>576</height>
        <depth>3</depth>
    </size>
    <segmented>0</segmented>
    <object>
        <name>smog</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>176</xmin>
            <ymin>260</ymin>
            <xmax>209</xmax>
            <ymax>293</ymax>
        </bndbox>
    </object>
    <object>
        <name>smog</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>221</xmin>
            <ymin>260</ymin>
            <xmax>250</xmax>
            <ymax>296</ymax>
        </bndbox>
    </object>
</annotation>
  File "D:/mp_code/smog_faster_rcnn/train.py", line 154, in train
    blobs = self.data_layer.forward()
  File "D:\mp_code\smog_faster_rcnn\lib\layer_utils\roi_data_layer.py", line 75, in forward
    blobs = self._get_next_minibatch()
  File "D:\mp_code\smog_faster_rcnn\lib\layer_utils\roi_data_layer.py", line 71, in _get_next_minibatch
    return get_minibatch(minibatch_db, self._num_classes)
  File "D:\mp_code\smog_faster_rcnn\lib\utils\minibatch.py", line 36, in get_minibatch
    im_blob, im_scales = _get_image_blob(roidb, random_scale_inds)
  File "D:\mp_code\smog_faster_rcnn\lib\utils\minibatch.py", line 70, in _get_image_blob
    im = cv2.imread(roidb[i]['image'])
KeyError: 'image'

I had seen the same questions, but i still can't solve it, I try to my data as yours, can you help me?

Has your problem been solved? I encountered this problem too.

BIG-DD avatar Dec 18 '19 02:12 BIG-DD