dBeker / Faster-RCNN-TensorFlow-Python3

Tensorflow Faster R-CNN for Windows/Linux and Python 3 (3.5/3.6/3.7)
MIT License
611 stars 329 forks source link

can't train my datasets #83

Open mp168 opened 5 years ago

mp168 commented 5 years ago
  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?

morpheusthewhite commented 5 years ago

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

mp168 commented 5 years ago

<?xml version="1.0"?>

-

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??!!

morpheusthewhite commented 5 years ago

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

mp168 commented 5 years ago
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
morpheusthewhite commented 5 years ago

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


<key1>
    <key2>value</key2>
etc.
</key1>
mp168 commented 5 years ago
<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>
morpheusthewhite commented 5 years ago

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)

lw17809213284 commented 5 years ago

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

BIG-DD commented 4 years ago
  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.