pervin0527 / pervinco

Vision Deep-Learning using Tensorflow, Keras.
5 stars 2 forks source link

detection_data_augmentation——bbox_original__IndexError: list index out of range #2

Open monkeycc opened 2 years ago

monkeycc commented 2 years ago

A.Rotate(limit=(-90,90), border_mode=4, p=1.0),

Traceback (most recent call last):
  File "f:/hello/a6.py", line 252, in <module>
    augmentation(image_list, xml_list, output_shape, visual)
  File "f:/hello/a6.py", line 200, in augmentation
    modify_coordinate(output_path, transformed, xml, x, output_shape)
  File "f:/hello/a6.py", line 122, in modify_coordinate
    bbox_original.find('xmin').text = str(int(bbox_mod[x][0]))
IndexError: list index out of range

Image Size

2048*1500

XML

<annotation>
    <folder>20481500NG</folder>
    <filename>NG_16.JPG</filename>
    <path>D:\hello\NG_16.JPG</path>
    <source>
        <database>Unknown</database>
    </source>
    <size>
        <width>2048</width>
        <height>1500</height>
        <depth>3</depth>
    </size>
    <segmented>0</segmented>
    <object>
        <name>Hei</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>581</xmin>
            <ymin>467</ymin>
            <xmax>606</xmax>
            <ymax>494</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hei</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>574</xmin>
            <ymin>490</ymin>
            <xmax>580</xmax>
            <ymax>499</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1734</xmin>
            <ymin>397</ymin>
            <xmax>1743</xmax>
            <ymax>405</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hei</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1707</xmin>
            <ymin>380</ymin>
            <xmax>1717</xmax>
            <ymax>393</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hei</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1882</xmin>
            <ymin>450</ymin>
            <xmax>1893</xmax>
            <ymax>462</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1805</xmin>
            <ymin>512</ymin>
            <xmax>1814</xmax>
            <ymax>523</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1735</xmin>
            <ymin>489</ymin>
            <xmax>1745</xmax>
            <ymax>504</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1594</xmin>
            <ymin>473</ymin>
            <xmax>1605</xmax>
            <ymax>484</ymax>
        </bndbox>
    </object>
    <object>
        <name>TuCeng</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1520</xmin>
            <ymin>464</ymin>
            <xmax>1534</xmax>
            <ymax>480</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1473</xmin>
            <ymin>441</ymin>
            <xmax>1483</xmax>
            <ymax>454</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1338</xmin>
            <ymin>426</ymin>
            <xmax>1350</xmax>
            <ymax>444</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1298</xmin>
            <ymin>530</ymin>
            <xmax>1309</xmax>
            <ymax>542</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1296</xmin>
            <ymin>428</ymin>
            <xmax>1308</xmax>
            <ymax>444</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1236</xmin>
            <ymin>445</ymin>
            <xmax>1249</xmax>
            <ymax>465</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1185</xmin>
            <ymin>444</ymin>
            <xmax>1197</xmax>
            <ymax>462</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1176</xmin>
            <ymin>499</ymin>
            <xmax>1189</xmax>
            <ymax>517</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1093</xmin>
            <ymin>497</ymin>
            <xmax>1104</xmax>
            <ymax>513</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hei</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1135</xmin>
            <ymin>529</ymin>
            <xmax>1144</xmax>
            <ymax>542</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1017</xmin>
            <ymin>409</ymin>
            <xmax>1027</xmax>
            <ymax>421</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1092</xmin>
            <ymin>524</ymin>
            <xmax>1100</xmax>
            <ymax>535</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1080</xmin>
            <ymin>508</ymin>
            <xmax>1089</xmax>
            <ymax>518</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1100</xmin>
            <ymin>436</ymin>
            <xmax>1108</xmax>
            <ymax>448</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>1169</xmin>
            <ymin>409</ymin>
            <xmax>1177</xmax>
            <ymax>420</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>969</xmin>
            <ymin>519</ymin>
            <xmax>979</xmax>
            <ymax>535</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>946</xmin>
            <ymin>408</ymin>
            <xmax>956</xmax>
            <ymax>418</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>957</xmin>
            <ymin>436</ymin>
            <xmax>970</xmax>
            <ymax>448</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>894</xmin>
            <ymin>402</ymin>
            <xmax>904</xmax>
            <ymax>415</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>887</xmin>
            <ymin>468</ymin>
            <xmax>897</xmax>
            <ymax>481</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>904</xmin>
            <ymin>510</ymin>
            <xmax>920</xmax>
            <ymax>521</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>784</xmin>
            <ymin>502</ymin>
            <xmax>795</xmax>
            <ymax>518</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>803</xmin>
            <ymin>449</ymin>
            <xmax>818</xmax>
            <ymax>463</ymax>
        </bndbox>
    </object>
    <object>
        <name>TuCeng</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>744</xmin>
            <ymin>415</ymin>
            <xmax>801</xmax>
            <ymax>456</ymax>
        </bndbox>
    </object>
    <object>
        <name>TuCeng</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>738</xmin>
            <ymin>482</ymin>
            <xmax>752</xmax>
            <ymax>507</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>692</xmin>
            <ymin>474</ymin>
            <xmax>705</xmax>
            <ymax>486</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>704</xmin>
            <ymin>512</ymin>
            <xmax>716</xmax>
            <ymax>525</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>687</xmin>
            <ymin>521</ymin>
            <xmax>695</xmax>
            <ymax>532</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>694</xmin>
            <ymin>537</ymin>
            <xmax>702</xmax>
            <ymax>546</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>620</xmin>
            <ymin>424</ymin>
            <xmax>632</xmax>
            <ymax>437</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>615</xmin>
            <ymin>459</ymin>
            <xmax>623</xmax>
            <ymax>472</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>509</xmin>
            <ymin>438</ymin>
            <xmax>521</xmax>
            <ymax>455</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>427</xmin>
            <ymin>497</ymin>
            <xmax>440</xmax>
            <ymax>508</ymax>
        </bndbox>
    </object>
    <object>
        <name>Dian</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>466</xmin>
            <ymin>496</ymin>
            <xmax>475</xmax>
            <ymax>506</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>381</xmin>
            <ymin>414</ymin>
            <xmax>401</xmax>
            <ymax>439</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>238</xmin>
            <ymin>426</ymin>
            <xmax>253</xmax>
            <ymax>442</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>225</xmin>
            <ymin>486</ymin>
            <xmax>234</xmax>
            <ymax>497</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>247</xmin>
            <ymin>488</ymin>
            <xmax>253</xmax>
            <ymax>498</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>204</xmin>
            <ymin>521</ymin>
            <xmax>215</xmax>
            <ymax>532</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>221</xmin>
            <ymin>524</ymin>
            <xmax>236</xmax>
            <ymax>541</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>246</xmin>
            <ymin>508</ymin>
            <xmax>257</xmax>
            <ymax>520</ymax>
        </bndbox>
    </object>
    <object>
        <name>TuCeng</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>318</xmin>
            <ymin>463</ymin>
            <xmax>335</xmax>
            <ymax>485</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>327</xmin>
            <ymin>526</ymin>
            <xmax>340</xmax>
            <ymax>540</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>293</xmin>
            <ymin>528</ymin>
            <xmax>309</xmax>
            <ymax>544</ymax>
        </bndbox>
    </object>
    <object>
        <name>Hui</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>489</xmin>
            <ymin>554</ymin>
            <xmax>498</xmax>
            <ymax>567</ymax>
        </bndbox>
    </object>
</annotation>
pervin0527 commented 2 years ago

@monkeycc I'm using it well without any problems right now... i think your dataset has "not include object" image & annotation files. please check first dataset first.

also, if you remove this part of code??(check the link) https://github.com/pervin0527/pervinco/blob/eb014aa1dab894c714479ab47979eb1e8bd84eda/source/1.augmentation/detection_data_augmentation.py#L201

I don't know how you change my code and use it.