ZZR8066 / AerialDetection

none
Apache License 2.0
5 stars 3 forks source link

prepare dota1 failed #1

Closed likunyao closed 3 years ago

likunyao commented 4 years ago

hello, when I run python DOTA_devkit/prepare_dota1.py --srcpath path_to_dota --dstpath path_to_split_1024, I got

error

root@e46fb4f77845:/workspace# python DOTA_devkit/prepare_dota1.py --srcpath /dota/ --dstpath dota1_1024
padding: True
img name: P1085
img name: P1643
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 538.79126291293699 226.70634226824433 at 538.79126291293699 226.70634226824433
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 542.70049813200501 226.00373599003737 at 542.70049813200501 226.00373599003737
img name: P1281
img name: P1621
img name: P0989
img name: P1134
img name: P1424
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 135.3673307696767 438.21333745579625 at 135.3673307696767 438.21333745579625
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 394.54336081887971 242.53483082172306 at 394.54336081887971 242.53483082172306
img name: P1148
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 277.41103597204068 226.17457521168382 at 277.41103597204068 226.17457521168382
img name: P1559
img name: P1196
img name: P1465
img name: P1386
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 525.7348425024129 475.98438185487407 at 525.7348425024129 475.98438185487407
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 412.52406115996013 668.69385368389135 at 412.52406115996013 668.69385368389135
img name: P1283
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 308.22823823406912 604.17242815493546 at 308.22823823406912 604.17242815493546
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 442.93615436629653 443.19487862959733 at 442.93615436629653 443.19487862959733
img name: P0826
img name: P0983
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 276.19671490027378 163.06335549472038 at 276.19671490027378 163.06335549472038
img name: P0845
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 667.0167762412151 441.06801178871007 at 667.0167762412151 441.06801178871007
img name: P1574
img name: P1418
img name: P1077
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 448.76866059204002 256.88286672017375 at 448.76866059204002 256.88286672017375
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 600.09563713356988 214.2929054960785 at 600.09563713356988 214.2929054960785
img name: P0782
img name: P0876
img name: P1387
img name: P0010
img name: P1618
img name: P1477
img name: P1510
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 149.30035372451104 421.06346233874325 at 149.30035372451104 421.06346233874325
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 552.58680757171055 546.98269655092327 at 552.58680757171055 546.98269655092327
img name: P1065
img name: P0769
img name: P1006
img name: P0966
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 436.80082073105859 396.08344099095677 at 436.80082073105859 396.08344099095677
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 564.0035961338574 407.66453208444341 at 564.0035961338574 407.66453208444341
img name: P0971
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 790.89536138079825 409.19669183746856 at 790.89536138079825 409.19669183746856
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 591.53678546897652 334.04323437380754 at 591.53678546897652 334.04323437380754
img name: P1623
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 612.47315650350924 504.0154953969556 at 612.47315650350924 504.0154953969556
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 312.52403893746907 467.412539184953 at 312.52403893746907 467.412539184953
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 451.2775294411291 341.54235211363482 at 451.2775294411291 341.54235211363482
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 694.67871011836337 157.69284538196277 at 694.67871011836337 157.69284538196277
img name: P0716
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 560.50823978982567 511.98065440649628 at 560.50823978982567 511.98065440649628
img name: P1413
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 591.25373836851441 428.31387812737609 at 591.25373836851441 428.31387812737609
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 670.4226864627949 374.64194648052643 at 670.4226864627949 374.64194648052643
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 363.64354485776806 220.0082056892779 at 363.64354485776806 220.0082056892779
img name: P0661
img name: P0709
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 537.58506740407881 126.76176978914621 at 537.58506740407881 126.76176978914621
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 990.6235807860262 691.80960698689955 at 990.6235807860262 691.80960698689955
img name: P1456
img name: P1322
img name: P0710
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 859.90922453198948 340.01581302191858 at 859.90922453198948 340.01581302191858
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 467.62954297301513 323.24192793635939 at 467.62954297301513 323.24192793635939
img name: P1076
img name: P1337
img name: P1153
img name: P0707
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 262.5143683047101 156.93572521679985 at 262.5143683047101 156.93572521679985
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 582.11855750690495 361.26271996108881 at 582.11855750690495 361.26271996108881
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 518.2847896440129 303.60517799352749 at 518.2847896440129 303.60517799352749
img name: P1217
img name: P1645
img name: P0862
img name: P1442
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 408.67608849696876 369.26934887016768 at 408.67608849696876 369.26934887016768
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 346.95751711982962 329.94844774091683 at 346.95751711982962 329.94844774091683
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 334.76631982968007 325.83045968394856 at 334.76631982968007 325.83045968394856
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 224.43717001055967 175.24533614924323 at 224.43717001055967 175.24533614924323
img name: P0772
img name: P1603
img name: P1285
img name: P0640
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 1009.5182467657849 744.51766750337902 at 1009.5182467657849 744.51766750337902
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 104.96969696969697 175.83449883449885 at 104.96969696969697 175.83449883449885
img name: P1606
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 778.04406866512943 316.63092492954138 at 778.04406866512943 316.63092492954138
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 285.79868978914681 290.44749939735971 at 285.79868978914681 290.44749939735971
img name: P0949
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 753.80707043025484 364.08577692518497 at 753.80707043025484 364.08577692518497
img name: P1042
img name: P0790
img name: P1110
img name: P1023
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 573.80335033266908 472.23265223411801 at 573.80335033266908 472.23265223411801
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 431.31402932378757 553.80159858775073 at 431.31402932378757 553.80159858775073
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 499.90955574674433 413.02069727425601 at 499.90955574674433 413.02069727425601
img name: P1086
img name: P1244
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 762.46922300706353 233.11806256306761 at 762.46922300706353 233.11806256306761
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 522.53413289072125 171.81769020720674 at 522.53413289072125 171.81769020720674
img name: P1289
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 785.99152031879896 559.02432695426535 at 785.99152031879896 559.02432695426535
img name: P0813
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 168.85678587294535 321.48456241670368 at 168.85678587294535 321.48456241670368
img name: P1523
img name: P1054
img name: P1195
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 505.5576681928203 380.02939546819863 at 505.5576681928203 380.02939546819863
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 623.47603577107873 299.06270198177248 at 623.47603577107873 299.06270198177248
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 262.70538382403373 472.38632244158134 at 262.70538382403373 472.38632244158134
img name: P0841
img name: P1458
img name: P1628
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 643.34113239935266 280.04745599055889 at 643.34113239935266 280.04745599055889
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 488.08374182124425 536.95085188624239 at 488.08374182124425 536.95085188624239
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 145.70298313878081 416.28404669260698 at 145.70298313878081 416.28404669260698
img name: P0756
img name: P0832
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 576.46835443037969 625.68354430379748 at 576.46835443037969 625.68354430379748
img name: P1404
img name: P1094
img name: P0959
img name: P0738
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 209.95506993006993 440.70734265734268 at 209.95506993006993 440.70734265734268
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 798.17494963062461 594.41521155137673 at 798.17494963062461 594.41521155137673
img name: P1471
img name: P0847
img name: P0856
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 646.00785650756006 532.84968870441742 at 646.00785650756006 532.84968870441742
img name: P1295
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 370.02264787939885 342.19761798701148 at 370.02264787939885 342.19761798701148
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 295.28129884894133 395.26076453033966 at 295.28129884894133 395.26076453033966
img name: P1573
img name: P0973
img name: P0749
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 801.42539320348794 367.75715100643794 at 801.42539320348794 367.75715100643794
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 531.36516127630455 407.59673862266015 at 531.36516127630455 407.59673862266015
img name: P1224
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 201.22581538035706 624.29063062231853 at 201.22581538035706 624.29063062231853
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 274.48502619180971 645.90778506243203 at 274.48502619180971 645.90778506243203
img name: P1096
img name: P0754
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 369.96337443535589 221.84031253815164 at 369.96337443535589 221.84031253815164
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 593.04087656632248 464.12867102346468 at 593.04087656632248 464.12867102346468
img name: P1050
img name: P0668
img name: P1052
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 594.49340389245583 325.51176264044943 at 594.49340389245583 325.51176264044943
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 337.96829656965531 405.66937851211941 at 337.96829656965531 405.66937851211941
img name: P1144
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 451.02465895803562 377.95845134467976 at 451.02465895803562 377.95845134467976
img name: P0846
img name: P0733
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 117.56192080876158 283.4945240101095 at 117.56192080876158 283.4945240101095
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 809.4714361047636 313.9590877131306 at 809.4714361047636 313.9590877131306
img name: P1420
img name: P0950
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 358.89816124469587 313.68599717114569 at 358.89816124469587 313.68599717114569
img name: P1526
img name: P1595
img name: P1325
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 727.12420046390662 311.73998734800028 at 727.12420046390662 311.73998734800028
img name: P1548
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 544.60418904403866 475.54350161117077 at 544.60418904403866 475.54350161117077
img name: P1299
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 422.52753787342488 515.13790174146959 at 422.52753787342488 515.13790174146959
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 546.64398152512013 139.45923272692997 at 546.64398152512013 139.45923272692997
img name: P0742
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 660.12654071289205 561.32946271355831 at 660.12654071289205 561.32946271355831
img name: P0897
img name: P1564
img name: P0951
img name: P1252
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 352.00077662622851 610.80603090436784 at 352.00077662622851 610.80603090436784
img name: P1578
img name: P1378
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 889.90766976062525 357.84171958964339 at 889.90766976062525 357.84171958964339
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 580.21564023839619 121.07964601769912 at 580.21564023839619 121.07964601769912
img name: P1141
img name: P1587
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 473.69416810959109 340.74975280731968 at 473.69416810959109 340.74975280731968
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 239.32710280373831 136.53457943925233 at 239.32710280373831 136.53457943925233
img name: P0678
img name: P1205
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 951.61522104085054 641.76799104644658 at 951.61522104085054 641.76799104644658
img name: P1008
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 622.44199622000531 644.51850522739778 at 622.44199622000531 644.51850522739778
img name: P1478
img name: P1040
img name: P0946
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 625.9118692253021 441.20469083155649 at 625.9118692253021 441.20469083155649
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 332.31730124284871 303.23756164924049 at 332.31730124284871 303.23756164924049
img name: P0644
img name: P0656
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 482 565 at 482 565
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 494.18421669793622 150.49003283302065 at 494.18421669793622 150.49003283302065
img name: P1570
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 736.06083976006857 452.09968580405598 at 736.06083976006857 452.09968580405598
img name: P0745
img name: P1646
img name: P1257
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 681.37346846165485 536.71171784399735 at 681.37346846165485 536.71171784399735
img name: P0988
img name: P0874
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 704.43026248069998 381.00442614513639 at 704.43026248069998 381.00442614513639
img name: P0929
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 232.07656645125036 310.18839561674628 at 232.07656645125036 310.18839561674628
img name: P1314
img name: P1613
img name: P0743
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 356.55893403571292 164.09590579850487 at 356.55893403571292 164.09590579850487
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 462.37558278860644 303.1685430581424 at 462.37558278860644 303.1685430581424
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 948.05594945594942 637.58560898560904 at 948.05594945594942 637.58560898560904
img name: P0815
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 233.97859158046137 490.61232505393593 at 233.97859158046137 490.61232505393593
img name: P1035
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 426.38133651740151 259.5930746517725 at 426.38133651740151 259.5930746517725
img name: P1271
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 616.61873388713832 176.16356344886853 at 616.61873388713832 176.16356344886853
img name: P1118
img name: P1204
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 481.32756479258092 383.81584830669868 at 481.32756479258092 383.81584830669868
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 512.9033225348719 442.44057722684801 at 512.9033225348719 442.44057722684801
img name: P1316
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 336.30482991918814 569.2157489193761 at 336.30482991918814 569.2157489193761
img name: P0702
img name: P0998
img name: P0976
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 519.32743982494526 293.56323851203501 at 519.32743982494526 293.56323851203501
img name: P0948
img name: P1533
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 528.34869814963042 507.6127877960356 at 528.34869814963042 507.6127877960356
img name: P0683
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 303.80932265112892 586.92818645302259 at 303.80932265112892 586.92818645302259
img name: P1457
img name: P0722
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 384.91215226939971 276.61493411420207 at 384.91215226939971 276.61493411420207
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 549.14195139133494 724.74122343548197 at 549.14195139133494 724.74122343548197
img name: P0760
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 265.89926569448755 453.90940117902574 at 265.89926569448755 453.90940117902574
img name: P1678
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 250.96558720249706 277.89395239953183 at 250.96558720249706 277.89395239953183
img name: P1673
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 184.19291725871679 331.3728120169261 at 184.19291725871679 331.3728120169261
img name: P0961
img name: P1294
img name: P1178
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 257.56974921630092 360.70188087774295 at 257.56974921630092 360.70188087774295
img name: P1332
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 278.75076923076921 405.748499369483 at 278.75076923076921 405.748499369483
img name: P1088
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 586.87710575962717 343.4975918322051 at 586.87710575962717 343.4975918322051
img name: P1262
img name: P0777
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 249.38112403735869 299.65803703096839 at 249.38112403735869 299.65803703096839
img name: P1044
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 581.95185509393309 291.81657800821495 at 581.95185509393309 291.81657800821495
img name: P1610
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 329.83214135464874 257.5877156079091 at 329.83214135464874 257.5877156079091
img name: P1594
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 427.24358974358972 397.35819735819734 at 427.24358974358972 397.35819735819734
img name: P1307
img name: P1191
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 424.97914318873734 400.542453702925 at 424.97914318873734 400.542453702925
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 439.66345226615238 200.66418042626887 at 439.66345226615238 200.66418042626887
img name: P1103
img name: P0761
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 480.54216273914113 317.89892437802774 at 480.54216273914113 317.89892437802774
img name: P1598
img name: P0676
img name: P1393
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 348.11225867959007 555.87081909907045 at 348.11225867959007 555.87081909907045
img name: P1231
img name: P0638
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 406.45086483778766 202.11023366826768 at 406.45086483778766 202.11023366826768
img name: P0783
img name: P1375
TopologyException: Input geom 0 is invalid: Self-intersection at or near point 333.00607335236174 309.87434813400006 at 333.00607335236174 309.87434813400006
img name: P0630
img name: P1243
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 121, in worker
    result = (True, func(*args, **kwds))
  File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 44, in mapstar
    return list(map(*args))
  File "/workspace/DOTA_devkit/ImgSplit_multi_process.py", line 254, in SplitSingle
    self.savepatches(resizeimg, objects, subimgname, left, up, right, down)
  File "/workspace/DOTA_devkit/ImgSplit_multi_process.py", line 160, in savepatches
    inter_poly, half_iou = self.calchalf_iou(gtpoly, imgpoly)
  File "/workspace/DOTA_devkit/ImgSplit_multi_process.py", line 108, in calchalf_iou
    inter_poly = poly1.intersection(poly2)
  File "/opt/conda/lib/python3.7/site-packages/shapely/geometry/base.py", line 649, in intersection
    return geom_factory(self.impl['intersection'](self, other))
  File "/opt/conda/lib/python3.7/site-packages/shapely/topology.py", line 70, in __call__
    self._check_topology(err, this, other)
  File "/opt/conda/lib/python3.7/site-packages/shapely/topology.py", line 38, in _check_topology
    self.fn.__name__, repr(geom)))
shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry 
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "DOTA_devkit/prepare_dota1.py", line 104, in 
    prepare(srcpath, dstpath)
  File "DOTA_devkit/prepare_dota1.py", line 79, in prepare
    split_train.splitdata(1)
  File "/workspace/DOTA_devkit/ImgSplit_multi_process.py", line 276, in splitdata
    self.pool.map(worker, imagenames)
  File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 268, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/opt/conda/lib/python3.7/multiprocessing/pool.py", line 657, in get
    raise self._value
shapely.errors.TopologicalError: The operation 'GEOSIntersection_r' could not be performed. Likely cause is invalidity of the geometry 

The dataset is transformed from HRSC2016

dota/
├── test
│   ├── images
│   └── labelTxt
├── train
│   ├── images
│   └── labelTxt
└── val
    ├── images
    └── labelTxt

Do you know how to solve this problem or what might go wrong?

Amberrferr commented 2 years ago

have you solve this problem? I met a same error