Repository: hukaixuan19970627/DOTA_devkit_YOLO
Branch: master
Commit: 07d6987da819
Files: 63
Total size: 11.5 MB
Directory structure:
gitextract_2jlkibz9/
├── .idea/
│ ├── .gitignore
│ ├── DOTA_devkit-master.iml
│ ├── encodings.xml
│ ├── inspectionProfiles/
│ │ ├── Project_Default.xml
│ │ └── profiles_settings.xml
│ ├── misc.xml
│ └── modules.xml
├── .polyiou.cpp.swp
├── DOTA.py
├── DOTA2COCO.py
├── DOTA_demo/
│ └── labelTxt/
│ ├── P0003.txt
│ ├── P0004.txt
│ ├── P0005.txt
│ └── P1478__1__853___962.txt
├── Draw_DOTA_YOLO.py
├── ImgSplit.py
├── ImgSplit_multi_process.py
├── README.md
├── ResultMerge.py
├── ResultMerge_example/
│ └── 1.txt
├── ResultMerge_multi_process.py
├── SplitOnlyImage.py
├── SplitOnlyImage_multi_process.py
├── YOLO_Transform.py
├── build/
│ ├── temp.linux-x86_64-3.8/
│ │ ├── polyiou.o
│ │ └── polyiou_wrap.o
│ └── temp.win-amd64-3.8/
│ └── Release/
│ └── polyiou_wrap.obj
├── demo.ipynb
├── dota-v1.5_evaluation_task1.py
├── dota-v1.5_evaluation_task2.py
├── dota_evaluation_task1.py
├── dota_evaluation_task2.py
├── dota_utils.py
├── evaluation_example/
│ ├── imgnamefile.txt
│ ├── result_classname/
│ │ ├── Task1_harbor.txt
│ │ ├── Task1_large-vehicle.txt
│ │ ├── Task1_ship.txt
│ │ └── Task1_small-vehicle.txt
│ └── row_DOTA_labels/
│ ├── P0003.txt
│ ├── P0004.txt
│ ├── P0007.txt
│ └── P0019.txt
├── example/
│ └── labelTxt/
│ ├── P0706.txt
│ ├── P0770.txt
│ └── P1088.txt
├── poly_nms_gpu/
│ ├── Makefile
│ ├── __init__.py
│ ├── nms_wrapper.py
│ ├── poly_nms.hpp
│ ├── poly_nms.pyx
│ ├── poly_nms_kernel.cu
│ ├── poly_nms_test.py
│ ├── poly_overlaps.hpp
│ ├── poly_overlaps.pyx
│ ├── poly_overlaps_kernel.cu
│ └── setup.py
├── polyiou.cpp
├── polyiou.h
├── polyiou.i
├── polyiou.py
├── polyiou_wrap.cxx
├── requirements.txt
└── setup.py
================================================
FILE CONTENTS
================================================
================================================
FILE: .idea/.gitignore
================================================
# Default ignored files
/shelf/
/workspace.xml
================================================
FILE: .idea/DOTA_devkit-master.iml
================================================
================================================
FILE: .idea/encodings.xml
================================================
================================================
FILE: .idea/inspectionProfiles/Project_Default.xml
================================================
================================================
FILE: .idea/inspectionProfiles/profiles_settings.xml
================================================
================================================
FILE: .idea/misc.xml
================================================
================================================
FILE: .idea/modules.xml
================================================
================================================
FILE: DOTA.py
================================================
# coding=gbk
#The code is used for visulization, inspired from cocoapi
# Licensed under the Simplified BSD License [see bsd.txt]
import os
import matplotlib.pyplot as plt
from matplotlib.collections import PatchCollection
from matplotlib.patches import Polygon, Circle
import numpy as np
import dota_utils as util
from collections import defaultdict
import cv2
def _isArrayLike(obj):
if type(obj) == str:
return False
return hasattr(obj, '__iter__') and hasattr(obj, '__len__')
class DOTA:
def __init__(self, basepath):
self.basepath = basepath
self.labelpath = os.path.join(basepath, 'labelTxt')
self.imagepath = os.path.join(basepath, 'images')
self.imgpaths = util.GetFileFromThisRootDir(self.labelpath)
self.imglist = [util.custombasename(x) for x in self.imgpaths]
self.catToImgs = defaultdict(list)
self.ImgToAnns = defaultdict(list)
self.createIndex()
def createIndex(self):
for filename in self.imgpaths:
objects = util.parse_dota_poly(filename)
imgid = util.custombasename(filename)
self.ImgToAnns[imgid] = objects
for obj in objects:
cat = obj['name']
self.catToImgs[cat].append(imgid)
def getImgIds(self, catNms=[]):
"""
:param catNms: category names eg:catNms=['ships']
:return: all the image ids contain the categories аͼƬid eg:['P0706', 'P
1234', 'P2709']
"""
catNms = catNms if _isArrayLike(catNms) else [catNms]
if len(catNms) == 0:
return self.imglist
else:
imgids = []
for i, cat in enumerate(catNms):
if i == 0:
imgids = set(self.catToImgs[cat])
else:
imgids &= set(self.catToImgs[cat])
return list(imgids)
def loadAnns(self, catNms=[], imgId = None, difficult=None):
"""
:param catNms: category names
:param imgId: the img to load anns
:return: objects
"""
catNms = catNms if _isArrayLike(catNms) else [catNms]
objects = self.ImgToAnns[imgId]
if len(catNms) == 0:
return objects
outobjects = [obj for obj in objects if (obj['name'] in catNms)]
return outobjects
def showAnns(self, objects, imgId, range):
"""
:param catNms: category names
:param objects: objects to show labelsϢ
:param imgId: img to show ʾͼƬid
:param range: display range in the img ͼƬʾΧ
:return:
"""
img = self.loadImgs(imgId)[0]
plt.imshow(img)
plt.axis('off')
ax = plt.gca()
ax.set_autoscale_on(False)
polygons = []
color = []
circles = []
r = 5
for obj in objects:
c = (np.random.random((1, 3)) * 0.6 + 0.4).tolist()[0]
poly = obj['poly']
polygons.append(Polygon(poly))
color.append(c)
point = poly[0]
circle = Circle((point[0], point[1]), r)
circles.append(circle)
p = PatchCollection(polygons, facecolors=color, linewidths=0, alpha=0.4)
ax.add_collection(p)
p = PatchCollection(polygons, facecolors='none', edgecolors=color, linewidths=2)
ax.add_collection(p)
p = PatchCollection(circles, facecolors='red')
ax.add_collection(p)
def loadImgs(self, imgids=[]):
"""
:param imgids: integer ids specifying img صͼƬ eg:imgids=['P0706','P0770']
:return: loaded img objects صͼƬ imgs=[...,...]
"""
print('isarralike:', _isArrayLike(imgids))
imgids = imgids if _isArrayLike(imgids) else [imgids]
print('imgids:', imgids)
imgs = []
for imgid in imgids:
filename = os.path.join(self.imagepath, imgid + '.png')
print('filename:', filename)
img = cv2.imread(filename)
imgs.append(img)
return imgs
if __name__ == '__main__':
examplesplit = DOTA(r'./DOTA_demo') # (r'./example')
imgids = examplesplit.getImgIds(catNms=['small-vehicle']) # ȡͼƬid eg:['P1088']
img = examplesplit.loadImgs(imgids) # ȡӦidͼƬӦsmall-vehicle
for imgid in imgids:
imgid = 'P0003' #ͼƬ
anns = examplesplit.loadAnns(imgId=imgid) # ضӦidͼƬlabelsϢ
'''
anns =
[{'name': 'ship',
'difficult': '1',
'poly': [(1054.0, 1028.0), (1063.0, 1011.0), (1111.0, 1040.0), (1112.0, 1062.0)],
'area': 1159.5
},
...
]
'''
examplesplit.showAnns(anns, imgid, 2) # labelsϢʾڶӦidͼƬ
plt.show()
================================================
FILE: DOTA2COCO.py
================================================
import dota_utils as util
import os
import cv2
import json
wordname_15 = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter']
def DOTA2COCO(srcpath, destfile):
imageparent = os.path.join(srcpath, 'images')
labelparent = os.path.join(srcpath, 'labelTxt')
data_dict = {}
info = {'contributor': 'captain group',
'data_created': '2018',
'description': 'This is 1.0 version of DOTA dataset.',
'url': 'http://captain.whu.edu.cn/DOTAweb/',
'version': '1.0',
'year': 2018}
data_dict['info'] = info
data_dict['images'] = []
data_dict['categories'] = []
data_dict['annotations'] = []
for idex, name in enumerate(wordname_15):
single_cat = {'id': idex + 1, 'name': name, 'supercategory': name}
data_dict['categories'].append(single_cat)
inst_count = 1
image_id = 1
with open(destfile, 'w') as f_out:
filenames = util.GetFileFromThisRootDir(labelparent)
for file in filenames:
basename = util.custombasename(file)
# image_id = int(basename[1:])
imagepath = os.path.join(imageparent, basename + '.png')
img = cv2.imread(imagepath)
height, width, c = img.shape
single_image = {}
single_image['file_name'] = basename + '.png'
single_image['id'] = image_id
single_image['width'] = width
single_image['height'] = height
data_dict['images'].append(single_image)
# annotations
objects = util.parse_dota_poly2(file)
for obj in objects:
single_obj = {}
single_obj['area'] = obj['area']
single_obj['category_id'] = wordname_15.index(obj['name']) + 1
single_obj['segmentation'] = []
single_obj['segmentation'].append(obj['poly'])
single_obj['iscrowd'] = 0
xmin, ymin, xmax, ymax = min(obj['poly'][0::2]), min(obj['poly'][1::2]), \
max(obj['poly'][0::2]), max(obj['poly'][1::2])
width, height = xmax - xmin, ymax - ymin
single_obj['bbox'] = xmin, ymin, width, height
single_obj['image_id'] = image_id
data_dict['annotations'].append(single_obj)
single_obj['id'] = inst_count
inst_count = inst_count + 1
image_id = image_id + 1
json.dump(data_dict, f_out)
if __name__ == '__main__':
DOTA2COCO(r'/data0/data_dj/1024_new', r'/data0/data_dj/1024_new/DOTA_trainval1024.json')
================================================
FILE: DOTA_demo/labelTxt/P0003.txt
================================================
imagesource:GoogleEarth
gsd:0.115726939386
937.0 913.0 921.0 912.0 923.0 874.0 940.0 875.0 small-vehicle 0
638.0 959.0 638.0 935.0 694.0 939.0 693.0 962.0 large-vehicle 0
545.0 494.0 548.0 518.0 489.0 519.0 488.0 493.0 large-vehicle 0
536.0 468.0 535.0 489.0 477.0 486.0 478.0 464.0 large-vehicle 0
683.0 302.0 659.0 309.0 643.0 213.0 660.0 205.0 large-vehicle 0
627.0 319.0 605.0 326.0 584.0 223.0 608.0 216.0 large-vehicle 0
594.0 323.0 573.0 328.0 556.0 234.0 575.0 229.0 large-vehicle 0
563.0 326.0 540.0 333.0 527.0 238.0 547.0 232.0 large-vehicle 0
521.0 334.0 500.0 341.0 478.0 241.0 500.0 236.0 large-vehicle 0
422.0 349.0 401.0 356.0 382.0 258.0 402.0 253.0 large-vehicle 0
396.0 358.0 375.0 366.0 356.0 269.0 374.0 263.0 large-vehicle 0
360.0 359.0 340.0 363.0 326.0 278.0 347.0 273.0 large-vehicle 0
329.0 352.0 305.0 356.0 292.0 274.0 313.0 272.0 large-vehicle 0
277.0 842.0 278.0 823.0 335.0 827.0 332.0 853.0 large-vehicle 0
573.0 519.0 579.0 494.0 638.0 498.0 637.0 523.0 large-vehicle 0
328.0 803.0 317.0 821.0 265.0 794.0 277.0 772.0 large-vehicle 0
265.0 757.0 280.0 742.0 318.0 764.0 305.0 782.0 large-vehicle 1
258.0 683.0 262.0 669.0 315.0 689.0 305.0 712.0 large-vehicle 1
280.0 638.0 293.0 619.0 338.0 643.0 328.0 663.0 large-vehicle 0
232.0 610.0 243.0 591.0 286.0 616.0 276.0 636.0 large-vehicle 0
278.0 601.0 288.0 582.0 336.0 607.0 323.0 628.0 large-vehicle 0
230.0 577.0 238.0 559.0 284.0 578.0 273.0 598.0 large-vehicle 1
315.0 507.0 303.0 525.0 213.0 475.0 226.0 455.0 large-vehicle 0
204.0 441.0 213.0 419.0 269.0 441.0 257.0 463.0 large-vehicle 0
200.0 401.0 211.0 383.0 258.0 411.0 250.0 428.0 large-vehicle 0
186.0 365.0 198.0 342.0 249.0 368.0 236.0 390.0 large-vehicle 0
558.0 523.0 563.0 546.0 501.0 554.0 501.0 529.0 large-vehicle 0
627.0 529.0 628.0 547.0 569.0 549.0 568.0 530.0 large-vehicle 0
958.0 158.0 972.0 152.0 984.0 182.0 967.0 187.0 small-vehicle 1
45.0 864.0 47.0 882.0 5.0 882.0 4.0 867.0 large-vehicle 1
1093.0 949.0 1107.0 957.0 1091.0 987.0 1077.0 981.0 small-vehicle 1
1106.0 969.0 1119.0 974.0 1102.0 1012.0 1085.0 1005.0 small-vehicle 0
1126.0 747.0 1110.0 757.0 1088.0 714.0 1105.0 706.0 large-vehicle 0
1089.0 632.0 1105.0 621.0 1126.0 656.0 1107.0 667.0 small-vehicle 1
1071.0 656.0 1058.0 664.0 1038.0 627.0 1055.0 620.0 small-vehicle 0
990.0 513.0 1004.0 504.0 1022.0 539.0 1003.0 548.0 small-vehicle 1
978.0 458.0 964.0 463.0 953.0 428.0 967.0 421.0 small-vehicle 1
4.0 979.0 3.0 964.0 43.0 961.0 44.0 979.0 small-vehicle 0
2.0 956.0 4.0 939.0 42.0 936.0 42.0 954.0 small-vehicle 0
3.0 931.0 4.0 916.0 39.0 916.0 42.0 929.0 small-vehicle 0
5.0 908.0 5.0 892.0 40.0 889.0 41.0 907.0 small-vehicle 0
6.0 842.0 38.0 842.0 37.0 857.0 3.0 859.0 large-vehicle 1
660.0 555.0 662.0 576.0 603.0 577.0 602.0 555.0 large-vehicle 0
47.0 787.0 48.0 805.0 15.0 811.0 13.0 793.0 small-vehicle 0
41.0 690.0 41.0 704.0 8.0 706.0 11.0 690.0 small-vehicle 1
41.0 640.0 44.0 656.0 12.0 656.0 11.0 640.0 small-vehicle 1
867.0 904.0 847.0 904.0 849.0 847.0 870.0 849.0 large-vehicle 0
841.0 897.0 821.0 897.0 813.0 802.0 835.0 800.0 large-vehicle 0
813.0 896.0 795.0 897.0 790.0 834.0 809.0 829.0 large-vehicle 0
763.0 817.0 782.0 814.0 781.0 906.0 760.0 904.0 large-vehicle 0
721.0 852.0 742.0 851.0 740.0 906.0 716.0 906.0 large-vehicle 1
883.0 586.0 895.0 603.0 840.0 631.0 827.0 609.0 large-vehicle 0
773.0 574.0 767.0 555.0 856.0 523.0 865.0 544.0 large-vehicle 0
630.0 586.0 629.0 607.0 532.0 604.0 534.0 580.0 large-vehicle 0
191.0 299.0 205.0 276.0 257.0 304.0 238.0 330.0 large-vehicle 0
================================================
FILE: DOTA_demo/labelTxt/P0004.txt
================================================
imagesource:GoogleEarth
gsd:0.132459767176
398.0 716.0 398.0 694.0 464.0 698.0 465.0 718.0 large-vehicle 0
513.0 542.0 514.0 524.0 613.0 529.0 613.0 548.0 large-vehicle 0
526.0 591.0 528.0 571.0 623.0 578.0 621.0 599.0 large-vehicle 1
504.0 614.0 506.0 591.0 632.0 603.0 629.0 622.0 large-vehicle 0
521.0 636.0 521.0 617.0 635.0 627.0 634.0 644.0 large-vehicle 0
518.0 656.0 523.0 639.0 638.0 646.0 635.0 669.0 large-vehicle 0
528.0 681.0 533.0 662.0 611.0 669.0 610.0 690.0 large-vehicle 0
194.0 230.0 197.0 249.0 121.0 259.0 118.0 242.0 large-vehicle 0
217.0 249.0 220.0 271.0 118.0 283.0 117.0 264.0 large-vehicle 0
205.0 272.0 208.0 293.0 118.0 303.0 113.0 284.0 large-vehicle 1
219.0 293.0 226.0 315.0 128.0 329.0 124.0 307.0 large-vehicle 0
229.0 318.0 232.0 336.0 136.0 351.0 133.0 331.0 large-vehicle 0
239.0 336.0 243.0 356.0 146.0 371.0 144.0 351.0 large-vehicle 0
244.0 359.0 247.0 378.0 152.0 393.0 148.0 374.0 large-vehicle 0
235.0 385.0 240.0 402.0 146.0 419.0 144.0 399.0 large-vehicle 1
263.0 407.0 265.0 427.0 166.0 440.0 166.0 418.0 large-vehicle 0
259.0 432.0 260.0 454.0 143.0 472.0 140.0 447.0 large-vehicle 0
371.0 589.0 389.0 591.0 381.0 684.0 360.0 681.0 large-vehicle 1
258.0 459.0 261.0 477.0 136.0 502.0 133.0 480.0 large-vehicle 0
258.0 484.0 263.0 502.0 154.0 524.0 150.0 504.0 large-vehicle 1
258.0 507.0 264.0 527.0 166.0 549.0 161.0 529.0 large-vehicle 0
258.0 534.0 264.0 553.0 151.0 582.0 148.0 561.0 large-vehicle 0
272.0 579.0 274.0 601.0 174.0 605.0 174.0 586.0 large-vehicle 0
271.0 606.0 274.0 626.0 156.0 636.0 156.0 612.0 large-vehicle 0
268.0 632.0 271.0 651.0 171.0 656.0 171.0 636.0 large-vehicle 0
495.0 567.0 498.0 546.0 621.0 553.0 622.0 573.0 large-vehicle 0
509.0 522.0 511.0 503.0 607.0 506.0 606.0 526.0 large-vehicle 0
261.0 694.0 261.0 717.0 150.0 714.0 152.0 692.0 large-vehicle 1
511.0 497.0 513.0 479.0 627.0 480.0 627.0 502.0 large-vehicle 0
273.0 92.0 291.0 88.0 305.0 177.0 286.0 180.0 large-vehicle 1
294.0 88.0 312.0 84.0 326.0 176.0 308.0 178.0 large-vehicle 1
317.0 86.0 334.0 82.0 348.0 175.0 330.0 178.0 large-vehicle 1
339.0 94.0 356.0 89.0 369.0 180.0 350.0 184.0 large-vehicle 1
359.0 87.0 377.0 84.0 389.0 176.0 373.0 180.0 large-vehicle 1
390.0 93.0 408.0 92.0 412.0 185.0 392.0 186.0 large-vehicle 1
417.0 92.0 433.0 90.0 436.0 184.0 418.0 185.0 large-vehicle 1
439.0 98.0 457.0 97.0 458.0 188.0 441.0 189.0 large-vehicle 1
460.0 94.0 477.0 94.0 479.0 186.0 462.0 186.0 large-vehicle 1
481.0 91.0 498.0 91.0 498.0 183.0 481.0 183.0 large-vehicle 1
561.0 111.0 576.0 121.0 516.0 194.0 502.0 184.0 large-vehicle 1
513.0 203.0 621.0 184.0 625.0 204.0 515.0 222.0 large-vehicle 1
508.0 228.0 618.0 211.0 621.0 228.0 511.0 247.0 large-vehicle 1
511.0 249.0 630.0 229.0 633.0 249.0 514.0 267.0 large-vehicle 1
517.0 268.0 638.0 256.0 639.0 276.0 518.0 288.0 large-vehicle 1
526.0 311.0 524.0 292.0 616.0 282.0 619.0 299.0 large-vehicle 1
506.0 336.0 505.0 316.0 618.0 304.0 621.0 324.0 large-vehicle 0
518.0 356.0 518.0 338.0 629.0 329.0 632.0 349.0 large-vehicle 1
511.0 381.0 508.0 363.0 603.0 352.0 606.0 371.0 large-vehicle 1
513.0 403.0 511.0 385.0 633.0 372.0 636.0 392.0 large-vehicle 1
511.0 428.0 511.0 409.0 638.0 402.0 641.0 424.0 large-vehicle 0
518.0 453.0 516.0 435.0 628.0 428.0 628.0 448.0 large-vehicle 1
519.0 473.0 521.0 458.0 603.0 455.0 604.0 474.0 large-vehicle 0
286.0 656.0 287.0 676.0 171.0 677.0 169.0 658.0 large-vehicle 0
274.0 738.0 274.0 760.0 154.0 757.0 157.0 736.0 large-vehicle 0
314.0 727.0 298.0 726.0 299.0 689.0 314.0 688.0 small-vehicle 1
454.0 38.0 453.0 60.0 386.0 57.0 387.0 34.0 large-vehicle 0
788.0 76.0 806.0 76.0 804.0 111.0 786.0 109.0 small-vehicle 0
812.0 159.0 824.0 162.0 822.0 193.0 809.0 196.0 small-vehicle 1
781.0 214.0 797.0 215.0 798.0 246.0 780.0 246.0 small-vehicle 0
751.0 278.0 736.0 276.0 736.0 241.0 754.0 240.0 small-vehicle 0
806.0 250.0 818.0 250.0 818.0 283.0 804.0 284.0 small-vehicle 1
745.0 591.0 726.0 589.0 729.0 550.0 746.0 549.0 small-vehicle 0
725.0 1151.0 707.0 1151.0 709.0 1118.0 726.0 1116.0 small-vehicle 0
231.0 1219.0 229.0 1242.0 178.0 1236.0 176.0 1217.0 large-vehicle 0
288.0 1269.0 288.0 1290.0 236.0 1285.0 237.0 1266.0 large-vehicle 0
218.0 1264.0 216.0 1287.0 159.0 1283.0 160.0 1262.0 large-vehicle 0
719.0 1296.0 704.0 1294.0 705.0 1257.0 721.0 1254.0 small-vehicle 0
693.0 1344.0 679.0 1344.0 681.0 1313.0 695.0 1311.0 small-vehicle 0
720.0 1353.0 706.0 1354.0 706.0 1318.0 721.0 1317.0 small-vehicle 0
741.0 1375.0 726.0 1374.0 728.0 1338.0 743.0 1339.0 small-vehicle 0
83.0 864.0 98.0 861.0 103.0 898.0 87.0 899.0 small-vehicle 0
109.0 859.0 125.0 859.0 126.0 892.0 110.0 893.0 small-vehicle 0
100.0 927.0 119.0 926.0 121.0 979.0 103.0 982.0 large-vehicle 0
56.0 942.0 69.0 939.0 73.0 974.0 58.0 977.0 small-vehicle 1
123.0 982.0 132.0 992.0 109.0 1013.0 99.0 1003.0 small-vehicle 0
45.0 356.0 32.0 356.0 33.0 323.0 46.0 322.0 small-vehicle 1
83.0 235.0 96.0 233.0 98.0 265.0 83.0 267.0 small-vehicle 1
196.0 4.0 197.0 17.0 163.0 14.0 162.0 2.0 small-vehicle 1
324.0 711.0 327.0 690.0 375.0 691.0 374.0 711.0 large-vehicle 0
551.0 25.0 546.0 43.0 508.0 36.0 513.0 17.0 small-vehicle 0
315.0 31.0 313.0 54.0 250.0 51.0 252.0 30.0 large-vehicle 0
273.0 781.0 275.0 803.0 158.0 804.0 157.0 782.0 large-vehicle 0
475.0 1289.0 476.0 1269.0 604.0 1271.0 604.0 1292.0 large-vehicle 0
275.0 806.0 276.0 828.0 157.0 830.0 157.0 809.0 large-vehicle 0
268.0 861.0 269.0 879.0 153.0 878.0 153.0 858.0 large-vehicle 0
275.0 881.0 277.0 901.0 147.0 903.0 147.0 880.0 large-vehicle 0
277.0 904.0 279.0 924.0 149.0 928.0 149.0 908.0 large-vehicle 0
278.0 926.0 280.0 946.0 150.0 951.0 151.0 933.0 large-vehicle 0
285.0 951.0 286.0 975.0 158.0 978.0 158.0 956.0 large-vehicle 0
280.0 978.0 281.0 996.0 151.0 1001.0 152.0 983.0 large-vehicle 0
277.0 1003.0 277.0 1023.0 149.0 1026.0 150.0 1006.0 large-vehicle 0
277.0 1026.0 277.0 1047.0 149.0 1049.0 151.0 1030.0 large-vehicle 0
279.0 1050.0 281.0 1069.0 152.0 1075.0 152.0 1056.0 large-vehicle 0
281.0 1073.0 286.0 1093.0 158.0 1101.0 156.0 1082.0 large-vehicle 0
285.0 1097.0 287.0 1117.0 159.0 1124.0 158.0 1105.0 large-vehicle 0
278.0 1150.0 282.0 1172.0 154.0 1181.0 152.0 1161.0 large-vehicle 0
279.0 1176.0 281.0 1197.0 155.0 1205.0 153.0 1183.0 large-vehicle 0
332.0 1348.0 310.0 1348.0 313.0 1183.0 333.0 1184.0 large-vehicle 0
460.0 954.0 458.0 933.0 624.0 921.0 626.0 942.0 large-vehicle 0
513.0 916.0 513.0 897.0 595.0 891.0 597.0 912.0 large-vehicle 0
484.0 1081.0 484.0 1063.0 613.0 1053.0 613.0 1073.0 large-vehicle 0
482.0 1106.0 482.0 1088.0 596.0 1081.0 598.0 1100.0 large-vehicle 0
434.0 1181.0 435.0 1159.0 560.0 1154.0 563.0 1174.0 large-vehicle 0
496.0 1206.0 493.0 1186.0 619.0 1175.0 623.0 1195.0 large-vehicle 0
498.0 1231.0 498.0 1211.0 625.0 1204.0 626.0 1226.0 large-vehicle 0
485.0 1259.0 484.0 1241.0 583.0 1234.0 583.0 1255.0 large-vehicle 0
233.0 94.0 254.0 89.0 271.0 181.0 248.0 186.0 large-vehicle 1
================================================
FILE: DOTA_demo/labelTxt/P0005.txt
================================================
imagesource:GoogleEarth
gsd:0.120384949364
76.0 847.0 76.0 864.0 34.0 866.0 34.0 847.0 small-vehicle 0
278.0 731.0 279.0 710.0 370.0 711.0 371.0 731.0 large-vehicle 0
278.0 786.0 279.0 766.0 373.0 768.0 372.0 789.0 large-vehicle 0
276.0 815.0 279.0 793.0 372.0 798.0 371.0 818.0 large-vehicle 0
277.0 844.0 276.0 823.0 369.0 826.0 366.0 848.0 large-vehicle 0
275.0 871.0 276.0 853.0 368.0 856.0 368.0 876.0 large-vehicle 0
268.0 901.0 271.0 881.0 353.0 886.0 353.0 907.0 large-vehicle 0
492.0 187.0 491.0 207.0 389.0 204.0 393.0 184.0 large-vehicle 0
491.0 211.0 489.0 232.0 403.0 229.0 404.0 207.0 large-vehicle 0
468.0 265.0 468.0 288.0 398.0 284.0 399.0 263.0 large-vehicle 0
468.0 292.0 469.0 313.0 400.0 314.0 402.0 293.0 large-vehicle 0
490.0 350.0 489.0 371.0 423.0 366.0 424.0 347.0 large-vehicle 0
467.0 378.0 465.0 397.0 394.0 396.0 396.0 374.0 large-vehicle 0
486.0 404.0 486.0 426.0 418.0 424.0 420.0 404.0 large-vehicle 0
488.0 435.0 487.0 456.0 418.0 449.0 421.0 430.0 large-vehicle 0
461.0 460.0 463.0 479.0 394.0 480.0 397.0 456.0 large-vehicle 0
481.0 487.0 479.0 511.0 408.0 508.0 413.0 485.0 large-vehicle 0
473.0 518.0 471.0 541.0 401.0 534.0 404.0 514.0 large-vehicle 0
460.0 546.0 460.0 567.0 400.0 566.0 402.0 544.0 large-vehicle 0
462.0 575.0 461.0 594.0 389.0 592.0 394.0 571.0 large-vehicle 0
473.0 601.0 473.0 623.0 404.0 621.0 408.0 597.0 large-vehicle 0
459.0 631.0 456.0 651.0 386.0 649.0 390.0 626.0 large-vehicle 0
474.0 657.0 475.0 677.0 412.0 679.0 414.0 656.0 large-vehicle 0
473.0 689.0 473.0 708.0 404.0 705.0 406.0 686.0 large-vehicle 0
469.0 716.0 468.0 738.0 401.0 731.0 403.0 713.0 large-vehicle 0
468.0 746.0 466.0 766.0 403.0 759.0 405.0 738.0 large-vehicle 0
470.0 771.0 471.0 790.0 411.0 789.0 411.0 769.0 large-vehicle 0
456.0 801.0 454.0 825.0 393.0 816.0 394.0 794.0 large-vehicle 0
453.0 827.0 454.0 847.0 391.0 843.0 393.0 821.0 large-vehicle 0
453.0 856.0 451.0 876.0 391.0 875.0 393.0 850.0 large-vehicle 0
463.0 884.0 464.0 901.0 403.0 905.0 404.0 884.0 large-vehicle 0
278.0 755.0 281.0 736.0 371.0 742.0 371.0 760.0 large-vehicle 0
278.0 702.0 280.0 680.0 370.0 684.0 369.0 705.0 large-vehicle 0
80.0 754.0 78.0 774.0 34.0 774.0 34.0 755.0 small-vehicle 0
279.0 672.0 282.0 651.0 373.0 654.0 372.0 676.0 large-vehicle 0
178.0 257.0 178.0 279.0 97.0 278.0 96.0 254.0 large-vehicle 0
174.0 311.0 173.0 332.0 89.0 333.0 88.0 312.0 large-vehicle 0
189.0 345.0 186.0 366.0 90.0 362.0 91.0 339.0 large-vehicle 0
189.0 457.0 189.0 478.0 95.0 474.0 97.0 454.0 large-vehicle 0
191.0 487.0 190.0 508.0 91.0 503.0 94.0 482.0 large-vehicle 0
184.0 516.0 183.0 536.0 86.0 531.0 89.0 511.0 large-vehicle 0
186.0 544.0 186.0 564.0 90.0 560.0 90.0 541.0 large-vehicle 0
186.0 573.0 184.0 592.0 88.0 590.0 92.0 569.0 large-vehicle 0
179.0 602.0 178.0 625.0 97.0 621.0 100.0 600.0 large-vehicle 0
170.0 660.0 168.0 681.0 89.0 679.0 91.0 658.0 large-vehicle 0
166.0 687.0 168.0 707.0 86.0 711.0 87.0 691.0 large-vehicle 0
165.0 718.0 162.0 736.0 81.0 732.0 83.0 713.0 large-vehicle 0
164.0 745.0 162.0 763.0 83.0 765.0 84.0 743.0 large-vehicle 0
161.0 774.0 161.0 794.0 80.0 792.0 79.0 772.0 large-vehicle 0
152.0 802.0 148.0 821.0 88.0 817.0 90.0 797.0 large-vehicle 0
146.0 831.0 146.0 849.0 84.0 851.0 85.0 831.0 large-vehicle 0
149.0 857.0 146.0 878.0 88.0 878.0 88.0 858.0 large-vehicle 0
147.0 886.0 147.0 907.0 87.0 907.0 88.0 885.0 large-vehicle 0
286.0 211.0 286.0 189.0 374.0 189.0 373.0 209.0 large-vehicle 0
284.0 243.0 285.0 221.0 375.0 225.0 374.0 246.0 large-vehicle 0
282.0 358.0 284.0 338.0 372.0 341.0 371.0 366.0 large-vehicle 0
282.0 414.0 283.0 391.0 374.0 397.0 373.0 418.0 large-vehicle 0
283.0 442.0 284.0 423.0 375.0 426.0 374.0 447.0 large-vehicle 0
284.0 475.0 284.0 453.0 374.0 456.0 374.0 474.0 large-vehicle 0
280.0 529.0 283.0 504.0 376.0 514.0 376.0 533.0 large-vehicle 0
283.0 558.0 284.0 540.0 376.0 542.0 376.0 561.0 large-vehicle 0
279.0 586.0 282.0 566.0 374.0 571.0 373.0 591.0 large-vehicle 0
276.0 618.0 276.0 595.0 368.0 599.0 368.0 619.0 large-vehicle 0
281.0 644.0 282.0 626.0 374.0 628.0 371.0 648.0 large-vehicle 0
578.0 284.0 579.0 263.0 628.0 264.0 627.0 284.0 large-vehicle 0
576.0 312.0 579.0 293.0 628.0 298.0 628.0 314.0 large-vehicle 0
576.0 338.0 578.0 319.0 626.0 323.0 626.0 339.0 large-vehicle 0
572.0 367.0 574.0 349.0 623.0 349.0 621.0 369.0 large-vehicle 0
34.0 2.0 53.0 1.0 49.0 32.0 31.0 32.0 small-vehicle 0
46.0 39.0 63.0 38.0 61.0 73.0 41.0 74.0 small-vehicle 0
166.0 86.0 166.0 106.0 121.0 107.0 120.0 85.0 small-vehicle 0
224.0 82.0 226.0 99.0 186.0 102.0 185.0 87.0 small-vehicle 0
461.0 25.0 481.0 30.0 470.0 70.0 452.0 64.0 small-vehicle 1
500.0 32.0 518.0 34.0 512.0 73.0 494.0 70.0 small-vehicle 1
517.0 32.0 535.0 34.0 531.0 75.0 513.0 74.0 small-vehicle 1
534.0 37.0 549.0 38.0 546.0 68.0 531.0 67.0 small-vehicle 1
571.0 74.0 551.0 75.0 549.0 38.0 569.0 37.0 small-vehicle 1
575.0 27.0 595.0 27.0 596.0 69.0 575.0 69.0 small-vehicle 1
620.0 32.0 638.0 33.0 638.0 65.0 620.0 65.0 small-vehicle 1
671.0 32.0 692.0 31.0 695.0 73.0 674.0 75.0 small-vehicle 1
421.0 155.0 421.0 135.0 466.0 134.0 466.0 153.0 small-vehicle 1
412.0 136.0 413.0 155.0 369.0 158.0 368.0 139.0 small-vehicle 0
322.0 142.0 322.0 161.0 282.0 162.0 282.0 143.0 small-vehicle 1
277.0 144.0 279.0 162.0 236.0 167.0 234.0 148.0 small-vehicle 1
231.0 147.0 234.0 165.0 190.0 171.0 187.0 153.0 small-vehicle 1
36.0 318.0 38.0 299.0 81.0 304.0 79.0 321.0 small-vehicle 1
40.0 342.0 41.0 326.0 80.0 326.0 81.0 342.0 small-vehicle 1
39.0 373.0 39.0 357.0 83.0 359.0 82.0 376.0 small-vehicle 1
38.0 397.0 39.0 381.0 81.0 382.0 81.0 399.0 small-vehicle 1
34.0 419.0 34.0 402.0 80.0 406.0 78.0 422.0 small-vehicle 1
36.0 443.0 36.0 426.0 80.0 426.0 79.0 444.0 small-vehicle 1
26.0 562.0 27.0 535.0 81.0 538.0 81.0 563.0 small-vehicle 1
80.0 620.0 76.0 637.0 37.0 632.0 40.0 615.0 small-vehicle 1
78.0 663.0 78.0 681.0 38.0 683.0 37.0 665.0 small-vehicle 1
77.0 582.0 76.0 600.0 38.0 601.0 38.0 582.0 small-vehicle 0
76.0 644.0 76.0 664.0 32.0 663.0 33.0 644.0 small-vehicle 0
77.0 691.0 77.0 710.0 29.0 710.0 29.0 691.0 small-vehicle 0
696.0 911.0 684.0 895.0 723.0 860.0 736.0 878.0 large-vehicle 0
694.0 879.0 682.0 860.0 719.0 828.0 731.0 844.0 large-vehicle 0
693.0 846.0 680.0 827.0 718.0 792.0 731.0 808.0 large-vehicle 0
570.0 861.0 573.0 841.0 624.0 845.0 621.0 865.0 large-vehicle 0
574.0 396.0 574.0 377.0 621.0 378.0 621.0 397.0 large-vehicle 0
576.0 426.0 578.0 406.0 626.0 408.0 626.0 426.0 large-vehicle 0
573.0 454.0 574.0 436.0 621.0 436.0 621.0 455.0 large-vehicle 0
574.0 479.0 576.0 462.0 626.0 463.0 623.0 481.0 large-vehicle 0
573.0 508.0 573.0 488.0 621.0 488.0 621.0 508.0 large-vehicle 0
573.0 538.0 573.0 519.0 621.0 518.0 622.0 536.0 large-vehicle 0
568.0 563.0 571.0 543.0 620.0 546.0 619.0 568.0 large-vehicle 0
569.0 592.0 571.0 573.0 622.0 577.0 619.0 597.0 large-vehicle 0
566.0 617.0 569.0 600.0 618.0 601.0 614.0 622.0 large-vehicle 0
574.0 649.0 576.0 628.0 625.0 628.0 624.0 649.0 large-vehicle 0
565.0 674.0 571.0 656.0 619.0 659.0 618.0 678.0 large-vehicle 0
566.0 705.0 566.0 686.0 617.0 685.0 617.0 706.0 large-vehicle 0
570.0 833.0 571.0 814.0 626.0 817.0 624.0 836.0 large-vehicle 0
568.0 890.0 569.0 869.0 621.0 874.0 617.0 894.0 large-vehicle 0
698.0 805.0 686.0 789.0 722.0 755.0 736.0 771.0 large-vehicle 0
565.0 916.0 571.0 897.0 620.0 898.0 615.0 921.0 large-vehicle 0
695.0 351.0 683.0 336.0 719.0 302.0 733.0 317.0 large-vehicle 0
701.0 418.0 686.0 402.0 722.0 367.0 736.0 383.0 large-vehicle 0
696.0 454.0 682.0 436.0 722.0 407.0 736.0 424.0 large-vehicle 0
695.0 490.0 683.0 469.0 723.0 442.0 734.0 457.0 large-vehicle 0
701.0 520.0 687.0 503.0 728.0 471.0 740.0 487.0 large-vehicle 0
701.0 556.0 684.0 540.0 726.0 508.0 740.0 523.0 large-vehicle 0
698.0 593.0 686.0 570.0 728.0 544.0 739.0 560.0 large-vehicle 0
698.0 627.0 687.0 607.0 727.0 577.0 740.0 594.0 large-vehicle 0
696.0 662.0 684.0 642.0 723.0 613.0 736.0 630.0 large-vehicle 0
704.0 695.0 689.0 677.0 728.0 645.0 741.0 662.0 large-vehicle 0
698.0 735.0 684.0 718.0 721.0 684.0 734.0 701.0 large-vehicle 0
703.0 769.0 688.0 751.0 723.0 718.0 737.0 731.0 large-vehicle 0
181.0 226.0 180.0 246.0 97.0 242.0 99.0 222.0 large-vehicle 0
================================================
FILE: DOTA_demo/labelTxt/P1478__1__853___962.txt
================================================
907.0 127.0 889.0 126.0 890.0 88.0 908.0 89.0 small-vehicle 1
1.0 187.0 1.0 187.0 1.0 219.0 1.0 219.0 small-vehicle 2
1.0 220.0 1.0 220.0 1.0 254.0 1.0 254.0 small-vehicle 2
2.0 145.0 19.0 145.0 19.0 179.0 2.0 179.0 small-vehicle 0
3.0 181.0 18.0 181.0 18.0 221.0 3.0 221.0 small-vehicle 0
2.0 222.0 18.0 222.0 18.0 257.0 2.0 257.0 small-vehicle 0
20.0 190.0 35.0 190.0 35.0 220.0 20.0 220.0 small-vehicle 0
38.0 220.0 56.0 220.0 56.0 258.0 38.0 258.0 small-vehicle 0
75.0 182.0 94.0 182.0 94.0 222.0 75.0 222.0 small-vehicle 0
74.0 223.0 92.0 223.0 92.0 257.0 74.0 257.0 small-vehicle 0
267.0 528.0 281.0 528.0 281.0 560.0 267.0 560.0 small-vehicle 0
268.0 562.0 282.0 562.0 282.0 590.0 268.0 590.0 small-vehicle 0
267.0 590.0 281.0 590.0 281.0 621.0 267.0 621.0 small-vehicle 0
248.0 588.0 262.0 588.0 262.0 622.0 248.0 622.0 small-vehicle 0
300.0 547.0 317.0 547.0 317.0 590.0 300.0 590.0 small-vehicle 0
303.0 590.0 317.0 590.0 317.0 623.0 303.0 623.0 small-vehicle 0
320.0 545.0 336.0 545.0 336.0 583.0 320.0 583.0 small-vehicle 0
321.0 583.0 336.0 583.0 336.0 622.0 321.0 622.0 small-vehicle 0
358.0 536.0 375.0 536.0 375.0 578.0 358.0 578.0 small-vehicle 0
356.0 578.0 374.0 578.0 374.0 620.0 356.0 620.0 small-vehicle 0
398.0 592.0 412.0 592.0 412.0 624.0 398.0 624.0 small-vehicle 0
413.0 592.0 427.0 592.0 427.0 624.0 413.0 624.0 small-vehicle 0
429.0 592.0 443.0 592.0 443.0 623.0 429.0 623.0 small-vehicle 0
445.0 591.0 461.0 591.0 461.0 620.0 445.0 620.0 small-vehicle 0
465.0 594.0 478.0 594.0 478.0 623.0 465.0 623.0 small-vehicle 0
496.0 594.0 509.0 594.0 509.0 620.0 496.0 620.0 small-vehicle 0
511.0 592.0 528.0 592.0 528.0 622.0 511.0 622.0 small-vehicle 0
533.0 590.0 546.0 590.0 546.0 621.0 533.0 621.0 small-vehicle 0
553.0 586.0 568.0 586.0 568.0 621.0 553.0 621.0 small-vehicle 0
157.0 592.0 171.0 592.0 171.0 622.0 157.0 622.0 small-vehicle 0
159.0 563.0 173.0 563.0 173.0 592.0 159.0 592.0 small-vehicle 0
158.0 531.0 171.0 531.0 171.0 562.0 158.0 562.0 small-vehicle 0
213.0 407.0 227.0 407.0 227.0 445.0 213.0 445.0 small-vehicle 0
773.0 142.0 788.0 142.0 788.0 182.0 773.0 182.0 small-vehicle 0
794.0 143.0 809.0 143.0 809.0 180.0 794.0 180.0 small-vehicle 0
302.0 354.0 319.0 354.0 319.0 394.0 302.0 394.0 small-vehicle 0
303.0 394.0 318.0 394.0 318.0 430.0 303.0 430.0 small-vehicle 0
302.0 432.0 319.0 432.0 319.0 468.0 302.0 468.0 small-vehicle 0
303.0 468.0 321.0 468.0 321.0 507.0 303.0 507.0 small-vehicle 0
192.0 369.0 209.0 369.0 209.0 411.0 192.0 411.0 small-vehicle 0
194.0 410.0 208.0 410.0 208.0 439.0 194.0 439.0 small-vehicle 0
212.0 445.0 229.0 445.0 229.0 484.0 212.0 484.0 small-vehicle 0
211.0 585.0 225.0 585.0 225.0 620.0 211.0 620.0 small-vehicle 0
211.0 485.0 227.0 485.0 227.0 522.0 211.0 522.0 small-vehicle 0
212.0 523.0 228.0 523.0 228.0 556.0 212.0 556.0 small-vehicle 0
193.0 441.0 210.0 441.0 210.0 479.0 193.0 479.0 small-vehicle 0
193.0 479.0 209.0 479.0 209.0 514.0 193.0 514.0 small-vehicle 0
192.0 516.0 207.0 516.0 207.0 552.0 192.0 552.0 small-vehicle 0
192.0 552.0 207.0 552.0 207.0 588.0 192.0 588.0 small-vehicle 0
191.0 589.0 206.0 589.0 206.0 622.0 191.0 622.0 small-vehicle 0
213.0 557.0 226.0 557.0 226.0 585.0 213.0 585.0 small-vehicle 0
573.0 584.0 589.0 584.0 589.0 622.0 573.0 622.0 small-vehicle 0
594.0 585.0 611.0 585.0 611.0 622.0 594.0 622.0 small-vehicle 0
617.0 584.0 633.0 584.0 633.0 622.0 617.0 622.0 small-vehicle 0
732.0 1.0 750.0 1.0 750.0 34.0 732.0 34.0 small-vehicle 0
751.0 1.0 768.0 1.0 768.0 37.0 751.0 37.0 small-vehicle 0
697.0 1.0 712.0 1.0 712.0 30.0 697.0 30.0 small-vehicle 0
715.0 1.0 730.0 1.0 730.0 35.0 715.0 35.0 small-vehicle 0
678.0 1.0 694.0 1.0 694.0 31.0 678.0 31.0 small-vehicle 0
638.0 589.0 652.0 589.0 652.0 619.0 638.0 619.0 small-vehicle 0
472.0 1.0 489.0 1.0 489.0 36.0 472.0 36.0 small-vehicle 0
656.0 586.0 672.0 586.0 672.0 617.0 656.0 617.0 small-vehicle 0
674.0 582.0 692.0 582.0 692.0 621.0 674.0 621.0 small-vehicle 0
702.0 586.0 716.0 586.0 716.0 616.0 702.0 616.0 small-vehicle 0
722.0 581.0 739.0 581.0 739.0 621.0 722.0 621.0 small-vehicle 0
742.0 583.0 759.0 583.0 759.0 618.0 742.0 618.0 small-vehicle 0
765.0 580.0 784.0 580.0 784.0 621.0 765.0 621.0 small-vehicle 0
801.0 586.0 817.0 586.0 817.0 619.0 801.0 619.0 small-vehicle 0
453.0 1.0 470.0 1.0 470.0 37.0 453.0 37.0 small-vehicle 0
491.0 1.0 507.0 1.0 507.0 34.0 491.0 34.0 small-vehicle 0
659.0 1.0 676.0 1.0 676.0 32.0 659.0 32.0 small-vehicle 0
512.0 1.0 526.0 1.0 526.0 34.0 512.0 34.0 small-vehicle 0
529.0 1.0 544.0 1.0 544.0 33.0 529.0 33.0 small-vehicle 0
548.0 1.0 563.0 1.0 563.0 30.0 548.0 30.0 small-vehicle 0
567.0 1.0 583.0 1.0 583.0 32.0 567.0 32.0 small-vehicle 0
584.0 1.0 601.0 1.0 601.0 33.0 584.0 33.0 small-vehicle 0
604.0 1.0 621.0 1.0 621.0 29.0 604.0 29.0 small-vehicle 0
623.0 1.0 637.0 1.0 637.0 29.0 623.0 29.0 small-vehicle 0
640.0 1.0 656.0 1.0 656.0 29.0 640.0 29.0 small-vehicle 0
753.0 140.0 769.0 140.0 769.0 179.0 753.0 179.0 small-vehicle 0
734.0 140.0 751.0 140.0 751.0 181.0 734.0 181.0 small-vehicle 0
714.0 140.0 732.0 140.0 732.0 180.0 714.0 180.0 small-vehicle 0
696.0 141.0 713.0 141.0 713.0 182.0 696.0 182.0 small-vehicle 0
511.0 142.0 525.0 142.0 525.0 178.0 511.0 178.0 small-vehicle 0
361.0 145.0 380.0 145.0 380.0 184.0 361.0 184.0 small-vehicle 0
380.0 144.0 395.0 144.0 395.0 181.0 380.0 181.0 small-vehicle 0
397.0 142.0 413.0 142.0 413.0 182.0 397.0 182.0 small-vehicle 0
415.0 141.0 431.0 141.0 431.0 183.0 415.0 183.0 small-vehicle 0
435.0 142.0 452.0 142.0 452.0 182.0 435.0 182.0 small-vehicle 0
455.0 142.0 470.0 142.0 470.0 179.0 455.0 179.0 small-vehicle 0
472.0 142.0 489.0 142.0 489.0 178.0 472.0 178.0 small-vehicle 0
492.0 143.0 507.0 143.0 507.0 176.0 492.0 176.0 small-vehicle 0
529.0 142.0 544.0 142.0 544.0 182.0 529.0 182.0 small-vehicle 0
195.0 142.0 211.0 142.0 211.0 181.0 195.0 181.0 small-vehicle 0
546.0 141.0 563.0 141.0 563.0 182.0 546.0 182.0 small-vehicle 0
566.0 142.0 582.0 142.0 582.0 182.0 566.0 182.0 small-vehicle 0
584.0 141.0 600.0 141.0 600.0 182.0 584.0 182.0 small-vehicle 0
603.0 142.0 618.0 142.0 618.0 182.0 603.0 182.0 small-vehicle 0
621.0 141.0 635.0 141.0 635.0 181.0 621.0 181.0 small-vehicle 0
639.0 141.0 656.0 141.0 656.0 182.0 639.0 182.0 small-vehicle 0
659.0 142.0 674.0 142.0 674.0 181.0 659.0 181.0 small-vehicle 0
675.0 142.0 693.0 142.0 693.0 184.0 675.0 184.0 small-vehicle 0
342.0 144.0 359.0 144.0 359.0 184.0 342.0 184.0 small-vehicle 0
436.0 1.0 451.0 1.0 451.0 33.0 436.0 33.0 small-vehicle 0
232.0 1.0 247.0 1.0 247.0 29.0 232.0 29.0 small-vehicle 0
158.0 1.0 173.0 1.0 173.0 31.0 158.0 31.0 small-vehicle 0
175.0 1.0 192.0 1.0 192.0 32.0 175.0 32.0 small-vehicle 0
194.0 1.0 211.0 1.0 211.0 31.0 194.0 31.0 small-vehicle 0
211.0 1.0 230.0 1.0 230.0 33.0 211.0 33.0 small-vehicle 0
249.0 1.0 266.0 1.0 266.0 31.0 249.0 31.0 small-vehicle 0
417.0 1.0 433.0 1.0 433.0 32.0 417.0 32.0 small-vehicle 0
270.0 1.0 287.0 1.0 287.0 31.0 270.0 31.0 small-vehicle 0
288.0 1.0 305.0 1.0 305.0 31.0 288.0 31.0 small-vehicle 0
307.0 1.0 323.0 1.0 323.0 28.0 307.0 28.0 small-vehicle 0
324.0 1.0 342.0 1.0 342.0 34.0 324.0 34.0 small-vehicle 0
343.0 1.0 360.0 1.0 360.0 33.0 343.0 33.0 small-vehicle 0
362.0 1.0 379.0 1.0 379.0 35.0 362.0 35.0 small-vehicle 0
382.0 1.0 396.0 1.0 396.0 34.0 382.0 34.0 small-vehicle 0
399.0 1.0 415.0 1.0 415.0 28.0 399.0 28.0 small-vehicle 0
211.0 221.0 192.0 222.0 193.0 185.0 210.0 186.0 small-vehicle 0
414.0 221.0 398.0 222.0 396.0 187.0 413.0 185.0 small-vehicle 0
250.0 222.0 232.0 221.0 230.0 187.0 248.0 187.0 small-vehicle 0
287.0 225.0 267.0 225.0 267.0 186.0 287.0 184.0 small-vehicle 0
305.0 223.0 286.0 226.0 287.0 185.0 304.0 186.0 small-vehicle 0
322.0 223.0 303.0 224.0 305.0 186.0 322.0 187.0 small-vehicle 0
340.0 222.0 320.0 223.0 321.0 187.0 340.0 185.0 small-vehicle 0
360.0 222.0 340.0 223.0 339.0 187.0 357.0 185.0 small-vehicle 0
376.0 223.0 359.0 222.0 359.0 185.0 379.0 186.0 small-vehicle 0
397.0 222.0 377.0 222.0 379.0 187.0 397.0 186.0 small-vehicle 0
432.0 222.0 416.0 221.0 414.0 185.0 433.0 187.0 small-vehicle 0
229.0 222.0 209.0 221.0 211.0 185.0 231.0 187.0 small-vehicle 0
194.0 222.0 173.0 222.0 175.0 187.0 193.0 187.0 small-vehicle 0
174.0 222.0 155.0 221.0 155.0 187.0 174.0 186.0 small-vehicle 0
812.0 3.0 795.0 4.0 794.0 1.0 812.0 1.0 small-vehicle 2
813.0 38.0 794.0 37.0 794.0 4.0 812.0 3.0 small-vehicle 0
812.0 85.0 795.0 84.0 794.0 47.0 812.0 48.0 small-vehicle 0
814.0 123.0 795.0 122.0 796.0 87.0 810.0 85.0 small-vehicle 0
732.0 222.0 715.0 223.0 715.0 184.0 733.0 183.0 small-vehicle 0
754.0 215.0 736.0 214.0 738.0 186.0 753.0 186.0 small-vehicle 0
786.0 221.0 768.0 222.0 770.0 185.0 784.0 182.0 small-vehicle 0
809.0 220.0 793.0 220.0 793.0 185.0 809.0 185.0 small-vehicle 0
713.0 315.0 695.0 315.0 696.0 280.0 711.0 281.0 small-vehicle 0
401.0 455.0 415.0 455.0 415.0 485.0 399.0 483.0 small-vehicle 0
765.0 521.0 748.0 521.0 747.0 493.0 764.0 493.0 small-vehicle 0
618.0 359.0 636.0 358.0 637.0 395.0 617.0 394.0 small-vehicle 0
619.0 402.0 636.0 402.0 637.0 439.0 618.0 438.0 small-vehicle 0
620.0 453.0 636.0 453.0 634.0 492.0 617.0 489.0 small-vehicle 0
815.0 410.0 800.0 409.0 802.0 383.0 817.0 384.0 small-vehicle 0
817.0 451.0 802.0 451.0 801.0 423.0 814.0 422.0 small-vehicle 0
817.0 495.0 804.0 492.0 803.0 470.0 817.0 471.0 small-vehicle 0
817.0 537.0 800.0 537.0 799.0 506.0 815.0 507.0 small-vehicle 0
421.0 410.0 436.0 408.0 437.0 437.0 421.0 437.0 small-vehicle 0
765.0 459.0 748.0 459.0 748.0 428.0 764.0 429.0 small-vehicle 0
444.0 375.0 459.0 374.0 455.0 410.0 440.0 409.0 small-vehicle 0
478.0 321.0 497.0 321.0 495.0 355.0 478.0 357.0 small-vehicle 0
483.0 272.0 497.0 273.0 497.0 304.0 480.0 302.0 small-vehicle 0
408.0 267.0 423.0 267.0 421.0 303.0 406.0 302.0 small-vehicle 0
382.0 264.0 397.0 264.0 394.0 293.0 381.0 293.0 small-vehicle 0
377.0 300.0 360.0 301.0 358.0 268.0 377.0 265.0 small-vehicle 0
359.0 300.0 340.0 297.0 340.0 262.0 358.0 260.0 small-vehicle 0
174.0 303.0 155.0 302.0 156.0 265.0 177.0 264.0 small-vehicle 0
765.0 491.0 748.0 489.0 748.0 463.0 765.0 462.0 small-vehicle 0
764.0 424.0 748.0 426.0 748.0 398.0 764.0 395.0 small-vehicle 0
712.0 347.0 694.0 347.0 695.0 316.0 713.0 315.0 small-vehicle 0
730.0 521.0 716.0 522.0 719.0 498.0 732.0 498.0 small-vehicle 0
713.0 384.0 696.0 385.0 696.0 352.0 712.0 352.0 small-vehicle 0
696.0 385.0 679.0 387.0 677.0 350.0 697.0 348.0 small-vehicle 0
697.0 421.0 680.0 422.0 678.0 388.0 696.0 386.0 small-vehicle 0
698.0 459.0 681.0 460.0 679.0 425.0 696.0 423.0 small-vehicle 0
715.0 456.0 700.0 459.0 698.0 424.0 713.0 427.0 small-vehicle 0
698.0 493.0 682.0 494.0 682.0 463.0 697.0 462.0 small-vehicle 0
698.0 530.0 680.0 528.0 680.0 498.0 698.0 495.0 small-vehicle 0
716.0 524.0 700.0 523.0 700.0 495.0 716.0 498.0 small-vehicle 0
731.0 495.0 716.0 495.0 717.0 467.0 731.0 467.0 small-vehicle 0
764.0 394.0 745.0 397.0 744.0 360.0 764.0 358.0 small-vehicle 0
715.0 495.0 701.0 495.0 700.0 463.0 716.0 461.0 small-vehicle 0
731.0 464.0 717.0 463.0 716.0 437.0 731.0 436.0 small-vehicle 0
732.0 438.0 716.0 437.0 715.0 407.0 732.0 407.0 small-vehicle 0
715.0 421.0 700.0 422.0 699.0 386.0 715.0 384.0 small-vehicle 0
732.0 404.0 715.0 405.0 715.0 371.0 732.0 371.0 small-vehicle 0
733.0 369.0 716.0 369.0 715.0 334.0 729.0 333.0 small-vehicle 0
733.0 331.0 715.0 330.0 715.0 296.0 732.0 294.0 small-vehicle 0
763.0 357.0 745.0 357.0 744.0 324.0 761.0 324.0 small-vehicle 0
920.0 700.0 893.0 701.0 888.0 576.0 917.0 577.0 large-vehicle 0
611.0 738.0 637.0 737.0 637.0 840.0 611.0 839.0 large-vehicle 0
459.0 630.0 484.0 630.0 482.0 734.0 456.0 732.0 large-vehicle 0
380.0 736.0 405.0 736.0 405.0 837.0 379.0 836.0 large-vehicle 0
584.0 634.0 612.0 634.0 611.0 738.0 584.0 736.0 large-vehicle 0
611.0 633.0 636.0 631.0 636.0 737.0 611.0 738.0 large-vehicle 0
638.0 638.0 662.0 640.0 663.0 737.0 636.0 738.0 large-vehicle 0
663.0 636.0 690.0 637.0 688.0 739.0 662.0 740.0 large-vehicle 0
716.0 633.0 743.0 631.0 741.0 737.0 714.0 733.0 large-vehicle 0
583.0 738.0 611.0 737.0 611.0 841.0 583.0 838.0 large-vehicle 0
636.0 739.0 663.0 738.0 663.0 840.0 637.0 839.0 large-vehicle 0
662.0 740.0 689.0 739.0 688.0 841.0 663.0 840.0 large-vehicle 0
715.0 738.0 742.0 737.0 743.0 841.0 713.0 841.0 large-vehicle 0
303.0 148.0 319.0 139.0 341.0 170.0 326.0 179.0 small-vehicle 1
174.0 141.0 192.0 144.0 190.0 176.0 174.0 177.0 small-vehicle 1
407.0 632.0 432.0 632.0 430.0 734.0 406.0 734.0 large-vehicle 0
382.0 634.0 409.0 634.0 406.0 731.0 382.0 731.0 large-vehicle 0
159.0 737.0 182.0 740.0 181.0 841.0 157.0 842.0 large-vehicle 0
132.0 737.0 160.0 737.0 156.0 842.0 133.0 841.0 large-vehicle 0
135.0 634.0 158.0 634.0 159.0 736.0 133.0 738.0 large-vehicle 0
7.0 637.0 34.0 638.0 33.0 738.0 5.0 739.0 large-vehicle 0
35.0 635.0 59.0 636.0 58.0 735.0 33.0 736.0 large-vehicle 0
59.0 634.0 83.0 636.0 83.0 737.0 58.0 738.0 large-vehicle 0
85.0 635.0 107.0 636.0 108.0 737.0 83.0 738.0 large-vehicle 0
108.0 636.0 134.0 634.0 133.0 738.0 109.0 738.0 large-vehicle 0
160.0 629.0 182.0 629.0 181.0 731.0 159.0 730.0 large-vehicle 0
186.0 637.0 208.0 638.0 207.0 735.0 185.0 736.0 large-vehicle 0
212.0 633.0 232.0 633.0 230.0 733.0 211.0 735.0 large-vehicle 0
236.0 632.0 258.0 632.0 255.0 731.0 235.0 731.0 large-vehicle 0
12.0 739.0 34.0 737.0 32.0 843.0 9.0 841.0 large-vehicle 0
35.0 737.0 58.0 737.0 56.0 843.0 35.0 841.0 large-vehicle 0
58.0 737.0 82.0 736.0 82.0 843.0 57.0 842.0 large-vehicle 0
83.0 737.0 107.0 737.0 107.0 843.0 81.0 844.0 large-vehicle 0
107.0 738.0 131.0 738.0 132.0 843.0 107.0 843.0 large-vehicle 0
115.0 9.0 115.0 1.0 150.0 1.0 150.0 8.0 small-vehicle 2
115.0 28.0 114.0 9.0 150.0 8.0 151.0 28.0 small-vehicle 0
113.0 50.0 114.0 28.0 152.0 29.0 151.0 50.0 small-vehicle 0
80.0 1.0 80.0 13.0 45.0 14.0 44.0 1.0 small-vehicle 0
2.0 12.0 2.0 1.0 39.0 1.0 39.0 12.0 small-vehicle 2
2.0 30.0 2.0 13.0 38.0 12.0 39.0 29.0 small-vehicle 0
1.0 53.0 0.0 34.0 40.0 32.0 41.0 52.0 small-vehicle 0
0.0 90.0 0.0 71.0 39.0 69.0 40.0 91.0 small-vehicle 0
78.0 92.0 77.0 111.0 42.0 109.0 40.0 93.0 small-vehicle 0
77.0 73.0 78.0 92.0 47.0 90.0 49.0 72.0 small-vehicle 0
78.0 54.0 77.0 72.0 41.0 73.0 42.0 55.0 small-vehicle 0
80.0 13.0 80.0 34.0 41.0 34.0 39.0 13.0 small-vehicle 0
747.0 70.0 726.0 72.0 728.0 35.0 747.0 37.0 small-vehicle 0
767.0 72.0 746.0 71.0 746.0 36.0 763.0 36.0 small-vehicle 0
173.0 109.0 153.0 110.0 154.0 71.0 172.0 71.0 small-vehicle 0
190.0 110.0 172.0 109.0 171.0 77.0 190.0 78.0 small-vehicle 0
208.0 109.0 191.0 108.0 191.0 75.0 207.0 75.0 small-vehicle 0
225.0 110.0 207.0 108.0 208.0 73.0 225.0 72.0 small-vehicle 0
245.0 109.0 225.0 109.0 225.0 72.0 245.0 71.0 small-vehicle 0
264.0 109.0 246.0 110.0 246.0 75.0 262.0 74.0 small-vehicle 0
283.0 109.0 266.0 109.0 264.0 71.0 282.0 72.0 small-vehicle 0
302.0 109.0 284.0 109.0 284.0 71.0 301.0 71.0 small-vehicle 0
320.0 109.0 302.0 109.0 301.0 71.0 319.0 71.0 small-vehicle 0
338.0 110.0 320.0 110.0 321.0 72.0 338.0 71.0 small-vehicle 0
357.0 110.0 339.0 111.0 338.0 69.0 355.0 71.0 small-vehicle 0
375.0 109.0 356.0 110.0 355.0 72.0 375.0 72.0 small-vehicle 0
393.0 110.0 376.0 109.0 375.0 74.0 392.0 72.0 small-vehicle 0
413.0 110.0 393.0 110.0 391.0 72.0 412.0 71.0 small-vehicle 0
431.0 110.0 413.0 109.0 412.0 70.0 429.0 70.0 small-vehicle 0
448.0 109.0 431.0 110.0 430.0 70.0 450.0 71.0 small-vehicle 0
469.0 110.0 449.0 109.0 449.0 73.0 467.0 71.0 small-vehicle 0
728.0 71.0 710.0 72.0 710.0 36.0 726.0 36.0 small-vehicle 0
709.0 71.0 692.0 71.0 691.0 34.0 710.0 35.0 small-vehicle 0
691.0 71.0 673.0 72.0 674.0 39.0 691.0 38.0 small-vehicle 0
488.0 71.0 469.0 71.0 468.0 36.0 487.0 36.0 small-vehicle 0
337.0 70.0 319.0 71.0 320.0 34.0 338.0 36.0 small-vehicle 0
355.0 70.0 337.0 70.0 338.0 36.0 355.0 35.0 small-vehicle 0
377.0 70.0 355.0 71.0 354.0 34.0 375.0 35.0 small-vehicle 0
392.0 70.0 376.0 71.0 376.0 36.0 394.0 34.0 small-vehicle 0
414.0 71.0 392.0 72.0 395.0 36.0 411.0 38.0 small-vehicle 0
430.0 71.0 411.0 71.0 412.0 33.0 429.0 33.0 small-vehicle 0
450.0 71.0 430.0 70.0 430.0 37.0 449.0 38.0 small-vehicle 0
467.0 70.0 450.0 71.0 449.0 37.0 468.0 38.0 small-vehicle 0
506.0 70.0 487.0 70.0 486.0 36.0 507.0 35.0 small-vehicle 0
671.0 70.0 653.0 71.0 654.0 36.0 673.0 35.0 small-vehicle 0
523.0 71.0 506.0 71.0 504.0 37.0 525.0 36.0 small-vehicle 0
543.0 72.0 524.0 72.0 523.0 38.0 542.0 37.0 small-vehicle 0
561.0 71.0 543.0 70.0 542.0 36.0 561.0 38.0 small-vehicle 0
580.0 71.0 562.0 72.0 560.0 31.0 579.0 32.0 small-vehicle 0
598.0 70.0 580.0 71.0 579.0 34.0 598.0 34.0 small-vehicle 0
617.0 70.0 599.0 70.0 597.0 36.0 616.0 36.0 small-vehicle 0
635.0 70.0 616.0 70.0 618.0 32.0 636.0 30.0 small-vehicle 0
654.0 71.0 636.0 70.0 636.0 35.0 652.0 35.0 small-vehicle 0
488.0 110.0 469.0 110.0 469.0 71.0 486.0 71.0 small-vehicle 0
503.0 110.0 488.0 110.0 487.0 72.0 506.0 71.0 small-vehicle 0
524.0 108.0 506.0 109.0 506.0 72.0 525.0 72.0 small-vehicle 0
543.0 111.0 524.0 109.0 524.0 72.0 543.0 71.0 small-vehicle 0
708.0 109.0 688.0 109.0 690.0 72.0 709.0 73.0 small-vehicle 0
563.0 110.0 543.0 110.0 543.0 71.0 560.0 72.0 small-vehicle 0
578.0 109.0 561.0 108.0 560.0 73.0 581.0 71.0 small-vehicle 0
597.0 107.0 578.0 109.0 580.0 73.0 599.0 72.0 small-vehicle 0
618.0 108.0 599.0 108.0 599.0 73.0 617.0 71.0 small-vehicle 0
636.0 109.0 617.0 109.0 617.0 71.0 634.0 71.0 small-vehicle 0
654.0 108.0 635.0 109.0 635.0 71.0 654.0 71.0 small-vehicle 0
674.0 109.0 655.0 109.0 653.0 71.0 671.0 71.0 small-vehicle 0
688.0 109.0 672.0 109.0 672.0 72.0 689.0 72.0 small-vehicle 0
728.0 108.0 709.0 109.0 708.0 71.0 728.0 72.0 small-vehicle 0
746.0 107.0 729.0 108.0 727.0 71.0 745.0 71.0 small-vehicle 0
765.0 106.0 745.0 108.0 744.0 71.0 768.0 72.0 small-vehicle 0
320.0 71.0 303.0 70.0 302.0 35.0 319.0 34.0 small-vehicle 0
302.0 70.0 283.0 71.0 284.0 32.0 301.0 33.0 small-vehicle 0
284.0 70.0 264.0 70.0 262.0 34.0 282.0 34.0 small-vehicle 0
265.0 71.0 245.0 71.0 245.0 35.0 264.0 35.0 small-vehicle 0
170.0 71.0 154.0 70.0 153.0 35.0 170.0 35.0 small-vehicle 0
189.0 70.0 171.0 72.0 169.0 35.0 188.0 36.0 small-vehicle 0
208.0 71.0 190.0 70.0 189.0 36.0 206.0 35.0 small-vehicle 0
227.0 71.0 208.0 71.0 208.0 34.0 225.0 35.0 small-vehicle 0
245.0 71.0 226.0 70.0 225.0 35.0 244.0 35.0 small-vehicle 0
================================================
FILE: Draw_DOTA_YOLO.py
================================================
# -*- coding: utf-8 -*-
import dota_utils as util
import os
import numpy as np
from PIL import Image
import cv2
import random
from YOLO_Transform import longsideformat2cvminAreaRect, cvminAreaRect2longsideformat
import math
import cv2
import math
import numpy as np
import os
import shutil
def rotateAugment(angle, scale, image, labels):
"""
旋转目标增强 随机旋转
@param angle: 旋转增强角度 int 单位为度
@param scale: 设为1,尺度由train.py中定义
@param image: img信息 shape(heght, width, 3)
@param labels: (num, [classid x_c y_c longside shortside Θ]) Θ ∈ int[0,180)
@return:
rotated_img: augmented_img信息 shape(heght, width, 3)
rotated_labels: augmented_label: (num, [classid x_c y_c longside shortside Θ])
"""
Pi_angle = -angle * math.pi / 180.0 # 弧度制,后面旋转坐标需要用到,注意负号!!!
rows, cols = image.shape[:2]
a, b = cols / 2, rows / 2
M = cv2.getRotationMatrix2D(center=(a, b), angle=angle, scale=scale)
rotated_img = cv2.warpAffine(image, M, (cols, rows)) # 旋转后的图像保持大小不变
rotated_labels = []
for label in labels:
# rect=[(x_c,y_c),(w,h),Θ] Θ:flaot[0-179] -> (-180,0)
rect = longsideformat2cvminAreaRect(label[1], label[2], label[3], label[4], (label[5] - 179.9))
# poly = [(x1,y1),(x2,y2),(x3,y3),(x4,y4)]
poly = cv2.boxPoints(rect) # 返回rect对应的四个点的值 normalized
# 四点坐标反归一化
poly[:, 0] = poly[:, 0] * cols
poly[:, 1] = poly[:, 1] * rows
# 下面是计算旋转后目标相对旋转过后的图像的位置
X0 = (poly[0][0] - a) * math.cos(Pi_angle) - (poly[0][1] - b) * math.sin(Pi_angle) + a
Y0 = (poly[0][0] - a) * math.sin(Pi_angle) + (poly[0][1] - b) * math.cos(Pi_angle) + b
X1 = (poly[1][0] - a) * math.cos(Pi_angle) - (poly[1][1] - b) * math.sin(Pi_angle) + a
Y1 = (poly[1][0] - a) * math.sin(Pi_angle) + (poly[1][1] - b) * math.cos(Pi_angle) + b
X2 = (poly[2][0] - a) * math.cos(Pi_angle) - (poly[2][1] - b) * math.sin(Pi_angle) + a
Y2 = (poly[2][0] - a) * math.sin(Pi_angle) + (poly[2][1] - b) * math.cos(Pi_angle) + b
X3 = (poly[3][0] - a) * math.cos(Pi_angle) - (poly[3][1] - b) * math.sin(Pi_angle) + a
Y3 = (poly[3][0] - a) * math.sin(Pi_angle) + (poly[3][1] - b) * math.cos(Pi_angle) + b
poly_rotated = np.array([(X0, Y0), (X1, Y1), (X2, Y2), (X3, Y3)])
# 四点坐标归一化
poly_rotated[:, 0] = poly_rotated[:, 0] / cols
poly_rotated[:, 1] = poly_rotated[:, 1] / rows
rect_rotated = cv2.minAreaRect(np.float32(poly_rotated)) # 得到最小外接矩形的(中心(x,y), (宽,高), 旋转角度)
c_x = rect_rotated[0][0]
c_y = rect_rotated[0][1]
w = rect_rotated[1][0]
h = rect_rotated[1][1]
theta = rect_rotated[-1] # Range for angle is [-90,0)
label[1:] = cvminAreaRect2longsideformat(c_x, c_y, w, h, theta)
if (sum(label[1:-1] <= 0) + sum(label[1:3] >= 1)) >= 1: # 0= 1的元素,bbox中有<= 0的元素,已将某个box排除,')
# print(
# '出问题的longside形式数据:[%.16f, %.16f, %.16f, %.16f, %.1f]' % (label[1], label[2], label[3], label[4], label[5]))
continue
label[-1] = int(label[-1] + 180.5) # range int[0,180] 四舍五入
if label[-1] == 180: # range int[0,179]
label[-1] = 179
rotated_labels.append(label)
return rotated_img, np.array(rotated_labels)
def drawLongsideFormatImg(imgpath, txtpath, dstpath, extractclassname, thickness=2, augment=False):
"""
根据labels绘制边框(label_format:classid, x_c_normalized, y_c_normalized, longside_normalized, shortside_normalized, Θ)
:param imgpath: the path of images
:param txtpath: the path of txt in longside format
:param dstpath: the path of image_drawed
:param extractclassname: the category you selected
"""
if os.path.exists(dstpath):
shutil.rmtree(dstpath) # delete output folder
os.makedirs(dstpath) # make new output folder
# 设置画框的颜色 colors = [[178, 63, 143], [25, 184, 176], [238, 152, 129],....,[235, 137, 120]]随机设置RGB颜色
colors = [[random.randint(0, 255) for _ in range(3)] for _ in range(len(extractclassname))]
filelist = util.GetFileFromThisRootDir(txtpath) # fileist=['/.../P0005.txt', ..., /.../P000?.txt]
for fullname in filelist: # fullname='/.../P000?.txt'
objects = util.parse_longsideformat(fullname)
'''
objects[i] = [classid, x_c_normalized, y_c_normalized, longside_normalized, shortside_normalized, theta]
'''
name = os.path.splitext(os.path.basename(fullname))[0] # name='P000?'
img_fullname = os.path.join(imgpath, name + '.png') # img_fullname='/.../P000?.png'
img_savename = os.path.join(dstpath, name + '_.png') # img_fullname='/.../_P000?.png'
img = Image.open(img_fullname) # 图像被打开但未被读取
img_w, img_h = img.size
img = cv2.imread(img_fullname) # 读取图像像素
objects = np.array(objects)
if augment:
# flip up augment
if len(objects):
img = cv2.flip(img, 0) # 垂直翻转
print(img.shape)
objects[:, 2] = 1 - objects[:, 2] # y变x不变
objects[:, -1] = 180 - objects[:, -1] # θ根据上下偏转也进行改变
objects[objects[:, -1] == 180, -1] = 0 # 原θ=0时,情况特殊
# flip lr augment
if len(objects):
img = cv2.flip(img, 1) # 水平翻转
objects[:, 1] = 1 - objects[:, 1] # x变y不变
objects[:, -1] = 180 - objects[:, -1] # θ根据左右偏转也进行改变
objects[objects[:, -1] == 180, -1] = 0 # 原θ=0时,情况特殊
# 旋转augment
degrees = 45
rotate_angle = random.uniform(-degrees, degrees)
img, objects = rotateAugment(rotate_angle, 1, img, objects)
for i, obj in enumerate(objects):
# obj = [classid, x_c_normalized, y_c_normalized, longside_normalized, shortside_normalized, float:0-179]
class_index = obj[0]
# rect=[(x_c,y_c),(w,h),Θ] Θ:flaot[0-179] -> (-180,0)
rect = longsideformat2cvminAreaRect(obj[1], obj[2], obj[3], obj[4], (obj[5]-179.9))
# poly = [(x1,y1),(x2,y2),(x3,y3),(x4,y4)]
poly = np.float32(cv2.boxPoints(rect)) # 返回rect对应的四个点的值 normalized
# 四点坐标反归一化 取整
poly[:, 0] = poly[:, 0] * img_w
poly[:, 1] = poly[:, 1] * img_h
poly = np.int0(poly)
# 画出来
cv2.drawContours(image=img,
contours=[poly],
contourIdx=-1,
color=colors[int(class_index)],
thickness=thickness)
cv2.imwrite(img_savename, img)
if __name__ == '__main__':
drawLongsideFormatImg(imgpath='DOTA_demo/images',
txtpath='DOTA_demo/yolo_labels',
dstpath='DOTA_demo/draw_longside_img',
extractclassname=util.classnames_v1_5,
augment=True)
================================================
FILE: ImgSplit.py
================================================
import os
import codecs
import numpy as np
import math
from dota_utils import GetFileFromThisRootDir
import cv2
import shapely.geometry as shgeo
import dota_utils as util
import copy
def choose_best_pointorder_fit_another(poly1, poly2):
"""
To make the two polygons best fit with each point
"""
x1 = poly1[0]
y1 = poly1[1]
x2 = poly1[2]
y2 = poly1[3]
x3 = poly1[4]
y3 = poly1[5]
x4 = poly1[6]
y4 = poly1[7]
combinate = [np.array([x1, y1, x2, y2, x3, y3, x4, y4]), np.array([x2, y2, x3, y3, x4, y4, x1, y1]),
np.array([x3, y3, x4, y4, x1, y1, x2, y2]), np.array([x4, y4, x1, y1, x2, y2, x3, y3])]
dst_coordinate = np.array(poly2)
distances = np.array([np.sum((coord - dst_coordinate)**2) for coord in combinate])
sorted = distances.argsort()
return combinate[sorted[0]]
def cal_line_length(point1, point2):
return math.sqrt( math.pow(point1[0] - point2[0], 2) + math.pow(point1[1] - point2[1], 2))
class splitbase():
def __init__(self,
basepath,
outpath,
code = 'utf-8',
gap=100,
subsize=1024,
thresh=0.7,
choosebestpoint=True,
ext = '.png'
):
"""
:param basepath: base path for dota data
:param outpath: output base path for dota data,
the basepath and outputpath have the similar subdirectory, 'images' and 'labelTxt'
:param code: encodeing format of txt file
:param gap: overlap between two patches
:param subsize: subsize of patch
:param thresh: the thresh determine whether to keep the instance if the instance is cut down in the process of split
:param choosebestpoint: used to choose the first point for the
:param ext: ext for the image format
"""
self.basepath = basepath
self.outpath = outpath
self.code = code
self.gap = gap
self.subsize = subsize
self.slide = self.subsize - self.gap
self.thresh = thresh
self.imagepath = os.path.join(self.basepath, 'images')
self.labelpath = os.path.join(self.basepath, 'labelTxt')
self.outimagepath = os.path.join(self.outpath, 'images')
self.outlabelpath = os.path.join(self.outpath, 'labelTxt')
self.choosebestpoint = choosebestpoint
self.ext = ext
if not os.path.exists(self.outimagepath):
os.makedirs(self.outimagepath)
if not os.path.exists(self.outlabelpath):
os.makedirs(self.outlabelpath)
## point: (x, y), rec: (xmin, ymin, xmax, ymax)
# def __del__(self):
# self.f_sub.close()
## grid --> (x, y) position of grids
def polyorig2sub(self, left, up, poly):
polyInsub = np.zeros(len(poly))
for i in range(int(len(poly)/2)):
polyInsub[i * 2] = int(poly[i * 2] - left)
polyInsub[i * 2 + 1] = int(poly[i * 2 + 1] - up)
return polyInsub
def calchalf_iou(self, poly1, poly2):
"""
It is not the iou on usual, the iou is the value of intersection over poly1
"""
inter_poly = poly1.intersection(poly2)
inter_area = inter_poly.area
poly1_area = poly1.area
half_iou = inter_area / poly1_area
return inter_poly, half_iou
def saveimagepatches(self, img, subimgname, left, up):
subimg = copy.deepcopy(img[up: (up + self.subsize), left: (left + self.subsize)])
outdir = os.path.join(self.outimagepath, subimgname + self.ext)
cv2.imwrite(outdir, subimg)
def GetPoly4FromPoly5(self, poly):
distances = [cal_line_length((poly[i * 2], poly[i * 2 + 1] ), (poly[(i + 1) * 2], poly[(i + 1) * 2 + 1])) for i in range(int(len(poly)/2 - 1))]
distances.append(cal_line_length((poly[0], poly[1]), (poly[8], poly[9])))
pos = np.array(distances).argsort()[0]
count = 0
outpoly = []
while count < 5:
#print('count:', count)
if (count == pos):
outpoly.append((poly[count * 2] + poly[(count * 2 + 2)%10])/2)
outpoly.append((poly[(count * 2 + 1)%10] + poly[(count * 2 + 3)%10])/2)
count = count + 1
elif (count == (pos + 1)%5):
count = count + 1
continue
else:
outpoly.append(poly[count * 2])
outpoly.append(poly[count * 2 + 1])
count = count + 1
return outpoly
def savepatches(self, resizeimg, objects, subimgname, left, up, right, down):
outdir = os.path.join(self.outlabelpath, subimgname + '.txt')
mask_poly = []
imgpoly = shgeo.Polygon([(left, up), (right, up), (right, down),
(left, down)])
with codecs.open(outdir, 'w', self.code) as f_out:
for obj in objects:
gtpoly = shgeo.Polygon([(obj['poly'][0], obj['poly'][1]),
(obj['poly'][2], obj['poly'][3]),
(obj['poly'][4], obj['poly'][5]),
(obj['poly'][6], obj['poly'][7])])
if (gtpoly.area <= 0):
continue
inter_poly, half_iou = self.calchalf_iou(gtpoly, imgpoly)
# print('writing...')
if (half_iou == 1):
polyInsub = self.polyorig2sub(left, up, obj['poly'])
outline = ' '.join(list(map(str, polyInsub)))
outline = outline + ' ' + obj['name'] + ' ' + str(obj['difficult'])
f_out.write(outline + '\n')
elif (half_iou > 0):
#elif (half_iou > self.thresh):
## print('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
inter_poly = shgeo.polygon.orient(inter_poly, sign=1)
out_poly = list(inter_poly.exterior.coords)[0: -1]
if len(out_poly) < 4:
continue
out_poly2 = []
for i in range(len(out_poly)):
out_poly2.append(out_poly[i][0])
out_poly2.append(out_poly[i][1])
if (len(out_poly) == 5):
#print('==========================')
out_poly2 = self.GetPoly4FromPoly5(out_poly2)
elif (len(out_poly) > 5):
"""
if the cut instance is a polygon with points more than 5, we do not handle it currently
"""
continue
if (self.choosebestpoint):
out_poly2 = choose_best_pointorder_fit_another(out_poly2, obj['poly'])
polyInsub = self.polyorig2sub(left, up, out_poly2)
for index, item in enumerate(polyInsub):
if (item <= 1):
polyInsub[index] = 1
elif (item >= self.subsize):
polyInsub[index] = self.subsize
outline = ' '.join(list(map(str, polyInsub)))
if (half_iou > self.thresh):
outline = outline + ' ' + obj['name'] + ' ' + str(obj['difficult'])
else:
## if the left part is too small, label as '2'
outline = outline + ' ' + obj['name'] + ' ' + '2'
f_out.write(outline + '\n')
#else:
# mask_poly.append(inter_poly)
self.saveimagepatches(resizeimg, subimgname, left, up)
def SplitSingle(self, name, rate, extent):
"""
split a single image and ground truth
:param name: image name
:param rate: the resize scale for the image
:param extent: the image format
:return:
"""
img = cv2.imread(os.path.join(self.imagepath, name + extent))
if np.shape(img) == ():
return
fullname = os.path.join(self.labelpath, name + '.txt')
objects = util.parse_dota_poly2(fullname)
for obj in objects:
obj['poly'] = list(map(lambda x:rate*x, obj['poly']))
#obj['poly'] = list(map(lambda x: ([2 * y for y in x]), obj['poly']))
if (rate != 1):
resizeimg = cv2.resize(img, None, fx=rate, fy=rate, interpolation = cv2.INTER_CUBIC)
else:
resizeimg = img
outbasename = name + '__' + str(rate) + '__'
weight = np.shape(resizeimg)[1]
height = np.shape(resizeimg)[0]
left, up = 0, 0
while (left < weight):
if (left + self.subsize >= weight):
left = max(weight - self.subsize, 0)
up = 0
while (up < height):
if (up + self.subsize >= height):
up = max(height - self.subsize, 0)
right = min(left + self.subsize, weight - 1)
down = min(up + self.subsize, height - 1)
subimgname = outbasename + str(left) + '___' + str(up)
# self.f_sub.write(name + ' ' + subimgname + ' ' + str(left) + ' ' + str(up) + '\n')
self.savepatches(resizeimg, objects, subimgname, left, up, right, down)
if (up + self.subsize >= height):
break
else:
up = up + self.slide
if (left + self.subsize >= weight):
break
else:
left = left + self.slide
def splitdata(self, rate):
"""
:param rate: resize rate before cut
"""
imagelist = GetFileFromThisRootDir(self.imagepath)
imagenames = [util.custombasename(x) for x in imagelist if (util.custombasename(x) != 'Thumbs')]
for name in imagenames:
self.SplitSingle(name, rate, self.ext)
if __name__ == '__main__':
# example usage of ImgSplit
split = splitbase(r'example',
r'examplesplit')
split.splitdata(1)
================================================
FILE: ImgSplit_multi_process.py
================================================
# coding=gbk
"""
-------------
This is the multi-process version
"""
import os
import codecs
import numpy as np
import math
from dota_utils import GetFileFromThisRootDir
import cv2
import shapely.geometry as shgeo
import dota_utils as util
import copy
from multiprocessing import Pool
from functools import partial
import time
def choose_best_pointorder_fit_another(poly1, poly2):
"""
To make the two polygons best fit with each point
"""
x1 = poly1[0]
y1 = poly1[1]
x2 = poly1[2]
y2 = poly1[3]
x3 = poly1[4]
y3 = poly1[5]
x4 = poly1[6]
y4 = poly1[7]
combinate = [np.array([x1, y1, x2, y2, x3, y3, x4, y4]), np.array([x2, y2, x3, y3, x4, y4, x1, y1]),
np.array([x3, y3, x4, y4, x1, y1, x2, y2]), np.array([x4, y4, x1, y1, x2, y2, x3, y3])]
dst_coordinate = np.array(poly2)
distances = np.array([np.sum((coord - dst_coordinate)**2) for coord in combinate])
sorted = distances.argsort()
return combinate[sorted[0]]
def cal_line_length(point1, point2):
return math.sqrt( math.pow(point1[0] - point2[0], 2) + math.pow(point1[1] - point2[1], 2))
def split_single_warp(name, split_base, rate, extent):
split_base.SplitSingle(name, rate, extent)
class splitbase():
def __init__(self,
basepath,
outpath,
code = 'utf-8',
gap=512,
subsize=1024,
thresh=0.7,
choosebestpoint=True,
ext = '.png',
padding=True,
num_process=8
):
"""
:param basepath: base path for dota data ָļ
:param outpath: output base path for dota data, ָͼƬļ
the basepath and outputpath have the similar subdirectory, 'images' and 'labelTxt'
:param code: encodeing format of txt file
:param gap: overlap between two patches ͼƬ֮ص
:param subsize: subsize of patch
:param thresh: the thresh determine whether to keep the instance if the instance is cut down in the process of split
:param choosebestpoint: used to choose the first point for the
:param ext: ext for the image format
:param padding: if to padding the images so that all the images have the same size
"""
self.basepath = basepath
self.outpath = outpath
self.code = code
self.gap = gap
self.subsize = subsize
self.slide = self.subsize - self.gap
self.thresh = thresh
self.imagepath = os.path.join(self.basepath, 'images')
self.labelpath = os.path.join(self.basepath, 'labelTxt')
self.outimagepath = os.path.join(self.outpath, 'images')
self.outlabelpath = os.path.join(self.outpath, 'labelTxt')
self.choosebestpoint = choosebestpoint
self.ext = ext
self.padding = padding
self.num_process = num_process
self.pool = Pool(num_process)
print('padding:', padding)
# pdb.set_trace()
if not os.path.isdir(self.outpath):
os.mkdir(self.outpath)
if not os.path.isdir(self.outimagepath):
# pdb.set_trace()
os.mkdir(self.outimagepath)
if not os.path.isdir(self.outlabelpath):
os.mkdir(self.outlabelpath)
# pdb.set_trace()
## point: (x, y), rec: (xmin, ymin, xmax, ymax)
# def __del__(self):
# self.f_sub.close()
## grid --> (x, y) position of grids
def polyorig2sub(self, left, up, poly):
polyInsub = np.zeros(len(poly))
for i in range(int(len(poly)/2)):
polyInsub[i * 2] = int(poly[i * 2] - left)
polyInsub[i * 2 + 1] = int(poly[i * 2 + 1] - up)
return polyInsub
def calchalf_iou(self, poly1, poly2):
"""
It is not the iou on usual, the iou is the value of intersection over poly1
"""
inter_poly = poly1.intersection(poly2)
inter_area = inter_poly.area
poly1_area = poly1.area
half_iou = inter_area / poly1_area
return inter_poly, half_iou
def saveimagepatches(self, img, subimgname, left, up):
subimg = copy.deepcopy(img[up: (up + self.subsize), left: (left + self.subsize)])
outdir = os.path.join(self.outimagepath, subimgname + self.ext)
h, w, c = np.shape(subimg)
if (self.padding):
outimg = np.zeros((self.subsize, self.subsize, 3))
outimg[0:h, 0:w, :] = subimg
cv2.imwrite(outdir, outimg)
else:
cv2.imwrite(outdir, subimg)
def GetPoly4FromPoly5(self, poly):
distances = [cal_line_length((poly[i * 2], poly[i * 2 + 1] ), (poly[(i + 1) * 2], poly[(i + 1) * 2 + 1])) for i in range(int(len(poly)/2 - 1))]
distances.append(cal_line_length((poly[0], poly[1]), (poly[8], poly[9])))
pos = np.array(distances).argsort()[0]
count = 0
outpoly = []
while count < 5:
#print('count:', count)
if (count == pos):
outpoly.append((poly[count * 2] + poly[(count * 2 + 2)%10])/2)
outpoly.append((poly[(count * 2 + 1)%10] + poly[(count * 2 + 3)%10])/2)
count = count + 1
elif (count == (pos + 1)%5):
count = count + 1
continue
else:
outpoly.append(poly[count * 2])
outpoly.append(poly[count * 2 + 1])
count = count + 1
return outpoly
def savepatches(self, resizeimg, objects, subimgname, left, up, right, down):
outdir = os.path.join(self.outlabelpath, subimgname + '.txt')
mask_poly = []
imgpoly = shgeo.Polygon([(left, up), (right, up), (right, down),
(left, down)])
with codecs.open(outdir, 'w', self.code) as f_out:
for obj in objects:
gtpoly = shgeo.Polygon([(obj['poly'][0], obj['poly'][1]),
(obj['poly'][2], obj['poly'][3]),
(obj['poly'][4], obj['poly'][5]),
(obj['poly'][6], obj['poly'][7])])
if (gtpoly.area <= 0):
continue
inter_poly, half_iou = self.calchalf_iou(gtpoly, imgpoly)
# print('writing...')
if (half_iou == 1):
polyInsub = self.polyorig2sub(left, up, obj['poly'])
outline = ' '.join(list(map(str, polyInsub)))
outline = outline + ' ' + obj['name'] + ' ' + str(obj['difficult'])
f_out.write(outline + '\n')
elif (half_iou > 0):
#elif (half_iou > self.thresh):
## print('<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<')
inter_poly = shgeo.polygon.orient(inter_poly, sign=1)
out_poly = list(inter_poly.exterior.coords)[0: -1]
if len(out_poly) < 4:
continue
out_poly2 = []
for i in range(len(out_poly)):
out_poly2.append(out_poly[i][0])
out_poly2.append(out_poly[i][1])
if (len(out_poly) == 5):
#print('==========================')
out_poly2 = self.GetPoly4FromPoly5(out_poly2)
elif (len(out_poly) > 5):
"""
if the cut instance is a polygon with points more than 5, we do not handle it currently
"""
continue
if (self.choosebestpoint):
out_poly2 = choose_best_pointorder_fit_another(out_poly2, obj['poly'])
polyInsub = self.polyorig2sub(left, up, out_poly2)
for index, item in enumerate(polyInsub):
if (item <= 1):
polyInsub[index] = 1
elif (item >= self.subsize):
polyInsub[index] = self.subsize
outline = ' '.join(list(map(str, polyInsub)))
if (half_iou > self.thresh):
outline = outline + ' ' + obj['name'] + ' ' + str(obj['difficult'])
else:
## if the left part is too small, label as '2'
outline = outline + ' ' + obj['name'] + ' ' + '2'
f_out.write(outline + '\n')
#else:
# mask_poly.append(inter_poly)
self.saveimagepatches(resizeimg, subimgname, left, up)
def SplitSingle(self, name, rate, extent):
"""
split a single image and ground truth
:param name: image name
:param rate: the resize scale for the image
:param extent: the image format
:return:
"""
img = cv2.imread(os.path.join(self.imagepath, name + extent))
if np.shape(img) == ():
return
fullname = os.path.join(self.labelpath, name + '.txt')
objects = util.parse_dota_poly2(fullname)
for obj in objects:
obj['poly'] = list(map(lambda x:rate*x, obj['poly']))
#obj['poly'] = list(map(lambda x: ([2 * y for y in x]), obj['poly']))
if (rate != 1):
resizeimg = cv2.resize(img, None, fx=rate, fy=rate, interpolation = cv2.INTER_CUBIC)
else:
resizeimg = img
outbasename = name + '__' + str(rate) + '__'
weight = np.shape(resizeimg)[1]
height = np.shape(resizeimg)[0]
left, up = 0, 0
while (left < weight):
if (left + self.subsize >= weight):
left = max(weight - self.subsize, 0)
up = 0
while (up < height):
if (up + self.subsize >= height):
up = max(height - self.subsize, 0)
right = min(left + self.subsize, weight - 1)
down = min(up + self.subsize, height - 1)
subimgname = outbasename + str(left) + '___' + str(up)
# self.f_sub.write(name + ' ' + subimgname + ' ' + str(left) + ' ' + str(up) + '\n')
self.savepatches(resizeimg, objects, subimgname, left, up, right, down)
if (up + self.subsize >= height):
break
else:
up = up + self.slide
if (left + self.subsize >= weight):
break
else:
left = left + self.slide
def splitdata(self, rate):
"""
:param rate: resize rate before cut
"""
imagelist = GetFileFromThisRootDir(self.imagepath)
imagenames = [util.custombasename(x) for x in imagelist if (util.custombasename(x) != 'Thumbs')]
if self.num_process == 1:
for name in imagenames:
self.SplitSingle(name, rate, self.ext)
else:
# worker = partial(self.SplitSingle, rate=rate, extent=self.ext)
worker = partial(split_single_warp, split_base=self, rate=rate, extent=self.ext)
self.pool.map(worker, imagenames)
def __getstate__(self):
self_dict = self.__dict__.copy()
del self_dict['pool']
return self_dict
def __setstate__(self, state):
self.__dict__.update(state)
if __name__ == '__main__':
# example usage of ImgSplit
# start = time.clock()
# split = splitbase(r'/data/dj/dota/val',
# r'/data/dj/dota/val_1024_debugmulti-process_refactor') # time cost 19s
# # split.splitdata(1)
# # split.splitdata(2)
# split.splitdata(0.4)
#
# elapsed = (time.clock() - start)
# print("Time used:", elapse
#
#
# d)
split = splitbase(r'example',
r'example_split',
gap=200, # ص
subsize=1024, # ָɵСͼƬsize
num_process=8
)
split.splitdata(1) # resize rate before cut
================================================
FILE: README.md
================================================
## Brief Introduction
Based on [DOTA_devkit](https://github.com/CAPTAIN-WHU/DOTA_devkit).
Add some modules to trans DOTA annotation format to YOLO annotation format.
Add some files for every demo.
## Fuction
* `DOTA.py` Load image, and show the bounding oriented box.
* `ImgSplit.py` Split image and the label.
* `ResultMerge.py` Merge the detection result annotation txt.
* `dota_×_evaluation_task×.py` Evaluate the detection result annotation txt.
* `YOLO_Transformer.py` Trans DOTA format to YOLO(OBB or HBB) format.
* `Draw_DOTA_YOLO.py` Picture the YOLO_OBB labels(after augmented).
## Installation
Same as [DOTA_devkit](https://github.com/CAPTAIN-WHU/DOTA_devkit). Then:
```
$ pip install -r requirements.txt
```
## More detailed explanation
想要了解这几个函数实现的细节和原理可以看我的知乎文章;
[DOTA遥感数据集以及相关工具DOTA_devkit的整理(踩坑记录)](https://zhuanlan.zhihu.com/p/355862906);
[DOTA数据格式转YOLO数据格式工具(cv2.minAreaRect踩坑记录)](https://zhuanlan.zhihu.com/p/356416158);
## Usage Example
* `DOTA.py`
```javascript
$ python DOTA.py
```


* `ImgSplit.py`
```javascript
$ python ImgSplit_multi_process.py
```


* `ResultMerge.py`
```javascript
$ python ResultMerge.py
```



* `dota_v1.5_evaluation_task1.py`
change the path with yours.
```javascript
detpath = r'/.../evaluation_example/result_classname/Task1_{:s}.txt'
annopath = r'/.../evaluation_example/row_DOTA_labels/{:s}.txt'
imagesetfile = r'/.../evaluation_example/imgnamefile.txt'
```
```javascript
$ python dota_v1.5_evaluation_task1.py
```
* `YOLO_Transform.py`
```javascript
$ python YOLO_Transform.py
```
```javascript
DOTA format: poly classname diffcult
To
YOLO HBB format: classid x_c y_c width height —— def dota2Darknet()
longside format: classid x_c y_c longside shortside Θ Θ∈[0, 180) —— def dota2LongSideFormat()
```
* `Draw_DOTA_YOLO.py`
1.Run YOLO_Transformer.py to get the YOLO_OBB_labels first.
2.then augment YOLO_OBB_labels and visualize it:
```javascript
$ Draw_DOTA_YOLO.py
```

## 有问题反馈
在使用中有任何问题,欢迎反馈给我,可以用以下联系方式跟我交流
* 知乎(@[略略略](https://www.zhihu.com/people/lue-lue-lue-3-92-86))
* 代码问题提issues,其他问题请知乎上联系
## 感激
感谢以下的项目,排名不分先后
* [DOTA_devkit](https://github.com/CAPTAIN-WHU/DOTA_devkit)
## 关于作者
```javascript
Name : "胡凯旋"
describe myself:"咸鱼一枚"
```
================================================
FILE: ResultMerge.py
================================================
# -*- coding: utf-8 -*-
"""
To use the code, users should to config detpath, annopath and imagesetfile
detpath is the path for 15 result files, for the format, you can refer to "http://captain.whu.edu.cn/DOTAweb/tasks.html"
search for PATH_TO_BE_CONFIGURED to config the paths
Note, the evaluation is on the large scale images
"""
import os
import numpy as np
import dota_utils as util
import re
import time
import polyiou
## the IoU thresh for nms when merge image
nms_thresh = 0.3
def py_cpu_nms_poly(dets, thresh):
"""
任意四点poly nms.取出nms后的边框的索引
@param dets: shape(detection_num, [poly, confidence1]) 原始图像中的检测出的目标数量
@param thresh:
@return:
keep: 经nms后的目标边框的索引
"""
scores = dets[:, 8]
polys = []
areas = []
for i in range(len(dets)):
tm_polygon = polyiou.VectorDouble([dets[i][0], dets[i][1],
dets[i][2], dets[i][3],
dets[i][4], dets[i][5],
dets[i][6], dets[i][7]])
polys.append(tm_polygon)
# argsort将元素小到大排列 返回索引值 [::-1]即从后向前取元素
order = scores.argsort()[::-1] # 取出元素的索引值 顺序为从大到小
keep = []
while order.size > 0:
ovr = []
i = order[0] # 取出当前剩余置信度最大的目标边框的索引
keep.append(i)
for j in range(order.size - 1): # 求出置信度最大poly与其他所有poly的IoU
iou = polyiou.iou_poly(polys[i], polys[order[j + 1]])
ovr.append(iou)
ovr = np.array(ovr)
inds = np.where(ovr <= thresh)[0] # 找出iou小于阈值的索引
order = order[inds + 1]
return keep
def py_cpu_nms(dets, thresh):
"""Pure Python NMS baseline."""
#print('dets:', dets)
x1 = dets[:, 0]
y1 = dets[:, 1]
x2 = dets[:, 2]
y2 = dets[:, 3]
scores = dets[:, 4]
areas = (x2 - x1 + 1) * (y2 - y1 + 1)
## index for dets
order = scores.argsort()[::-1]
keep = []
while order.size > 0:
i = order[0]
keep.append(i)
xx1 = np.maximum(x1[i], x1[order[1:]])
yy1 = np.maximum(y1[i], y1[order[1:]])
xx2 = np.minimum(x2[i], x2[order[1:]])
yy2 = np.minimum(y2[i], y2[order[1:]])
w = np.maximum(0.0, xx2 - xx1 + 1)
h = np.maximum(0.0, yy2 - yy1 + 1)
inter = w * h
ovr = inter / (areas[i] + areas[order[1:]] - inter)
inds = np.where(ovr <= thresh)[0]
order = order[inds + 1]
return keep
def nmsbynamedict(nameboxdict, nms, thresh):
"""
对namedict中的目标信息进行nms.不改变输入的数据形式
@param nameboxdict: eg:{
'P706':[[poly1, confidence1], ..., [poly9, confidence9]],
...
'P700':[[poly1, confidence1], ..., [poly9, confidence9]]
}
@param nms:
@param thresh: nms阈值, IoU阈值
@return:
nameboxnmsdict: eg:{
'P706':[[poly1, confidence1], ..., [poly_nms, confidence9]],
...
'P700':[[poly1, confidence1], ..., [poly_nms, confidence9]]
}
"""
# 初始化字典
nameboxnmsdict = {x: [] for x in nameboxdict} # eg: nameboxnmsdict={'P0770': [], 'P1888': []}
for imgname in nameboxdict: # 提取nameboxdict中的key eg:P0770 P1888
keep = nms(np.array(nameboxdict[imgname]), thresh) # rotated_nms索引值列表
outdets = []
#print('nameboxdict[imgname]: ', nameboxnmsdict[imgname])
for index in keep:
# print('index:', index)
outdets.append(nameboxdict[imgname][index])
nameboxnmsdict[imgname] = outdets
return nameboxnmsdict
def poly2origpoly(poly, x, y, rate):
origpoly = []
for i in range(int(len(poly)/2)):
tmp_x = float(poly[i * 2] + x) / float(rate)
tmp_y = float(poly[i * 2 + 1] + y) / float(rate)
origpoly.append(tmp_x)
origpoly.append(tmp_y)
return origpoly
def mergebase(srcpath, dstpath, nms):
"""
将源路径中所有的txt目标信息,经nms后存入目标路径中的同名txt
@param srcpath: 合并前信息保存的txt源路径
@param dstpath: 合并后信息保存的txt目标路径
@param nms: NMS函数
"""
filelist = util.GetFileFromThisRootDir(srcpath) # srcpath文件夹下的所有文件相对路径 eg:['example_split/../P0001.txt', ..., '?.txt']
for fullname in filelist: # 'example_split/../P0001.txt'
name = util.custombasename(fullname) # 只留下文件名 eg:P0001
dstname = os.path.join(dstpath, name + '.txt') # eg: example_merge/..P0001.txt
if not os.path.exists(dstpath):
os.makedirs(dstpath)
with open(fullname, 'r') as f_in:
nameboxdict = {}
lines = f_in.readlines() # 读取txt中所有行,每行作为一个元素存于list中
splitlines = [x.strip().split(' ') for x in lines] # 再次分割list中的每行元素 shape:n行 * m个元素
for splitline in splitlines: # splitline:每行中的m个元素
# splitline = [待merge图片名(该目标所处图片名称), confidence, x1, y1, x2, y2, x3, y3, x4, y4]
subname = splitline[0] # 每行的第一个元素 是被分割的图片的图片名 eg:P0706__1__0___0
splitname = subname.split('__') # 分割待merge的图像的名称 eg:['P0706','1','0','_0']
oriname = splitname[0] # 获得待merge图像的原图像名称 eg:P706
pattern1 = re.compile(r'__\d+___\d+') # 预先编译好r'__\d+___\d+' 提高重复使用效率 \d表示数字
x_y = re.findall(pattern1, subname) # 匹配subname中的字符串 eg: x_y=['__0___0']
x_y_2 = re.findall(r'\d+', x_y[0]) # 匹配subname中的字符串 eg: x_y_2= ['0','0']
x, y = int(x_y_2[0]), int(x_y_2[1]) # 找到当前subname图片在原图中的分割位置
pattern2 = re.compile(r'__([\d+\.]+)__\d+___') # \.表示一切字符
rate = re.findall(pattern2, subname)[0] # 找到该subname分割图片时的分割rate (resize rate before cut)
confidence = splitline[1]
poly = list(map(float, splitline[2:])) # 每个元素映射为浮点数 再放入列表中
origpoly = poly2origpoly(poly, x, y, rate) # 将目标位置信息resize 恢复成原图的poly坐标
det = origpoly # shape(8)
det.append(confidence) # [poly, confidence]
det = list(map(float, det))
if (oriname not in nameboxdict):
nameboxdict[oriname] = [] # 弄个元组,汇集原图目标信息 eg: 'P706':[[poly1, confidence1], ..., ]
nameboxdict[oriname].append(det)
nameboxnmsdict = nmsbynamedict(nameboxdict, nms, nms_thresh) # 对nameboxdict元组进行nms
with open(dstname, 'w') as f_out:
for imgname in nameboxnmsdict:
for det in nameboxnmsdict[imgname]: # 取出对应图片的nms后的目标信息
#print('det:', det)
confidence = det[-1]
bbox = det[0:-1]
outline = imgname + ' ' + str(confidence) + ' ' + ' '.join(map(str, bbox))
#print('outline:', outline)
f_out.write(outline + '\n')
def mergebyrec(srcpath, dstpath):
"""
srcpath: result files before merge and nms
dstpath: result files after merge and nms
"""
# srcpath = r'E:\bod-dataset\results\bod-v3_rfcn_2000000'
# dstpath = r'E:\bod-dataset\results\bod-v3_rfcn_2000000_nms'
mergebase(srcpath,
dstpath,
py_cpu_nms)
def mergebypoly(srcpath, dstpath):
"""
srcpath: result files before merge and nms.txt的信息格式为:[P0770__1__0___0 confidence poly]
dstpath: result files after merge and nms.保存的txt信息格式为:[P0770 confidence poly]
"""
# srcpath = r'/home/dingjian/evaluation_task1/result/faster-rcnn-59/comp4_test_results'
# dstpath = r'/home/dingjian/evaluation_task1/result/faster-rcnn-59/testtime'
mergebase(srcpath,
dstpath,
py_cpu_nms_poly)
if __name__ == '__main__':
# see demo for example
mergebypoly(r'ResultMerge_example', r'ResultMerge_example_result')
# mergebyrec()
================================================
FILE: ResultMerge_example/1.txt
================================================
P0770__1__0___0 0.9 856.0 696.0 1024.0 781.0 1024.0 1024.0 752.0 1006.0
P0770__1__0___0 0.9 349.0 491.0 388.0 508.0 353.0 591.0 313.0 573.0
P0770__1__0___0 0.9 346.0 362.0 362.0 369.0 345.0 405.0 328.0 398.0
P0770__1__0___0 0.9 248.0 577.0 330.0 613.0 314.0 652.0 231.0 614.0
P0770__1__0___0 0.9 543.0 66.0 560.0 76.0 540.0 115.0 521.0 104.0
P0770__1__0___0 0.9 283.0 491.0 306.0 490.0 305.0 534.0 282.0 533.0
P0770__1__0___0 0.9 244.0 643.0 292.0 664.0 278.0 694.0 231.0 672.0
P0770__1__0___0 0.9 210.0 686.0 254.0 704.0 247.0 720.0 204.0 702.0
P0770__1__0___0 0.9 223.0 1010.0 240.0 1018.0 237.0 1024.0 217.0 1024.0
P0770__1__0___0 0.9 1013.0 345.0 1024.0 391.0 999.0 440.0 962.0 420.0
P0770__1__0___0 0.9 941.0 310.0 978.0 329.0 939.0 409.0 900.0 390.0
P0770__1__0___0 0.9 879.0 279.0 918.0 299.0 878.0 379.0 839.0 359.0
P0770__1__0___0 0.9 819.0 249.0 857.0 269.0 816.0 349.0 779.0 329.0
P0770__1__0___0 0.9 757.0 219.0 795.0 238.0 756.0 319.0 718.0 299.0
P0770__1__0___0 0.9 697.0 189.0 735.0 208.0 695.0 290.0 657.0 269.0
P0770__1__0___0 0.9 638.0 351.0 781.0 422.0 716.0 567.0 565.0 498.0
P0770__1__0___0 0.9 394.0 825.0 466.0 690.0 600.0 762.0 528.0 905.0
P0770__1__0___0 0.9 653.0 795.0 747.0 845.0 698.0 936.0 602.0 890.0
P0770__1__0___0 0.9 496.0 148.0 535.0 166.0 498.0 247.0 459.0 230.0
P0770__1__586___334 0.8 856.0 362.0 1024.0 447.0 1024.0 806.0 716.0 654.0
P0770__1__586___334 0.8 349.0 157.0 388.0 174.0 353.0 257.0 313.0 239.0
P0770__1__586___334 0.8 346.0 28.0 362.0 35.0 345.0 71.0 328.0 64.0
P0770__1__586___334 0.8 248.0 243.0 330.0 279.0 314.0 318.0 231.0 280.0
P0770__1__586___334 0.8 283.0 157.0 306.0 156.0 305.0 200.0 282.0 199.0
P0770__1__586___334 0.8 244.0 309.0 292.0 330.0 278.0 360.0 231.0 338.0
P0770__1__586___334 0.8 210.0 352.0 254.0 370.0 247.0 386.0 204.0 368.0
P0770__1__586___334 0.8 223.0 676.0 240.0 684.0 226.0 716.0 209.0 709.0
P0770__1__586___334 0.8 14.0 757.0 56.0 774.0 45.0 797.0 5.0 778.0
P0770__1__586___334 0.8 125.0 906.0 142.0 913.0 130.0 948.0 113.0 941.0
P0770__1__586___334 0.8 1013.0 11.0 1024.0 57.0 999.0 106.0 962.0 86.0
P0770__1__586___334 0.8 928.0 1.0 975.0 1.0 939.0 75.0 900.0 56.0
P0770__1__586___334 0.8 851.0 1.0 900.0 1.0 878.0 45.0 839.0 25.0
P0770__1__586___334 0.8 638.0 17.0 781.0 88.0 716.0 233.0 565.0 164.0
P0770__1__586___334 0.8 394.0 491.0 466.0 356.0 600.0 428.0 528.0 571.0
P0770__1__586___334 0.8 653.0 461.0 747.0 511.0 698.0 602.0 602.0 556.0
P0770__1__586___0 0.7 270.0 696.0 879.0 1016.0 202.0 1024.0 130.0 988.0
P0770__1__586___0 0.7 562.0 658.0 669.0 711.0 631.0 787.0 524.0 735.0
P0770__1__586___0 0.7 416.0 339.0 454.0 360.0 413.0 440.0 376.0 420.0
P0770__1__586___0 0.7 355.0 310.0 392.0 329.0 353.0 409.0 314.0 390.0
P0770__1__586___0 0.7 293.0 279.0 332.0 299.0 292.0 379.0 253.0 359.0
P0770__1__586___0 0.7 233.0 249.0 271.0 269.0 230.0 349.0 193.0 329.0
P0770__1__586___0 0.7 171.0 219.0 209.0 238.0 170.0 319.0 132.0 299.0
P0770__1__586___0 0.7 111.0 189.0 149.0 208.0 109.0 290.0 71.0 269.0
P0770__1__586___0 0.7 52.0 351.0 195.0 422.0 130.0 567.0 1.0 481.0
P0770__1__586___0 0.7 67.0 795.0 161.0 845.0 112.0 936.0 16.0 890.0
P0770__1__586___334 0.6 270.0 362.0 883.0 674.0 755.0 964.0 130.0 654.0
P0770__1__586___334 0.6 562.0 324.0 669.0 377.0 631.0 453.0 524.0 401.0
P0770__1__586___334 0.6 416.0 5.0 454.0 26.0 413.0 106.0 376.0 86.0
P0770__1__586___334 0.6 342.0 1.0 389.0 1.0 353.0 75.0 314.0 56.0
P0770__1__586___334 0.6 265.0 1.0 314.0 1.0 292.0 45.0 253.0 25.0
P0770__1__586___334 0.6 52.0 17.0 195.0 88.0 130.0 233.0 1.0 147.0
P0770__1__586___334 0.6 67.0 461.0 161.0 511.0 112.0 602.0 16.0 556.0
P1888__1__0___0 0.5 674.0 375.0 683.0 375.0 684.0 394.0 675.0 395.0
P1888__1__0___0 0.5 683.0 351.0 694.0 351.0 695.0 371.0 684.0 371.0
P1888__1__0___0 0.5 465.0 371.0 455.0 372.0 451.0 324.0 460.0 323.0
P1888__1__0___0 0.5 451.0 374.0 441.0 375.0 436.0 327.0 445.0 326.0
P1888__1__0___0 0.5 439.0 373.0 429.0 374.0 422.0 327.0 433.0 326.0
P1888__1__0___0 0.5 426.0 376.0 415.0 378.0 408.0 330.0 418.0 328.0
P1888__1__0___0 0.5 411.0 377.0 400.0 379.0 395.0 332.0 405.0 330.0
P1888__1__0___0 0.5 398.0 377.0 388.0 379.0 382.0 331.0 392.0 330.0
P1888__1__0___0 0.5 384.0 382.0 374.0 383.0 368.0 334.0 377.0 333.0
P1888__1__0___0 0.5 370.0 382.0 360.0 383.0 355.0 336.0 364.0 335.0
P1888__1__0___0 0.5 354.0 384.0 345.0 383.0 341.0 337.0 352.0 336.0
P1888__1__0___0 0.5 328.0 387.0 318.0 388.0 312.0 342.0 323.0 340.0
P1888__1__0___0 0.5 316.0 389.0 307.0 392.0 300.0 344.0 308.0 342.0
P1888__1__0___0 0.5 302.0 390.0 292.0 392.0 286.0 343.0 296.0 342.0
P1888__1__0___0 0.5 288.0 394.0 278.0 394.0 273.0 346.0 281.0 345.0
P1888__1__0___0 0.5 531.0 213.0 520.0 215.0 518.0 180.0 528.0 179.0
P1888__1__0___0 0.5 517.0 213.0 507.0 215.0 502.0 174.0 512.0 172.0
P1888__1__0___0 0.5 504.0 216.0 494.0 217.0 490.0 176.0 498.0 174.0
P1888__1__0___0 0.5 490.0 216.0 481.0 217.0 474.0 176.0 484.0 174.0
P1888__1__0___0 0.5 480.0 245.0 470.0 246.0 466.0 205.0 475.0 203.0
P1888__1__0___0 0.5 467.0 248.0 457.0 249.0 453.0 207.0 462.0 205.0
P1888__1__0___0 0.5 454.0 248.0 445.0 249.0 441.0 208.0 450.0 207.0
P1888__1__0___0 0.5 441.0 250.0 431.0 251.0 427.0 209.0 437.0 208.0
P1888__1__0___0 0.5 419.0 253.0 409.0 254.0 402.0 212.0 410.0 210.0
P1888__1__0___0 0.5 382.0 259.0 372.0 261.0 366.0 219.0 376.0 218.0
P1888__1__0___0 0.5 368.0 260.0 359.0 261.0 353.0 218.0 362.0 217.0
P1888__1__0___0 0.5 356.0 259.0 347.0 261.0 339.0 220.0 348.0 219.0
P1888__1__0___0 0.5 343.0 262.0 334.0 265.0 327.0 222.0 335.0 221.0
P1888__1__0___0 0.5 319.0 266.0 310.0 268.0 304.0 225.0 314.0 223.0
P1888__1__0___0 0.5 307.0 268.0 297.0 269.0 292.0 227.0 301.0 226.0
P1888__1__0___0 0.5 294.0 261.0 284.0 264.0 277.0 221.0 287.0 220.0
P1888__1__0___0 0.5 480.0 369.0 469.0 371.0 463.0 321.0 473.0 320.0
P1888__1__0___0 0.5 493.0 367.0 483.0 368.0 476.0 321.0 486.0 319.0
P1888__1__0___0 0.5 507.0 365.0 498.0 368.0 489.0 320.0 499.0 318.0
P1888__1__0___0 0.5 457.0 442.0 468.0 443.0 470.0 485.0 461.0 486.0
P1888__1__0___0 0.5 681.0 369.0 672.0 369.0 671.0 351.0 680.0 351.0
P1888__1__0___0 0.5 654.0 374.0 664.0 374.0 665.0 395.0 654.0 396.0
P1888__1__0___0 0.5 697.0 281.0 706.0 280.0 707.0 300.0 698.0 300.0
P1888__1__0___0 0.5 687.0 281.0 697.0 280.0 698.0 299.0 688.0 299.0
P1888__1__0___0 0.5 677.0 282.0 687.0 282.0 688.0 302.0 678.0 303.0
P1888__1__0___0 0.5 667.0 286.0 676.0 285.0 677.0 303.0 669.0 304.0
P1888__1__0___0 0.5 657.0 287.0 666.0 286.0 667.0 306.0 657.0 307.0
P1888__1__0___0 0.5 696.0 263.0 705.0 261.0 707.0 280.0 698.0 280.0
P1888__1__0___0 0.5 686.0 260.0 695.0 259.0 695.0 278.0 687.0 278.0
P1888__1__0___0 0.5 665.0 262.0 675.0 261.0 676.0 280.0 667.0 281.0
P1888__1__0___0 0.5 656.0 262.0 665.0 263.0 666.0 284.0 656.0 284.0
P1888__1__0___0 0.5 645.0 267.0 654.0 267.0 655.0 285.0 646.0 285.0
P1888__1__0___0 0.5 469.0 442.0 479.0 441.0 485.0 484.0 474.0 485.0
P1888__1__0___0 0.5 443.0 444.0 454.0 444.0 458.0 487.0 448.0 488.0
P1888__1__0___0 0.5 520.0 362.0 511.0 364.0 503.0 316.0 513.0 315.0
P1888__1__0___0 0.5 430.0 446.0 440.0 445.0 446.0 489.0 436.0 490.0
P1888__1__0___0 0.5 419.0 450.0 430.0 450.0 436.0 495.0 425.0 497.0
P1888__1__0___0 0.5 406.0 451.0 416.0 451.0 421.0 495.0 410.0 495.0
P1888__1__0___0 0.5 394.0 454.0 403.0 453.0 409.0 496.0 400.0 497.0
P1888__1__0___0 0.5 381.0 455.0 393.0 455.0 396.0 496.0 386.0 498.0
P1888__1__0___0 0.5 368.0 452.0 379.0 452.0 383.0 496.0 373.0 497.0
P1888__1__0___0 0.5 354.0 455.0 365.0 454.0 371.0 497.0 360.0 498.0
P1888__1__0___0 0.5 343.0 455.0 354.0 455.0 358.0 498.0 347.0 498.0
P1888__1__0___0 0.5 316.0 458.0 327.0 456.0 335.0 499.0 325.0 502.0
P1888__1__0___0 0.5 304.0 463.0 315.0 461.0 320.0 505.0 310.0 506.0
P1888__1__0___0 0.5 293.0 463.0 303.0 462.0 308.0 505.0 298.0 506.0
P1888__1__0___0 0.5 281.0 466.0 291.0 464.0 296.0 508.0 286.0 508.0
P1888__1__0___0 0.5 200.0 449.0 210.0 450.0 210.0 493.0 200.0 492.0
P1888__1__0___0 0.5 197.0 200.0 207.0 200.0 208.0 242.0 198.0 243.0
================================================
FILE: ResultMerge_multi_process.py
================================================
"""
To use the code, users should to config detpath, annopath and imagesetfile
detpath is the path for 15 result files, for the format, you can refer to "http://captain.whu.edu.cn/DOTAweb/tasks.html"
search for PATH_TO_BE_CONFIGURED to config the paths
Note, the evaluation is on the large scale images
"""
import os
import numpy as np
import re
import time
import sys
sys.path.insert(0,'..')
try:
import dota_utils as util
except:
import dota_kit.dota_utils as util
import polyiou
import pdb
import math
from multiprocessing import Pool
from functools import partial
## the thresh for nms when merge image
nms_thresh = 0.1
def py_cpu_nms_poly(dets, thresh):
scores = dets[:, 8]
polys = []
areas = []
for i in range(len(dets)):
tm_polygon = polyiou.VectorDouble([dets[i][0], dets[i][1],
dets[i][2], dets[i][3],
dets[i][4], dets[i][5],
dets[i][6], dets[i][7]])
polys.append(tm_polygon)
order = scores.argsort()[::-1]
keep = []
while order.size > 0:
ovr = []
i = order[0]
keep.append(i)
for j in range(order.size - 1):
iou = polyiou.iou_poly(polys[i], polys[order[j + 1]])
ovr.append(iou)
ovr = np.array(ovr)
# print('ovr: ', ovr)
# print('thresh: ', thresh)
try:
if math.isnan(ovr[0]):
pdb.set_trace()
except:
pass
inds = np.where(ovr <= thresh)[0]
# print('inds: ', inds)
order = order[inds + 1]
return keep
def py_cpu_nms_poly_fast(dets, thresh):
obbs = dets[:, 0:-1]
x1 = np.min(obbs[:, 0::2], axis=1)
y1 = np.min(obbs[:, 1::2], axis=1)
x2 = np.max(obbs[:, 0::2], axis=1)
y2 = np.max(obbs[:, 1::2], axis=1)
scores = dets[:, 8]
areas = (x2 - x1 + 1) * (y2 - y1 + 1)
polys = []
for i in range(len(dets)):
tm_polygon = polyiou.VectorDouble([dets[i][0], dets[i][1],
dets[i][2], dets[i][3],
dets[i][4], dets[i][5],
dets[i][6], dets[i][7]])
polys.append(tm_polygon)
order = scores.argsort()[::-1]
keep = []
while order.size > 0:
ovr = []
i = order[0]
keep.append(i)
# if order.size == 0:
# break
xx1 = np.maximum(x1[i], x1[order[1:]])
yy1 = np.maximum(y1[i], y1[order[1:]])
xx2 = np.minimum(x2[i], x2[order[1:]])
yy2 = np.minimum(y2[i], y2[order[1:]])
# w = np.maximum(0.0, xx2 - xx1 + 1)
# h = np.maximum(0.0, yy2 - yy1 + 1)
w = np.maximum(0.0, xx2 - xx1)
h = np.maximum(0.0, yy2 - yy1)
hbb_inter = w * h
hbb_ovr = hbb_inter / (areas[i] + areas[order[1:]] - hbb_inter)
# h_keep_inds = np.where(hbb_ovr == 0)[0]
h_inds = np.where(hbb_ovr > 0)[0]
tmp_order = order[h_inds + 1]
for j in range(tmp_order.size):
iou = polyiou.iou_poly(polys[i], polys[tmp_order[j]])
hbb_ovr[h_inds[j]] = iou
# ovr.append(iou)
# ovr_index.append(tmp_order[j])
# ovr = np.array(ovr)
# ovr_index = np.array(ovr_index)
# print('ovr: ', ovr)
# print('thresh: ', thresh)
try:
if math.isnan(ovr[0]):
pdb.set_trace()
except:
pass
inds = np.where(hbb_ovr <= thresh)[0]
# order_obb = ovr_index[inds]
# print('inds: ', inds)
# order_hbb = order[h_keep_inds + 1]
order = order[inds + 1]
# pdb.set_trace()
# order = np.concatenate((order_obb, order_hbb), axis=0).astype(np.int)
return keep
def py_cpu_nms(dets, thresh):
"""Pure Python NMS baseline."""
#print('dets:', dets)
x1 = dets[:, 0]
y1 = dets[:, 1]
x2 = dets[:, 2]
y2 = dets[:, 3]
scores = dets[:, 4]
areas = (x2 - x1 + 1) * (y2 - y1 + 1)
## index for dets
order = scores.argsort()[::-1]
keep = []
while order.size > 0:
i = order[0]
keep.append(i)
xx1 = np.maximum(x1[i], x1[order[1:]])
yy1 = np.maximum(y1[i], y1[order[1:]])
xx2 = np.minimum(x2[i], x2[order[1:]])
yy2 = np.minimum(y2[i], y2[order[1:]])
w = np.maximum(0.0, xx2 - xx1 + 1)
h = np.maximum(0.0, yy2 - yy1 + 1)
inter = w * h
ovr = inter / (areas[i] + areas[order[1:]] - inter)
inds = np.where(ovr <= thresh)[0]
order = order[inds + 1]
return keep
def nmsbynamedict(nameboxdict, nms, thresh):
nameboxnmsdict = {x: [] for x in nameboxdict}
for imgname in nameboxdict:
#print('imgname:', imgname)
#keep = py_cpu_nms(np.array(nameboxdict[imgname]), thresh)
#print('type nameboxdict:', type(nameboxnmsdict))
#print('type imgname:', type(imgname))
#print('type nms:', type(nms))
keep = nms(np.array(nameboxdict[imgname]), thresh)
#print('keep:', keep)
outdets = []
#print('nameboxdict[imgname]: ', nameboxnmsdict[imgname])
for index in keep:
# print('index:', index)
outdets.append(nameboxdict[imgname][index])
nameboxnmsdict[imgname] = outdets
return nameboxnmsdict
def poly2origpoly(poly, x, y, rate):
origpoly = []
for i in range(int(len(poly)/2)):
tmp_x = float(poly[i * 2] + x) / float(rate)
tmp_y = float(poly[i * 2 + 1] + y) / float(rate)
origpoly.append(tmp_x)
origpoly.append(tmp_y)
return origpoly
def mergesingle(dstpath, nms, fullname):
name = util.custombasename(fullname)
#print('name:', name)
dstname = os.path.join(dstpath, name + '.txt')
with open(fullname, 'r') as f_in:
nameboxdict = {}
lines = f_in.readlines()
splitlines = [x.strip().split(' ') for x in lines]
for splitline in splitlines:
subname = splitline[0]
splitname = subname.split('__')
oriname = splitname[0]
pattern1 = re.compile(r'__\d+___\d+')
#print('subname:', subname)
x_y = re.findall(pattern1, subname)
x_y_2 = re.findall(r'\d+', x_y[0])
x, y = int(x_y_2[0]), int(x_y_2[1])
pattern2 = re.compile(r'__([\d+\.]+)__\d+___')
rate = re.findall(pattern2, subname)[0]
confidence = splitline[1]
poly = list(map(float, splitline[2:]))
origpoly = poly2origpoly(poly, x, y, rate)
det = origpoly
det.append(confidence)
det = list(map(float, det))
if (oriname not in nameboxdict):
nameboxdict[oriname] = []
nameboxdict[oriname].append(det)
nameboxnmsdict = nmsbynamedict(nameboxdict, nms, nms_thresh)
with open(dstname, 'w') as f_out:
for imgname in nameboxnmsdict:
for det in nameboxnmsdict[imgname]:
#print('det:', det)
confidence = det[-1]
bbox = det[0:-1]
outline = imgname + ' ' + str(confidence) + ' ' + ' '.join(map(str, bbox))
#print('outline:', outline)
f_out.write(outline + '\n')
def mergebase_parallel(srcpath, dstpath, nms):
"""
Դ·еtxtĿϢ,nmsĿ·еͬtxt
@param srcpath: ϲǰϢtxtԴ·
@param dstpath: ϲϢtxtĿ·
@param nms: NMS
"""
pool = Pool(16)
filelist = util.GetFileFromThisRootDir(srcpath)
mergesingle_fn = partial(mergesingle, dstpath, nms)
# pdb.set_trace()
pool.map(mergesingle_fn, filelist)
def mergebase(srcpath, dstpath, nms):
filelist = util.GetFileFromThisRootDir(srcpath)
for filename in filelist:
mergesingle(dstpath, nms, filename)
def mergebyrec(srcpath, dstpath):
"""
srcpath: result files before merge and nms
dstpath: result files after merge and nms
"""
# srcpath = r'E:\bod-dataset\results\bod-v3_rfcn_2000000'
# dstpath = r'E:\bod-dataset\results\bod-v3_rfcn_2000000_nms'
mergebase(srcpath,
dstpath,
py_cpu_nms)
def mergebypoly(srcpath, dstpath):
"""
srcpath: result files before merge and nms.txtϢʽΪ:[P0770__1__0___0 confidence poly]
dstpath: result files after merge and nms.txtϢʽΪ:[P0770 confidence poly]
"""
# srcpath = r'/home/dingjian/evaluation_task1/result/faster-rcnn-59/comp4_test_results'
# dstpath = r'/home/dingjian/evaluation_task1/result/faster-rcnn-59/testtime'
# mergebase(srcpath,
# dstpath,
# py_cpu_nms_poly)
mergebase_parallel(srcpath,
dstpath,
py_cpu_nms_poly_fast)
if __name__ == '__main__':
mergebypoly(r'ResultMerge_example', r'ResultMerge_example_result')
# mergebyrec()
================================================
FILE: SplitOnlyImage.py
================================================
import os
import numpy as np
import cv2
import copy
import dota_utils as util
class splitbase():
def __init__(self,
srcpath,
dstpath,
gap=100,
subsize=1024,
ext='.png'):
self.srcpath = srcpath
self.outpath = dstpath
self.gap = gap
self.subsize = subsize
self.slide = self.subsize - self.gap
self.srcpath = srcpath
self.dstpath = dstpath
self.ext = ext
def saveimagepatches(self, img, subimgname, left, up, ext='.png'):
subimg = copy.deepcopy(img[up: (up + self.subsize), left: (left + self.subsize)])
outdir = os.path.join(self.dstpath, subimgname + ext)
cv2.imwrite(outdir, subimg)
def SplitSingle(self, name, rate, extent):
img = cv2.imread(os.path.join(self.srcpath, name + extent))
assert np.shape(img) != ()
if (rate != 1):
resizeimg = cv2.resize(img, None, fx=rate, fy=rate, interpolation = cv2.INTER_CUBIC)
else:
resizeimg = img
outbasename = name + '__' + str(rate) + '__'
weight = np.shape(resizeimg)[1]
height = np.shape(resizeimg)[0]
left, up = 0, 0
while (left < weight):
if (left + self.subsize >= weight):
left = max(weight - self.subsize, 0)
up = 0
while (up < height):
if (up + self.subsize >= height):
up = max(height - self.subsize, 0)
subimgname = outbasename + str(left) + '___' + str(up)
self.saveimagepatches(resizeimg, subimgname, left, up)
if (up + self.subsize >= height):
break
else:
up = up + self.slide
if (left + self.subsize >= weight):
break
else:
left = left + self.slide
def splitdata(self, rate):
imagelist = util.GetFileFromThisRootDir(self.srcpath)
imagenames = [util.custombasename(x) for x in imagelist if (util.custombasename(x) != 'Thumbs')]
for name in imagenames:
self.SplitSingle(name, rate, self.ext)
if __name__ == '__main__':
split = splitbase(r'example/images',
r'example/imagesSplit')
split.splitdata(1)
================================================
FILE: SplitOnlyImage_multi_process.py
================================================
import os
import numpy as np
import cv2
import copy
import dota_utils as util
from multiprocessing import Pool
from functools import partial
def split_single_warp(name, split_base, rate, extent):
split_base.SplitSingle(name, rate, extent)
class splitbase():
def __init__(self,
srcpath,
dstpath,
gap=100,
subsize=1024,
ext='.png',
padding=True,
num_process=32):
self.srcpath = srcpath
self.outpath = dstpath
self.gap = gap
self.subsize = subsize
self.slide = self.subsize - self.gap
self.srcpath = srcpath
self.dstpath = dstpath
self.ext = ext
self.padding = padding
self.pool = Pool(num_process)
if not os.path.isdir(self.outpath):
os.mkdir(self.outpath)
def saveimagepatches(self, img, subimgname, left, up, ext='.png'):
subimg = copy.deepcopy(img[up: (up + self.subsize), left: (left + self.subsize)])
outdir = os.path.join(self.dstpath, subimgname + ext)
h, w, c = np.shape(subimg)
if (self.padding):
outimg = np.zeros((self.subsize, self.subsize, 3))
outimg[0:h, 0:w, :] = subimg
cv2.imwrite(outdir, outimg)
else:
cv2.imwrite(outdir, subimg)
def SplitSingle(self, name, rate, extent):
img = cv2.imread(os.path.join(self.srcpath, name + extent))
assert np.shape(img) != ()
if (rate != 1):
resizeimg = cv2.resize(img, None, fx=rate, fy=rate, interpolation=cv2.INTER_CUBIC)
else:
resizeimg = img
outbasename = name + '__' + str(rate) + '__'
weight = np.shape(resizeimg)[1]
height = np.shape(resizeimg)[0]
# if (max(weight, height) < self.subsize/2):
# return
left, up = 0, 0
while (left < weight):
if (left + self.subsize >= weight):
left = max(weight - self.subsize, 0)
up = 0
while (up < height):
if (up + self.subsize >= height):
up = max(height - self.subsize, 0)
subimgname = outbasename + str(left) + '___' + str(up)
self.saveimagepatches(resizeimg, subimgname, left, up)
if (up + self.subsize >= height):
break
else:
up = up + self.slide
if (left + self.subsize >= weight):
break
else:
left = left + self.slide
def splitdata(self, rate):
imagelist = util.GetFileFromThisRootDir(self.srcpath)
imagenames = [util.custombasename(x) for x in imagelist if (util.custombasename(x) != 'Thumbs')]
# worker = partial(self.SplitSingle, rate=rate, extent=self.ext)
worker = partial(split_single_warp, split_base=self, rate=rate, extent=self.ext)
self.pool.map(worker, imagenames)
#
# for name in imagenames:
# self.SplitSingle(name, rate, self.ext)
def __getstate__(self):
self_dict = self.__dict__.copy()
del self_dict['pool']
return self_dict
def __setstate__(self, state):
self.__dict__.update(state)
if __name__ == '__main__':
split = splitbase(r'/home/dingjian/data/dota/val/images',
r'/home/dingjian/data/dota/valsplit',
num_process=32)
split.splitdata(1)
================================================
FILE: YOLO_Transform.py
================================================
# -*- coding: utf-8 -*-
import dota_utils as util
import os
import numpy as np
from PIL import Image
import cv2
import random
import shutil
import matplotlib.pyplot as plt
from shapely.geometry import Polygon, MultiPoint # 多边形
import time
import argparse
## trans dota format to format YOLO(darknet) required
def dota2Darknet(imgpath, txtpath, dstpath, extractclassname):
"""
:param imgpath: the path of images
:param txtpath: the path of txt in dota format
:param dstpath: the path of txt in YOLO format
:param extractclassname: the category you selected
:return:
txt format: id x y w h
"""
if os.path.exists(dstpath):
shutil.rmtree(dstpath) # delete output folder
os.makedirs(dstpath) # make new output folder
filelist = util.GetFileFromThisRootDir(txtpath) # fileist=['/.../P0005.txt', ..., /.../P000?.txt]
for fullname in filelist: # fullname='/.../P000?.txt'
objects = util.parse_dota_poly(fullname)
'''
objects =
[{'name': 'ship',
'difficult': '1',
'poly': [(1054.0, 1028.0), (1063.0, 1011.0), (1111.0, 1040.0), (1112.0, 1062.0)],
'area': 1159.5
},
...
]
'''
name = os.path.splitext(os.path.basename(fullname))[0] # name='P000?'
img_fullname = os.path.join(imgpath, name + '.png') # img_fullname='/.../P000?.png'
img = Image.open(img_fullname)
img_w, img_h = img.size
# print img_w,img_h
with open(os.path.join(dstpath, name + '.txt'), 'w') as f_out:
for obj in objects:
poly = obj['poly'] # poly=[(x1,y1),(x2,y2),(x3,y3),(x4,y4)]
bbox = np.array(util.dots4ToRecC(poly, img_w, img_h)) # bbox=[x y w h]
if (sum(bbox <= 0) + sum(bbox >= 1)) >= 1: # 若bbox中有<=0或>= 1的元素则将该box排除
continue
if (obj['name'] in extractclassname):
id = extractclassname.index(obj['name']) # id=类名的索引 比如'plane'对应id=0
else:
continue
outline = str(id) + ' ' + ' '.join(list(map(str, bbox))) # outline='id x y w h'
f_out.write(outline + '\n') # 写入txt文件中并加上换行符号 \n
## trans dota format to (cls, c_x, c_y, Longest side, short side, angle:[0,179))
def dota2LongSideFormat(imgpath, txtpath, dstpath, extractclassname):
"""
trans dota farmat to longside format
:param imgpath: the path of images
:param txtpath: the path of txt in dota format
:param dstpath: the path of txt in YOLO format
:param extractclassname: the category you selected
"""
if os.path.exists(dstpath):
shutil.rmtree(dstpath) # delete output folder
os.makedirs(dstpath) # make new output folder
filelist = util.GetFileFromThisRootDir(txtpath) # fileist=['/.../P0005.txt', ..., /.../P000?.txt]
for fullname in filelist: # fullname='/.../P000?.txt'
objects = util.parse_dota_poly(fullname)
'''
objects =
[{'name': 'ship',
'difficult': '1',
'poly': [(1054.0, 1028.0), (1063.0, 1011.0), (1111.0, 1040.0), (1112.0, 1062.0)],
'area': 1159.5
},
...
]
'''
name = os.path.splitext(os.path.basename(fullname))[0] # name='P000?'
img_fullname = os.path.join(imgpath, name + '.png') # img_fullname='/.../P000?.png'
img = Image.open(img_fullname)
img_w, img_h = img.size
# print img_w,img_h
with open(os.path.join(dstpath, name + '.txt'), 'w') as f_out:
num_gt = 0
for i, obj in enumerate(objects):
num_gt = num_gt + 1 # 为当前有效gt计数
poly = obj['poly'] # poly=[(x1,y1),(x2,y2),(x3,y3),(x4,y4)]
poly = np.float32(np.array(poly))
# 四点坐标归一化
poly[:, 0] = poly[:, 0]/img_w
poly[:, 1] = poly[:, 1]/img_h
rect = cv2.minAreaRect(poly) # 得到最小外接矩形的(中心(x,y), (宽,高), 旋转角度)
# box = np.float32(cv2.boxPoints(rect)) # 返回rect四个点的值
c_x = rect[0][0]
c_y = rect[0][1]
w = rect[1][0]
h = rect[1][1]
theta = rect[-1] # Range for angle is [-90,0)
trans_data = cvminAreaRect2longsideformat(c_x, c_y, w, h, theta)
if not trans_data:
if theta != 90: # Θ=90说明wh中有为0的元素,即gt信息不完整,无需提示异常,直接删除
print('opencv表示法转长边表示法出现异常,已将第%d个box排除,问题出现在该图片中:%s' % (i, img_fullname))
num_gt = num_gt - 1
continue
else:
# range:[-180,0)
c_x, c_y, longside, shortside, theta_longside = trans_data
bbox = np.array((c_x, c_y, longside, shortside))
if (sum(bbox <= 0) + sum(bbox[:2] >= 1) ) >= 1: # 0= 1的元素,bbox中有<= 0的元素,已将第%d个box排除,问题出现在该图片中:%s' % (i, img_fullname))
print('出问题的longside形式数据:[%.16f, %.16f, %.16f, %.16f, %.1f]' % (c_x, c_y, longside, shortside, theta_longside))
num_gt = num_gt - 1
continue
if (obj['name'] in extractclassname):
id = extractclassname.index(obj['name']) # id=类名的索引 比如'plane'对应id=0
else:
print('预定类别中没有类别:%s;已将该box排除,问题出现在该图片中:%s' % (obj['name'], fullname))
num_gt = num_gt - 1
continue
theta_label = int(theta_longside + 180.5) # range int[0,180] 四舍五入
if theta_label == 180: # range int[0,179]
theta_label = 179
# outline='id x y longside shortside Θ'
# final check
if id > 15 or id < 0:
print('id problems,问题出现在该图片中:%s' % (i, img_fullname))
print('出问题的longside形式数据:[%.16f, %.16f, %.16f, %.16f, %.1f]' % (
c_x, c_y, longside, shortside, theta_longside))
if theta_label < 0 or theta_label > 179:
print('id problems,问题出现在该图片中:%s' % (i, img_fullname))
print('出问题的longside形式数据:[%.16f, %.16f, %.16f, %.16f, %.1f]' % (
c_x, c_y, longside, shortside, theta_longside))
outline = str(id) + ' ' + ' '.join(list(map(str, bbox))) + ' ' + str(theta_label)
f_out.write(outline + '\n') # 写入txt文件中并加上换行符号 \n
if num_gt == 0:
os.remove(os.path.join(dstpath, name + '.txt')) #
os.remove(img_fullname)
os.remove(fullname)
print('%s 图片对应的txt不存在有效目标,已删除对应图片与txt' % img_fullname)
print('已完成文件夹内DOTA数据形式到长边表示法的转换')
def cvminAreaRect2longsideformat(x_c, y_c, width, height, theta):
'''
trans minAreaRect(x_c, y_c, width, height, θ) to longside format(x_c, y_c, longside, shortside, θ)
两者区别为:
当opencv表示法中width为最长边时(包括正方形的情况),则两种表示方法一致
当opencv表示法中width不为最长边 ,则最长边表示法的角度要在opencv的Θ基础上-90度
@param x_c: center_x
@param y_c: center_y
@param width: x轴逆时针旋转碰到的第一条边
@param height: 与width不同的边
@param theta: x轴逆时针旋转与width的夹角,由于原点位于图像的左上角,逆时针旋转角度为负 [-90, 0)
@return:
x_c: center_x
y_c: center_y
longside: 最长边
shortside: 最短边
theta_longside: 最长边和x轴逆时针旋转的夹角,逆时针方向角度为负 [-180, 0)
'''
'''
意外情况:(此时要将它们恢复符合规则的opencv形式:wh交换,Θ置为-90)
竖直box:box_width < box_height θ=0
水平box:box_width > box_height θ=0
'''
if theta == 0:
theta = -90
buffer_width = width
width = height
height = buffer_width
if theta > 0:
if theta != 90: # Θ=90说明wh中有为0的元素,即gt信息不完整,无需提示异常,直接删除
print('θ计算出现异常,当前数据为:%.16f, %.16f, %.16f, %.16f, %.1f;超出opencv表示法的范围:[-90,0)' % (x_c, y_c, width, height, theta))
return False
if theta < -90:
print('θ计算出现异常,当前数据为:%.16f, %.16f, %.16f, %.16f, %.1f;超出opencv表示法的范围:[-90,0)' % (x_c, y_c, width, height, theta))
return False
if width != max(width, height): # 若width不是最长边
longside = height
shortside = width
theta_longside = theta - 90
else: # 若width是最长边(包括正方形的情况)
longside = width
shortside = height
theta_longside = theta
if longside < shortside:
print('旋转框转换表示形式后出现问题:最长边小于短边;[%.16f, %.16f, %.16f, %.16f, %.1f]' % (x_c, y_c, longside, shortside, theta_longside))
return False
if (theta_longside < -180 or theta_longside >= 0):
print('旋转框转换表示形式时出现问题:θ超出长边表示法的范围:[-180,0);[%.16f, %.16f, %.16f, %.16f, %.1f]' % (x_c, y_c, longside, shortside, theta_longside))
return False
return x_c, y_c, longside, shortside, theta_longside
def drawLongsideFormatimg(imgpath, txtpath, dstpath, extractclassname, thickness=2):
"""
根据labels绘制边框(label_format:classid, x_c_normalized, y_c_normalized, longside_normalized, shortside_normalized, Θ)
:param imgpath: the path of images
:param txtpath: the path of txt in longside format
:param dstpath: the path of image_drawed
:param extractclassname: the category you selected
"""
if os.path.exists(dstpath):
shutil.rmtree(dstpath) # delete output folder
os.makedirs(dstpath) # make new output folder
# 设置画框的颜色 colors = [[178, 63, 143], [25, 184, 176], [238, 152, 129],....,[235, 137, 120]]随机设置RGB颜色
colors = [[random.randint(0, 255) for _ in range(3)] for _ in range(len(extractclassname))]
filelist = util.GetFileFromThisRootDir(txtpath) # fileist=['/.../P0005.txt', ..., /.../P000?.txt]
for fullname in filelist: # fullname='/.../P000?.txt'
objects = util.parse_longsideformat(fullname)
'''
objects[i] = [classid, x_c_normalized, y_c_normalized, longside_normalized, shortside_normalized, theta]
'''
name = os.path.splitext(os.path.basename(fullname))[0] # name='P000?'
img_fullname = os.path.join(imgpath, name + '.png') # img_fullname='/.../P000?.png'
img_savename = os.path.join(dstpath, name + '_.png') # img_fullname='/.../_P000?.png'
img = Image.open(img_fullname) # 图像被打开但未被读取
img_w, img_h = img.size
img = cv2.imread(img_fullname) # 读取图像像素
for i, obj in enumerate(objects):
# obj = [classid, x_c_normalized, y_c_normalized, longside_normalized, shortside_normalized, float:0-179]
class_index = obj[0]
# rect=[(x_c,y_c),(w,h),Θ] Θ:flaot[0-179] -> (-180,0)
rect = longsideformat2cvminAreaRect(obj[1], obj[2], obj[3], obj[4], (obj[5]-179.9))
# poly = [(x1,y1),(x2,y2),(x3,y3),(x4,y4)]
poly = np.float32(cv2.boxPoints(rect)) # 返回rect对应的四个点的值 normalized
# 四点坐标反归一化 取整
poly[:, 0] = poly[:, 0] * img_w
poly[:, 1] = poly[:, 1] * img_h
poly = np.int0(poly)
# 画出来
cv2.drawContours(image=img,
contours=[poly],
contourIdx=-1,
color=colors[int(class_index)],
thickness=thickness)
cv2.imwrite(img_savename, img)
# time.sleep()
def longsideformat2cvminAreaRect(x_c, y_c, longside, shortside, theta_longside):
'''
trans longside format(x_c, y_c, longside, shortside, θ) to minAreaRect(x_c, y_c, width, height, θ)
两者区别为:
当opencv表示法中width为最长边时(包括正方形的情况),则两种表示方法一致
当opencv表示法中width不为最长边 ,则最长边表示法的角度要在opencv的Θ基础上-90度
@param x_c: center_x
@param y_c: center_y
@param longside: 最长边
@param shortside: 最短边
@param theta_longside: 最长边和x轴逆时针旋转的夹角,逆时针方向角度为负 [-180, 0)
@return: ((x_c, y_c),(width, height),Θ)
x_c: center_x
y_c: center_y
width: x轴逆时针旋转碰到的第一条边最长边
height: 与width不同的边
theta: x轴逆时针旋转与width的夹角,由于原点位于图像的左上角,逆时针旋转角度为负 [-90, 0)
'''
if (theta_longside >= -180 and theta_longside < -90): # width is not the longest side
width = shortside
height = longside
theta = theta_longside + 90
else:
width = longside
height =shortside
theta = theta_longside
if theta < -90 or theta >= 0:
print('当前θ=%.1f,超出opencv的θ定义范围[-90, 0)' % theta)
return ((x_c, y_c), (width, height), theta)
def delete(imgpath, txtpath):
filelist = util.GetFileFromThisRootDir(txtpath) # fileist=['/.../P0005.txt', ..., /.../P000?.txt]
for fullname in filelist: # fullname='/.../P000?.txt'
name = os.path.splitext(os.path.basename(fullname))[0] # name='P000?'
img_fullname = os.path.join(imgpath, name + '.png') # img_fullname='/.../P000?.png'
if not os.path.exists(img_fullname): # 如果文件bu存在
os.remove(fullname)
if __name__ == '__main__':
## an example
dota2LongSideFormat('./DOTA_demo/images',
'./DOTA_demo/labelTxt',
'./DOTA_demo/yolo_labels',
util.classnames_v1_5)
drawLongsideFormatimg(imgpath='DOTA_demo/images',
txtpath='DOTA_demo/yolo_labels',
dstpath='DOTA_demo/draw_longside_img',
extractclassname=util.classnames_v1_5)
================================================
FILE: demo.ipynb
================================================
[File too large to display: 11.0 MB]
================================================
FILE: dota-v1.5_evaluation_task1.py
================================================
# --------------------------------------------------------
# dota_evaluation_task1
# Licensed under The MIT License [see LICENSE for details]
# Written by Jian Ding, based on code from Bharath Hariharan
# --------------------------------------------------------
"""
To use the code, users should to config detpath, annopath and imagesetfile
detpath is the path for 15 result files, for the format, you can refer to "http://captain.whu.edu.cn/DOTAweb/tasks.html"
search for PATH_TO_BE_CONFIGURED to config the paths
Note, the evaluation is on the large scale images
"""
import xml.etree.ElementTree as ET
import os
#import cPickle
import numpy as np
import matplotlib.pyplot as plt
import polyiou
from functools import partial
import pdb
def parse_gt(filename):
"""
:param filename: ground truth file to parse
:return: all instances in a picture
"""
objects = []
with open(filename, 'r') as f:
while True:
line = f.readline()
if line:
splitlines = line.strip().split(' ')
object_struct = {}
if (len(splitlines) < 9):
continue
object_struct['name'] = splitlines[8]
# if (len(splitlines) == 9):
# object_struct['difficult'] = 0
# elif (len(splitlines) == 10):
# object_struct['difficult'] = int(splitlines[9])
object_struct['difficult'] = 0
object_struct['bbox'] = [float(splitlines[0]),
float(splitlines[1]),
float(splitlines[2]),
float(splitlines[3]),
float(splitlines[4]),
float(splitlines[5]),
float(splitlines[6]),
float(splitlines[7])]
objects.append(object_struct)
else:
break
return objects
def voc_ap(rec, prec, use_07_metric=False):
""" ap = voc_ap(rec, prec, [use_07_metric])
Compute VOC AP given precision and recall.
If use_07_metric is true, uses the
VOC 07 11 point method (default:False).
"""
if use_07_metric:
# 11 point metric
ap = 0.
for t in np.arange(0., 1.1, 0.1):
if np.sum(rec >= t) == 0:
p = 0
else:
p = np.max(prec[rec >= t])
ap = ap + p / 11.
else:
# correct AP calculation
# first append sentinel values at the end
mrec = np.concatenate(([0.], rec, [1.]))
mpre = np.concatenate(([0.], prec, [0.]))
# compute the precision envelope
for i in range(mpre.size - 1, 0, -1):
mpre[i - 1] = np.maximum(mpre[i - 1], mpre[i])
# to calculate area under PR curve, look for points
# where X axis (recall) changes value
i = np.where(mrec[1:] != mrec[:-1])[0]
# and sum (\Delta recall) * prec
ap = np.sum((mrec[i + 1] - mrec[i]) * mpre[i + 1])
return ap
def voc_eval(detpath,
annopath,
imagesetfile,
classname,
# cachedir,
ovthresh=0.5,
use_07_metric=False):
"""rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
[ovthresh],
[use_07_metric])
Top level function that does the PASCAL VOC evaluation.
detpath: Path to detections
detpath.format(classname) should produce the detection results file.
annopath: Path to annotations
annopath.format(imagename) should be the xml annotations file.
imagesetfile: Text file containing the list of images, one image per line.
classname: Category name (duh)
cachedir: Directory for caching the annotations
[ovthresh]: Overlap threshold (default = 0.5)
[use_07_metric]: Whether to use VOC07's 11 point AP computation
(default False)
"""
# assumes detections are in detpath.format(classname)
# assumes annotations are in annopath.format(imagename)
# assumes imagesetfile is a text file with each line an image name
# cachedir caches the annotations in a pickle file
# first load gt
#if not os.path.isdir(cachedir):
# os.mkdir(cachedir)
#cachefile = os.path.join(cachedir, 'annots.pkl')
# read list of images
with open(imagesetfile, 'r') as f:
lines = f.readlines()
imagenames = [x.strip() for x in lines]
#print('imagenames: ', imagenames)
#if not os.path.isfile(cachefile):
# load annots
recs = {}
for i, imagename in enumerate(imagenames):
#print('parse_files name: ', annopath.format(imagename))
recs[imagename] = parse_gt(annopath.format(imagename))
# extract gt objects for this class
class_recs = {}
npos = 0
for imagename in imagenames:
R = [obj for obj in recs[imagename] if obj['name'] == classname]
bbox = np.array([x['bbox'] for x in R])
difficult = np.array([x['difficult'] for x in R]).astype(np.bool)
det = [False] * len(R)
npos = npos + sum(~difficult)
class_recs[imagename] = {'bbox': bbox,
'difficult': difficult,
'det': det}
# read dets from Task1* files
detfile = detpath.format(classname)
with open(detfile, 'r') as f:
lines = f.readlines()
splitlines = [x.strip().split(' ') for x in lines]
image_ids = [x[0] for x in splitlines]
confidence = np.array([float(x[1]) for x in splitlines])
#print('check confidence: ', confidence)
BB = np.array([[float(z) for z in x[2:]] for x in splitlines])
# sort by confidence
sorted_ind = np.argsort(-confidence)
sorted_scores = np.sort(-confidence)
#print('check sorted_scores: ', sorted_scores)
#print('check sorted_ind: ', sorted_ind)
## note the usage only in numpy not for list
BB = BB[sorted_ind, :]
image_ids = [image_ids[x] for x in sorted_ind]
#print('check imge_ids: ', image_ids)
#print('imge_ids len:', len(image_ids))
# go down dets and mark TPs and FPs
nd = len(image_ids)
tp = np.zeros(nd)
fp = np.zeros(nd)
for d in range(nd):
R = class_recs[image_ids[d]]
bb = BB[d, :].astype(float)
ovmax = -np.inf
BBGT = R['bbox'].astype(float)
## compute det bb with each BBGT
if BBGT.size > 0:
# compute overlaps
# intersection
# 1. calculate the overlaps between hbbs, if the iou between hbbs are 0, the iou between obbs are 0, too.
# pdb.set_trace()
BBGT_xmin = np.min(BBGT[:, 0::2], axis=1)
BBGT_ymin = np.min(BBGT[:, 1::2], axis=1)
BBGT_xmax = np.max(BBGT[:, 0::2], axis=1)
BBGT_ymax = np.max(BBGT[:, 1::2], axis=1)
bb_xmin = np.min(bb[0::2])
bb_ymin = np.min(bb[1::2])
bb_xmax = np.max(bb[0::2])
bb_ymax = np.max(bb[1::2])
ixmin = np.maximum(BBGT_xmin, bb_xmin)
iymin = np.maximum(BBGT_ymin, bb_ymin)
ixmax = np.minimum(BBGT_xmax, bb_xmax)
iymax = np.minimum(BBGT_ymax, bb_ymax)
iw = np.maximum(ixmax - ixmin + 1., 0.)
ih = np.maximum(iymax - iymin + 1., 0.)
inters = iw * ih
# union
uni = ((bb_xmax - bb_xmin + 1.) * (bb_ymax - bb_ymin + 1.) +
(BBGT_xmax - BBGT_xmin + 1.) *
(BBGT_ymax - BBGT_ymin + 1.) - inters)
overlaps = inters / uni
BBGT_keep_mask = overlaps > 0
BBGT_keep = BBGT[BBGT_keep_mask, :]
BBGT_keep_index = np.where(overlaps > 0)[0]
# pdb.set_trace()
def calcoverlaps(BBGT_keep, bb):
overlaps = []
for index, GT in enumerate(BBGT_keep):
overlap = polyiou.iou_poly(polyiou.VectorDouble(BBGT_keep[index]), polyiou.VectorDouble(bb))
overlaps.append(overlap)
return overlaps
if len(BBGT_keep) > 0:
overlaps = calcoverlaps(BBGT_keep, bb)
ovmax = np.max(overlaps)
jmax = np.argmax(overlaps)
# pdb.set_trace()
jmax = BBGT_keep_index[jmax]
if ovmax > ovthresh:
if not R['difficult'][jmax]:
if not R['det'][jmax]:
tp[d] = 1.
R['det'][jmax] = 1
else:
fp[d] = 1.
else:
fp[d] = 1.
# compute precision recall
print('check fp:', fp)
print('check tp', tp)
print('npos num:', npos)
fp = np.cumsum(fp)
tp = np.cumsum(tp)
rec = tp / float(npos)
# avoid divide by zero in case the first detection matches a difficult
# ground truth
prec = tp / np.maximum(tp + fp, np.finfo(np.float64).eps)
ap = voc_ap(rec, prec, use_07_metric)
return rec, prec, ap
def main():
detpath = r'/home/test/Persons/hukaixuan/DOTA_devkit-master/evaluation_example/result_classname/Task1_{:s}.txt'
annopath = r'/home/test/Persons/hukaixuan/DOTA_devkit-master/evaluation_example/row_DOTA_labels/{:s}.txt'
imagesetfile = r'/home/test/Persons/hukaixuan/DOTA_devkit-master/evaluation_example/imgnamefile.txt'
# detpath = r'PATH_TO_BE_CONFIGURED/Task1_{:s}.txt'
# annopath = r'PATH_TO_BE_CONFIGURED/{:s}.txt' # change the directory to the path of val/labelTxt, if you want to do evaluation on the valset
# imagesetfile = r'PATH_TO_BE_CONFIGURED/valset.txt'
# For demo
classnames = ['harbor', 'large-vehicle', 'ship', 'small-vehicle']
# For DOTA-v1.5
# classnames = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
# 'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter', 'container-crane']
# For DOTA-v1.0
# classnames = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
# 'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter', ']
classaps = []
map = 0
skippedClassCount = 0
for classname in classnames:
print('classname:', classname)
detfile = detpath.format(classname)
if not (os.path.exists(detfile)):
skippedClassCount += 1
print('This class is not be detected in your dataset: {:s}'.format(classname))
continue
rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
ovthresh=0.5,
use_07_metric=True)
map = map + ap
#print('rec: ', rec, 'prec: ', prec, 'ap: ', ap)
print('ap: ', ap)
classaps.append(ap)
# umcomment to show p-r curve of each category
# plt.figure(figsize=(8,4))
# plt.xlabel('recall')
# plt.ylabel('precision')
# plt.plot(rec, prec)
# plt.show()
map = map/(len(classnames)-skippedClassCount)
print('map:', map)
classaps = 100*np.array(classaps)
print('classaps: ', classaps)
if __name__ == '__main__':
main()
================================================
FILE: dota-v1.5_evaluation_task2.py
================================================
# --------------------------------------------------------
# dota_evaluation_task1
# Licensed under The MIT License [see LICENSE for details]
# Written by Jian Ding, based on code from Bharath Hariharan
# --------------------------------------------------------
"""
To use the code, users should to config detpath, annopath and imagesetfile
detpath is the path for 15 result files, for the format, you can refer to "http://captain.whu.edu.cn/DOTAweb/tasks.html"
search for PATH_TO_BE_CONFIGURED to config the paths
Note, the evaluation is on the large scale images
"""
import xml.etree.ElementTree as ET
import os
#import cPickle
import numpy as np
import matplotlib.pyplot as plt
def parse_gt(filename):
objects = []
with open(filename, 'r') as f:
lines = f.readlines()
splitlines = [x.strip().split(' ') for x in lines]
for splitline in splitlines:
object_struct = {}
object_struct['name'] = splitline[8]
# if (len(splitline) == 9):
# object_struct['difficult'] = 0
# elif (len(splitline) == 10):
# object_struct['difficult'] = int(splitline[9])
object_struct['difficult'] = 0
object_struct['bbox'] = [int(float(splitline[0])),
int(float(splitline[1])),
int(float(splitline[4])),
int(float(splitline[5]))]
w = int(float(splitline[4])) - int(float(splitline[0]))
h = int(float(splitline[5])) - int(float(splitline[1]))
object_struct['area'] = w * h
#print('area:', object_struct['area'])
# if object_struct['area'] < (15 * 15):
# #print('area:', object_struct['area'])
# object_struct['difficult'] = 1
objects.append(object_struct)
return objects
def voc_ap(rec, prec, use_07_metric=False):
""" ap = voc_ap(rec, prec, [use_07_metric])
Compute VOC AP given precision and recall.
If use_07_metric is true, uses the
VOC 07 11 point method (default:False).
"""
if use_07_metric:
# 11 point metric
ap = 0.
for t in np.arange(0., 1.1, 0.1):
if np.sum(rec >= t) == 0:
p = 0
else:
p = np.max(prec[rec >= t])
ap = ap + p / 11.
else:
# correct AP calculation
# first append sentinel values at the end
mrec = np.concatenate(([0.], rec, [1.]))
mpre = np.concatenate(([0.], prec, [0.]))
# compute the precision envelope
for i in range(mpre.size - 1, 0, -1):
mpre[i - 1] = np.maximum(mpre[i - 1], mpre[i])
# to calculate area under PR curve, look for points
# where X axis (recall) changes value
i = np.where(mrec[1:] != mrec[:-1])[0]
# and sum (\Delta recall) * prec
ap = np.sum((mrec[i + 1] - mrec[i]) * mpre[i + 1])
return ap
def voc_eval(detpath,
annopath,
imagesetfile,
classname,
# cachedir,
ovthresh=0.5,
use_07_metric=False):
"""rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
[ovthresh],
[use_07_metric])
Top level function that does the PASCAL VOC evaluation.
detpath: Path to detections
detpath.format(classname) should produce the detection results file.
annopath: Path to annotations
annopath.format(imagename) should be the xml annotations file.
imagesetfile: Text file containing the list of images, one image per line.
classname: Category name (duh)
cachedir: Directory for caching the annotations
[ovthresh]: Overlap threshold (default = 0.5)
[use_07_metric]: Whether to use VOC07's 11 point AP computation
(default False)
"""
# assumes detections are in detpath.format(classname)
# assumes annotations are in annopath.format(imagename)
# assumes imagesetfile is a text file with each line an image name
# cachedir caches the annotations in a pickle file
# first load gt
#if not os.path.isdir(cachedir):
# os.mkdir(cachedir)
#cachefile = os.path.join(cachedir, 'annots.pkl')
# read list of images
with open(imagesetfile, 'r') as f:
lines = f.readlines()
imagenames = [x.strip() for x in lines]
#print('imagenames: ', imagenames)
#if not os.path.isfile(cachefile):
# load annots
recs = {}
for i, imagename in enumerate(imagenames):
#print('parse_files name: ', annopath.format(imagename))
recs[imagename] = parse_gt(annopath.format(imagename))
#if i % 100 == 0:
# print ('Reading annotation for {:d}/{:d}'.format(
# i + 1, len(imagenames)) )
# save
#print ('Saving cached annotations to {:s}'.format(cachefile))
#with open(cachefile, 'w') as f:
# cPickle.dump(recs, f)
#else:
# load
#with open(cachefile, 'r') as f:
# recs = cPickle.load(f)
# extract gt objects for this class
class_recs = {}
npos = 0
for imagename in imagenames:
R = [obj for obj in recs[imagename] if obj['name'] == classname]
bbox = np.array([x['bbox'] for x in R])
difficult = np.array([x['difficult'] for x in R]).astype(np.bool)
det = [False] * len(R)
npos = npos + sum(~difficult)
class_recs[imagename] = {'bbox': bbox,
'difficult': difficult,
'det': det}
# read dets
detfile = detpath.format(classname)
with open(detfile, 'r') as f:
lines = f.readlines()
splitlines = [x.strip().split(' ') for x in lines]
image_ids = [x[0] for x in splitlines]
confidence = np.array([float(x[1]) for x in splitlines])
#print('check confidence: ', confidence)
BB = np.array([[float(z) for z in x[2:]] for x in splitlines])
# sort by confidence
sorted_ind = np.argsort(-confidence)
sorted_scores = np.sort(-confidence)
#print('check sorted_scores: ', sorted_scores)
#print('check sorted_ind: ', sorted_ind)
BB = BB[sorted_ind, :]
image_ids = [image_ids[x] for x in sorted_ind]
#print('check imge_ids: ', image_ids)
#print('imge_ids len:', len(image_ids))
# go down dets and mark TPs and FPs
nd = len(image_ids)
tp = np.zeros(nd)
fp = np.zeros(nd)
for d in range(nd):
R = class_recs[image_ids[d]]
bb = BB[d, :].astype(float)
ovmax = -np.inf
BBGT = R['bbox'].astype(float)
if BBGT.size > 0:
# compute overlaps
# intersection
ixmin = np.maximum(BBGT[:, 0], bb[0])
iymin = np.maximum(BBGT[:, 1], bb[1])
ixmax = np.minimum(BBGT[:, 2], bb[2])
iymax = np.minimum(BBGT[:, 3], bb[3])
iw = np.maximum(ixmax - ixmin + 1., 0.)
ih = np.maximum(iymax - iymin + 1., 0.)
inters = iw * ih
# union
uni = ((bb[2] - bb[0] + 1.) * (bb[3] - bb[1] + 1.) +
(BBGT[:, 2] - BBGT[:, 0] + 1.) *
(BBGT[:, 3] - BBGT[:, 1] + 1.) - inters)
overlaps = inters / uni
ovmax = np.max(overlaps)
## if there exist 2
jmax = np.argmax(overlaps)
if ovmax > ovthresh:
if not R['difficult'][jmax]:
if not R['det'][jmax]:
tp[d] = 1.
R['det'][jmax] = 1
else:
fp[d] = 1.
# print('filename:', image_ids[d])
else:
fp[d] = 1.
# compute precision recall
print('check fp:', fp)
print('check tp', tp)
print('npos num:', npos)
fp = np.cumsum(fp)
tp = np.cumsum(tp)
rec = tp / float(npos)
# avoid divide by zero in case the first detection matches a difficult
# ground truth
prec = tp / np.maximum(tp + fp, np.finfo(np.float64).eps)
ap = voc_ap(rec, prec, use_07_metric)
return rec, prec, ap
def main():
detpath = r'/home/dingjian/Documents/ODAI_DOTA/DOAI_2019/doai2019_submit/gwf_Task2_merge_2/Task2_{:s}.txt'
annopath = r'/home/dingjian/code/DOAI_server2/media/DOTA15_Task2_gt/{:s}.txt'
imagesetfile = r'/home/dingjian/code/DOAI_server2/media/testset.txt'
# detpath = r'PATH_TO_BE_CONFIGURED/Task2_{:s}.txt'
# annopath = r'PATH_TO_BE_CONFIGURED/{:s}.txt'# change the directory to the path of val/labelTxt, if you want to do evaluation on the valset
# imagesetfile = r'PATH_TO_BE_CONFIGURED/valset.txt'
# For DOTA v1.5
classnames = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter', 'container-crane']
# For DOTA v1.0
# classnames = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
# 'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter']
classaps = []
map = 0
skippedClassCount = 0
for classname in classnames:
print('classname:', classname)
detfile = detpath.format(classname)
if not (os.path.exists(detfile)):
skippedClassCount += 1
print('This class is not be detected in your dataset: {:s}'.format(classname))
continue
rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
ovthresh=0.5,
use_07_metric=True)
map = map + ap
#print('rec: ', rec, 'prec: ', prec, 'ap: ', ap)
print('ap: ', ap)
classaps.append(ap)
# umcomment to show p-r curve of each category
# plt.figure(figsize=(8,4))
# plt.xlabel('recall')
# plt.ylabel('precision')
# plt.plot(rec, prec)
# plt.show()
map = map/(len(classnames)-skippedClassCount)
print('map:', map)
classaps = 100*np.array(classaps)
print('classaps: ', classaps)
if __name__ == '__main__':
main()
================================================
FILE: dota_evaluation_task1.py
================================================
# --------------------------------------------------------
# dota_evaluation_task1
# Licensed under The MIT License [see LICENSE for details]
# Written by Jian Ding, based on code from Bharath Hariharan
# --------------------------------------------------------
"""
To use the code, users should to config detpath, annopath and imagesetfile
detpath is the path for 15 result files, for the format, you can refer to "http://captain.whu.edu.cn/DOTAweb/tasks.html"
search for PATH_TO_BE_CONFIGURED to config the paths
Note, the evaluation is on the large scale images
"""
import xml.etree.ElementTree as ET
import os
#import cPickle
import numpy as np
import matplotlib.pyplot as plt
import polyiou
from functools import partial
def parse_gt(filename):
"""
:param filename: ground truth file to parse
:return: all instances in a picture
"""
objects = []
with open(filename, 'r') as f:
while True:
line = f.readline()
if line:
splitlines = line.strip().split(' ')
object_struct = {}
if (len(splitlines) < 9):
continue
object_struct['name'] = splitlines[8]
if (len(splitlines) == 9):
object_struct['difficult'] = 0
elif (len(splitlines) == 10):
object_struct['difficult'] = int(splitlines[9])
object_struct['bbox'] = [float(splitlines[0]),
float(splitlines[1]),
float(splitlines[2]),
float(splitlines[3]),
float(splitlines[4]),
float(splitlines[5]),
float(splitlines[6]),
float(splitlines[7])]
objects.append(object_struct)
else:
break
return objects
def voc_ap(rec, prec, use_07_metric=False):
""" ap = voc_ap(rec, prec, [use_07_metric])
Compute VOC AP given precision and recall.
If use_07_metric is true, uses the
VOC 07 11 point method (default:False).
"""
if use_07_metric:
# 11 point metric
ap = 0.
for t in np.arange(0., 1.1, 0.1):
if np.sum(rec >= t) == 0:
p = 0
else:
p = np.max(prec[rec >= t])
ap = ap + p / 11.
else:
# correct AP calculation
# first append sentinel values at the end
mrec = np.concatenate(([0.], rec, [1.]))
mpre = np.concatenate(([0.], prec, [0.]))
# compute the precision envelope
for i in range(mpre.size - 1, 0, -1):
mpre[i - 1] = np.maximum(mpre[i - 1], mpre[i])
# to calculate area under PR curve, look for points
# where X axis (recall) changes value
i = np.where(mrec[1:] != mrec[:-1])[0]
# and sum (\Delta recall) * prec
ap = np.sum((mrec[i + 1] - mrec[i]) * mpre[i + 1])
return ap
def voc_eval(detpath,
annopath,
imagesetfile,
classname,
# cachedir,
ovthresh=0.5,
use_07_metric=False):
"""rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
[ovthresh],
[use_07_metric])
Top level function that does the PASCAL VOC evaluation.
detpath: Path to detections
detpath.format(classname) should produce the detection results file.
annopath: Path to annotations
annopath.format(imagename) should be the xml annotations file.
imagesetfile: Text file containing the list of images, one image per line.
classname: Category name (duh)
cachedir: Directory for caching the annotations
[ovthresh]: Overlap threshold (default = 0.5)
[use_07_metric]: Whether to use VOC07's 11 point AP computation
(default False)
"""
# assumes detections are in detpath.format(classname)
# assumes annotations are in annopath.format(imagename)
# assumes imagesetfile is a text file with each line an image name
# cachedir caches the annotations in a pickle file
# first load gt
#if not os.path.isdir(cachedir):
# os.mkdir(cachedir)
#cachefile = os.path.join(cachedir, 'annots.pkl')
# read list of images
with open(imagesetfile, 'r') as f:
lines = f.readlines()
imagenames = [x.strip() for x in lines]
#print('imagenames: ', imagenames)
#if not os.path.isfile(cachefile):
# load annots
recs = {}
for i, imagename in enumerate(imagenames):
#print('parse_files name: ', annopath.format(imagename))
recs[imagename] = parse_gt(annopath.format(imagename))
#if i % 100 == 0:
# print ('Reading annotation for {:d}/{:d}'.format(
# i + 1, len(imagenames)) )
# save
#print ('Saving cached annotations to {:s}'.format(cachefile))
#with open(cachefile, 'w') as f:
# cPickle.dump(recs, f)
#else:
# load
#with open(cachefile, 'r') as f:
# recs = cPickle.load(f)
# extract gt objects for this class
class_recs = {}
npos = 0
for imagename in imagenames:
R = [obj for obj in recs[imagename] if obj['name'] == classname]
bbox = np.array([x['bbox'] for x in R])
difficult = np.array([x['difficult'] for x in R]).astype(np.bool)
det = [False] * len(R)
npos = npos + sum(~difficult)
class_recs[imagename] = {'bbox': bbox,
'difficult': difficult,
'det': det}
# read dets from Task1* files
detfile = detpath.format(classname)
with open(detfile, 'r') as f:
lines = f.readlines()
splitlines = [x.strip().split(' ') for x in lines]
image_ids = [x[0] for x in splitlines]
confidence = np.array([float(x[1]) for x in splitlines])
#print('check confidence: ', confidence)
BB = np.array([[float(z) for z in x[2:]] for x in splitlines])
# sort by confidence
sorted_ind = np.argsort(-confidence)
sorted_scores = np.sort(-confidence)
#print('check sorted_scores: ', sorted_scores)
#print('check sorted_ind: ', sorted_ind)
## note the usage only in numpy not for list
BB = BB[sorted_ind, :]
image_ids = [image_ids[x] for x in sorted_ind]
#print('check imge_ids: ', image_ids)
#print('imge_ids len:', len(image_ids))
# go down dets and mark TPs and FPs
nd = len(image_ids)
tp = np.zeros(nd)
fp = np.zeros(nd)
for d in range(nd):
R = class_recs[image_ids[d]]
bb = BB[d, :].astype(float)
ovmax = -np.inf
BBGT = R['bbox'].astype(float)
## compute det bb with each BBGT
if BBGT.size > 0:
# compute overlaps
# intersection
# 1. calculate the overlaps between hbbs, if the iou between hbbs are 0, the iou between obbs are 0, too.
# pdb.set_trace()
BBGT_xmin = np.min(BBGT[:, 0::2], axis=1)
BBGT_ymin = np.min(BBGT[:, 1::2], axis=1)
BBGT_xmax = np.max(BBGT[:, 0::2], axis=1)
BBGT_ymax = np.max(BBGT[:, 1::2], axis=1)
bb_xmin = np.min(bb[0::2])
bb_ymin = np.min(bb[1::2])
bb_xmax = np.max(bb[0::2])
bb_ymax = np.max(bb[1::2])
ixmin = np.maximum(BBGT_xmin, bb_xmin)
iymin = np.maximum(BBGT_ymin, bb_ymin)
ixmax = np.minimum(BBGT_xmax, bb_xmax)
iymax = np.minimum(BBGT_ymax, bb_ymax)
iw = np.maximum(ixmax - ixmin + 1., 0.)
ih = np.maximum(iymax - iymin + 1., 0.)
inters = iw * ih
# union
uni = ((bb_xmax - bb_xmin + 1.) * (bb_ymax - bb_ymin + 1.) +
(BBGT_xmax - BBGT_xmin + 1.) *
(BBGT_ymax - BBGT_ymin + 1.) - inters)
overlaps = inters / uni
BBGT_keep_mask = overlaps > 0
BBGT_keep = BBGT[BBGT_keep_mask, :]
BBGT_keep_index = np.where(overlaps > 0)[0]
# pdb.set_trace()
def calcoverlaps(BBGT_keep, bb):
overlaps = []
for index, GT in enumerate(BBGT_keep):
overlap = polyiou.iou_poly(polyiou.VectorDouble(BBGT_keep[index]), polyiou.VectorDouble(bb))
overlaps.append(overlap)
return overlaps
if len(BBGT_keep) > 0:
overlaps = calcoverlaps(BBGT_keep, bb)
ovmax = np.max(overlaps)
jmax = np.argmax(overlaps)
# pdb.set_trace()
jmax = BBGT_keep_index[jmax]
if ovmax > ovthresh:
if not R['difficult'][jmax]:
if not R['det'][jmax]:
tp[d] = 1.
R['det'][jmax] = 1
else:
fp[d] = 1.
else:
fp[d] = 1.
# compute precision recall
print('check fp:', fp)
print('check tp', tp)
print('npos num:', npos)
fp = np.cumsum(fp)
tp = np.cumsum(tp)
rec = tp / float(npos)
# avoid divide by zero in case the first detection matches a difficult
# ground truth
prec = tp / np.maximum(tp + fp, np.finfo(np.float64).eps)
ap = voc_ap(rec, prec, use_07_metric)
return rec, prec, ap
def main():
# ##TODO: wrap the code in the main
# detpath = r'/home/dingjian/Documents/Research/experiments/light_head_faster_rotbox_best_point/Task1_results_0.1_nms_epoch18/results/Task1_{:s}.txt'
# annopath = r'/home/dingjian/code/DOTA/DOTA/media/OrientlabelTxt-utf-8/{:s}.txt'# change the directory to the path of val/labelTxt, if you want to do evaluation on the valset
# imagesetfile = r'/home/dingjian/code/DOTA/DOTA/media/testset.txt'
# classnames = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
# 'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter']
detpath = r'PATH_TO_BE_CONFIGURED/Task1_{:s}.txt'
annopath = r'PATH_TO_BE_CONFIGURED/{:s}.txt' # change the directory to the path of val/labelTxt, if you want to do evaluation on the valset
imagesetfile = r'PATH_TO_BE_CONFIGURED/valset.txt'
# For DOTA-v1.5
# classnames = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
# 'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter', 'container-crane']
# For DOTA-v1.0
classnames = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter']
classaps = []
map = 0
for classname in classnames:
print('classname:', classname)
rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
ovthresh=0.5,
use_07_metric=True)
map = map + ap
#print('rec: ', rec, 'prec: ', prec, 'ap: ', ap)
print('ap: ', ap)
classaps.append(ap)
# umcomment to show p-r curve of each category
# plt.figure(figsize=(8,4))
# plt.xlabel('recall')
# plt.ylabel('precision')
# plt.plot(rec, prec)
# plt.show()
map = map/len(classnames)
print('map:', map)
classaps = 100*np.array(classaps)
print('classaps: ', classaps)
if __name__ == '__main__':
main()
================================================
FILE: dota_evaluation_task2.py
================================================
# --------------------------------------------------------
# dota_evaluation_task1
# Licensed under The MIT License [see LICENSE for details]
# Written by Jian Ding, based on code from Bharath Hariharan
# --------------------------------------------------------
"""
To use the code, users should to config detpath, annopath and imagesetfile
detpath is the path for 15 result files, for the format, you can refer to "http://captain.whu.edu.cn/DOTAweb/tasks.html"
search for PATH_TO_BE_CONFIGURED to config the paths
Note, the evaluation is on the large scale images
"""
import xml.etree.ElementTree as ET
import os
#import cPickle
import numpy as np
import matplotlib.pyplot as plt
def parse_gt(filename):
objects = []
with open(filename, 'r') as f:
lines = f.readlines()
splitlines = [x.strip().split(' ') for x in lines]
for splitline in splitlines:
object_struct = {}
object_struct['name'] = splitline[8]
if (len(splitline) == 9):
object_struct['difficult'] = 0
elif (len(splitline) == 10):
object_struct['difficult'] = int(splitline[9])
# object_struct['difficult'] = 0
object_struct['bbox'] = [int(float(splitline[0])),
int(float(splitline[1])),
int(float(splitline[4])),
int(float(splitline[5]))]
w = int(float(splitline[4])) - int(float(splitline[0]))
h = int(float(splitline[5])) - int(float(splitline[1]))
object_struct['area'] = w * h
#print('area:', object_struct['area'])
# if object_struct['area'] < (15 * 15):
# #print('area:', object_struct['area'])
# object_struct['difficult'] = 1
objects.append(object_struct)
return objects
def voc_ap(rec, prec, use_07_metric=False):
""" ap = voc_ap(rec, prec, [use_07_metric])
Compute VOC AP given precision and recall.
If use_07_metric is true, uses the
VOC 07 11 point method (default:False).
"""
if use_07_metric:
# 11 point metric
ap = 0.
for t in np.arange(0., 1.1, 0.1):
if np.sum(rec >= t) == 0:
p = 0
else:
p = np.max(prec[rec >= t])
ap = ap + p / 11.
else:
# correct AP calculation
# first append sentinel values at the end
mrec = np.concatenate(([0.], rec, [1.]))
mpre = np.concatenate(([0.], prec, [0.]))
# compute the precision envelope
for i in range(mpre.size - 1, 0, -1):
mpre[i - 1] = np.maximum(mpre[i - 1], mpre[i])
# to calculate area under PR curve, look for points
# where X axis (recall) changes value
i = np.where(mrec[1:] != mrec[:-1])[0]
# and sum (\Delta recall) * prec
ap = np.sum((mrec[i + 1] - mrec[i]) * mpre[i + 1])
return ap
def voc_eval(detpath,
annopath,
imagesetfile,
classname,
# cachedir,
ovthresh=0.5,
use_07_metric=False):
"""rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
[ovthresh],
[use_07_metric])
Top level function that does the PASCAL VOC evaluation.
detpath: Path to detections
detpath.format(classname) should produce the detection results file.
annopath: Path to annotations
annopath.format(imagename) should be the xml annotations file.
imagesetfile: Text file containing the list of images, one image per line.
classname: Category name (duh)
cachedir: Directory for caching the annotations
[ovthresh]: Overlap threshold (default = 0.5)
[use_07_metric]: Whether to use VOC07's 11 point AP computation
(default False)
"""
# assumes detections are in detpath.format(classname)
# assumes annotations are in annopath.format(imagename)
# assumes imagesetfile is a text file with each line an image name
# cachedir caches the annotations in a pickle file
# first load gt
#if not os.path.isdir(cachedir):
# os.mkdir(cachedir)
#cachefile = os.path.join(cachedir, 'annots.pkl')
# read list of images
with open(imagesetfile, 'r') as f:
lines = f.readlines()
imagenames = [x.strip() for x in lines]
#print('imagenames: ', imagenames)
#if not os.path.isfile(cachefile):
# load annots
recs = {}
for i, imagename in enumerate(imagenames):
#print('parse_files name: ', annopath.format(imagename))
recs[imagename] = parse_gt(annopath.format(imagename))
#if i % 100 == 0:
# print ('Reading annotation for {:d}/{:d}'.format(
# i + 1, len(imagenames)) )
# save
#print ('Saving cached annotations to {:s}'.format(cachefile))
#with open(cachefile, 'w') as f:
# cPickle.dump(recs, f)
#else:
# load
#with open(cachefile, 'r') as f:
# recs = cPickle.load(f)
# extract gt objects for this class
class_recs = {}
npos = 0
for imagename in imagenames:
R = [obj for obj in recs[imagename] if obj['name'] == classname]
bbox = np.array([x['bbox'] for x in R])
difficult = np.array([x['difficult'] for x in R]).astype(np.bool)
det = [False] * len(R)
npos = npos + sum(~difficult)
class_recs[imagename] = {'bbox': bbox,
'difficult': difficult,
'det': det}
# read dets
detfile = detpath.format(classname)
with open(detfile, 'r') as f:
lines = f.readlines()
splitlines = [x.strip().split(' ') for x in lines]
image_ids = [x[0] for x in splitlines]
confidence = np.array([float(x[1]) for x in splitlines])
#print('check confidence: ', confidence)
BB = np.array([[float(z) for z in x[2:]] for x in splitlines])
# sort by confidence
sorted_ind = np.argsort(-confidence)
sorted_scores = np.sort(-confidence)
#print('check sorted_scores: ', sorted_scores)
#print('check sorted_ind: ', sorted_ind)
BB = BB[sorted_ind, :]
image_ids = [image_ids[x] for x in sorted_ind]
#print('check imge_ids: ', image_ids)
#print('imge_ids len:', len(image_ids))
# go down dets and mark TPs and FPs
nd = len(image_ids)
tp = np.zeros(nd)
fp = np.zeros(nd)
for d in range(nd):
R = class_recs[image_ids[d]]
bb = BB[d, :].astype(float)
ovmax = -np.inf
BBGT = R['bbox'].astype(float)
if BBGT.size > 0:
# compute overlaps
# intersection
ixmin = np.maximum(BBGT[:, 0], bb[0])
iymin = np.maximum(BBGT[:, 1], bb[1])
ixmax = np.minimum(BBGT[:, 2], bb[2])
iymax = np.minimum(BBGT[:, 3], bb[3])
iw = np.maximum(ixmax - ixmin + 1., 0.)
ih = np.maximum(iymax - iymin + 1., 0.)
inters = iw * ih
# union
uni = ((bb[2] - bb[0] + 1.) * (bb[3] - bb[1] + 1.) +
(BBGT[:, 2] - BBGT[:, 0] + 1.) *
(BBGT[:, 3] - BBGT[:, 1] + 1.) - inters)
overlaps = inters / uni
ovmax = np.max(overlaps)
## if there exist 2
jmax = np.argmax(overlaps)
if ovmax > ovthresh:
if not R['difficult'][jmax]:
if not R['det'][jmax]:
tp[d] = 1.
R['det'][jmax] = 1
else:
fp[d] = 1.
# print('filename:', image_ids[d])
else:
fp[d] = 1.
# compute precision recall
print('check fp:', fp)
print('check tp', tp)
print('npos num:', npos)
fp = np.cumsum(fp)
tp = np.cumsum(tp)
rec = tp / float(npos)
# avoid divide by zero in case the first detection matches a difficult
# ground truth
prec = tp / np.maximum(tp + fp, np.finfo(np.float64).eps)
ap = voc_ap(rec, prec, use_07_metric)
return rec, prec, ap
def main():
# detpath = r'E:\documentation\OneDrive\documentation\DotaEvaluation\evluation_task2\evluation_task2\faster-rcnn-nms_0.3_task2\nms_0.3_task\Task2_{:s}.txt'
# annopath = r'I:\dota\testset\ReclabelTxt-utf-8\{:s}.txt'
# imagesetfile = r'I:\dota\testset\va.txt'
detpath = r'PATH_TO_BE_CONFIGURED/Task2_{:s}.txt'
annopath = r'PATH_TO_BE_CONFIGURED/{:s}.txt'# change the directory to the path of val/labelTxt, if you want to do evaluation on the valset
imagesetfile = r'PATH_TO_BE_CONFIGURED/valset.txt'
classnames = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter']
classaps = []
map = 0
for classname in classnames:
print('classname:', classname)
rec, prec, ap = voc_eval(detpath,
annopath,
imagesetfile,
classname,
ovthresh=0.5,
use_07_metric=True)
map = map + ap
#print('rec: ', rec, 'prec: ', prec, 'ap: ', ap)
print('ap: ', ap)
classaps.append(ap)
## uncomment to plot p-r curve for each category
# plt.figure(figsize=(8,4))
# plt.xlabel('recall')
# plt.ylabel('precision')
# plt.plot(rec, prec)
# plt.show()
map = map/len(classnames)
print('map:', map)
classaps = 100*np.array(classaps)
print('classaps: ', classaps)
if __name__ == '__main__':
main()
================================================
FILE: dota_utils.py
================================================
# -*- coding: utf-8 -*-
import sys
import codecs
import numpy as np
import shapely.geometry as shgeo
import os
import re
import math
# import polyiou
"""
some basic functions which are useful for process DOTA data
"""
# For DOTA v1.5
classnames_v1_5 = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter', 'container-crane']
wordname_15 = ['plane', 'baseball-diamond', 'bridge', 'ground-track-field', 'small-vehicle', 'large-vehicle', 'ship', 'tennis-court',
'basketball-court', 'storage-tank', 'soccer-ball-field', 'roundabout', 'harbor', 'swimming-pool', 'helicopter']
def custombasename(fullname):
return os.path.basename(os.path.splitext(fullname)[0])
def GetFileFromThisRootDir(dir,ext = None):
allfiles = []
needExtFilter = (ext != None)
for root,dirs,files in os.walk(dir):
for filespath in files:
filepath = os.path.join(root, filespath)
extension = os.path.splitext(filepath)[1][1:]
if needExtFilter and extension in ext:
allfiles.append(filepath)
elif not needExtFilter:
allfiles.append(filepath)
return allfiles
def TuplePoly2Poly(poly):
outpoly = [poly[0][0], poly[0][1],
poly[1][0], poly[1][1],
poly[2][0], poly[2][1],
poly[3][0], poly[3][1]
]
return outpoly
def parse_dota_poly(filename):
"""
parse the dota ground truth in the format:
[(x1, y1), (x2, y2), (x3, y3), (x4, y4)]
"""
objects = []
#print('filename:', filename)
f = []
if (sys.version_info >= (3, 5)):
fd = open(filename, 'r')
f = fd
elif (sys.version_info >= 2.7):
fd = codecs.open(filename, 'r')
f = fd
# count = 0
while True:
line = f.readline()
# count = count + 1
# if count < 2:
# continue
if line:
splitlines = line.strip().split(' ')
object_struct = {}
### clear the wrong name after check all the data
#if (len(splitlines) >= 9) and (splitlines[8] in classname):
if (len(splitlines) < 9):
continue
if (len(splitlines) >= 9):
object_struct['name'] = splitlines[8]
if (len(splitlines) == 9):
object_struct['difficult'] = '0'
elif (len(splitlines) >= 10):
# if splitlines[9] == '1':
# if (splitlines[9] == 'tr'):
# object_struct['difficult'] = '1'
# else:
object_struct['difficult'] = splitlines[9]
# else:
# object_struct['difficult'] = 0
object_struct['poly'] = [(float(splitlines[0]), float(splitlines[1])),
(float(splitlines[2]), float(splitlines[3])),
(float(splitlines[4]), float(splitlines[5])),
(float(splitlines[6]), float(splitlines[7]))
]
gtpoly = shgeo.Polygon(object_struct['poly'])
object_struct['area'] = gtpoly.area
# poly = list(map(lambda x:np.array(x), object_struct['poly']))
# object_struct['long-axis'] = max(distance(poly[0], poly[1]), distance(poly[1], poly[2]))
# object_struct['short-axis'] = min(distance(poly[0], poly[1]), distance(poly[1], poly[2]))
# if (object_struct['long-axis'] < 15):
# object_struct['difficult'] = '1'
# global small_count
# small_count = small_count + 1
objects.append(object_struct)
else:
break
return objects
def parse_longsideformat(filename): # filename=??.txt
"""
parse the longsideformat ground truth in the format:
objects[i] : [classid, x_c, y_c, longside, shortside, theta]
"""
objects = []
f = []
if (sys.version_info >= (3, 5)):
fd = open(filename, 'r')
f = fd
elif (sys.version_info >= 2.7):
fd = codecs.open(filename, 'r')
f = fd
# count = 0
while True:
line = f.readline()
if line:
splitlines = line.strip().split(' ')
object_struct = {}
### clear the wrong name after check all the data
#if (len(splitlines) >= 9) and (splitlines[8] in classname):
if (len(splitlines) < 6) or (len(splitlines) > 6):
print('labels长度不为6,出现错误,与预定形式不符')
continue
object_struct = [int(splitlines[0]), float(splitlines[1]),
float(splitlines[2]), float(splitlines[3]),
float(splitlines[4]), float(splitlines[5])
]
objects.append(object_struct)
else:
break
return objects
def parse_dota_poly2(filename):
"""
parse the dota ground truth in the format:
[x1, y1, x2, y2, x3, y3, x4, y4]
"""
objects = parse_dota_poly(filename)
for obj in objects:
obj['poly'] = TuplePoly2Poly(obj['poly'])
obj['poly'] = list(map(int, obj['poly']))
return objects
def parse_dota_rec(filename):
"""
parse the dota ground truth in the bounding box format:
"xmin, ymin, xmax, ymax"
"""
objects = parse_dota_poly(filename)
for obj in objects:
poly = obj['poly']
bbox = dots4ToRec4(poly)
obj['bndbox'] = bbox
return objects
## bounding box transfer for varies format
def dots4ToRec4(poly):
"""
求出poly四点的最小外接水平矩形
@param poly: poly[4] [x,y]
@return: xmin,xmax,ymin,ymax
"""
xmin, xmax, ymin, ymax = min(poly[0][0], min(poly[1][0], min(poly[2][0], poly[3][0]))), \
max(poly[0][0], max(poly[1][0], max(poly[2][0], poly[3][0]))), \
min(poly[0][1], min(poly[1][1], min(poly[2][1], poly[3][1]))), \
max(poly[0][1], max(poly[1][1], max(poly[2][1], poly[3][1])))
return xmin, ymin, xmax, ymax
def dots4ToRec8(poly):
xmin, ymin, xmax, ymax = dots4ToRec4(poly)
return xmin, ymin, xmax, ymin, xmax, ymax, xmin, ymax
#return dots2ToRec8(dots4ToRec4(poly))
def dots2ToRec8(rec):
xmin, ymin, xmax, ymax = rec[0], rec[1], rec[2], rec[3]
return xmin, ymin, xmax, ymin, xmax, ymax, xmin, ymax
def groundtruth2Task1(srcpath, dstpath):
filelist = GetFileFromThisRootDir(srcpath)
# names = [custombasename(x.strip())for x in filelist]
filedict = {}
for cls in wordname_15:
fd = open(os.path.join(dstpath, 'Task1_') + cls + r'.txt', 'w')
filedict[cls] = fd
for filepath in filelist:
objects = parse_dota_poly2(filepath)
subname = custombasename(filepath)
pattern2 = re.compile(r'__([\d+\.]+)__\d+___')
rate = re.findall(pattern2, subname)[0]
for obj in objects:
category = obj['name']
difficult = obj['difficult']
poly = obj['poly']
if difficult == '2':
continue
if rate == '0.5':
outline = custombasename(filepath) + ' ' + '1' + ' ' + ' '.join(map(str, poly))
elif rate == '1':
outline = custombasename(filepath) + ' ' + '0.8' + ' ' + ' '.join(map(str, poly))
elif rate == '2':
outline = custombasename(filepath) + ' ' + '0.6' + ' ' + ' '.join(map(str, poly))
filedict[category].write(outline + '\n')
def Task2groundtruth_poly(srcpath, dstpath):
thresh = 0.1
filedict = {}
Tasklist = GetFileFromThisRootDir(srcpath, '.txt')
for Taskfile in Tasklist:
idname = custombasename(Taskfile).split('_')[-1]
# idname = datamap_inverse[idname]
f = open(Taskfile, 'r')
lines = f.readlines()
for line in lines:
if len(line) == 0:
continue
# print('line:', line)
splitline = line.strip().split(' ')
filename = splitline[0]
confidence = splitline[1]
bbox = splitline[2:]
if float(confidence) > thresh:
if filename not in filedict:
# filedict[filename] = codecs.open(os.path.join(dstpath, filename + '.txt'), 'w', 'utf_16')
filedict[filename] = codecs.open(os.path.join(dstpath, filename + '.txt'), 'w')
# poly = util.dots2ToRec8(bbox)
poly = bbox
# filedict[filename].write(' '.join(poly) + ' ' + idname + '_' + str(round(float(confidence), 2)) + '\n')
# print('idname:', idname)
# filedict[filename].write(' '.join(poly) + ' ' + idname + '_' + str(round(float(confidence), 2)) + '\n')
filedict[filename].write(' '.join(poly) + ' ' + idname + '\n')
def polygonToRotRectangle(bbox):
"""
:param bbox: The polygon stored in format [x1, y1, x2, y2, x3, y3, x4, y4]
:return: Rotated Rectangle in format [cx, cy, w, h, theta]
"""
bbox = np.array(bbox,dtype=np.float32)
bbox = np.reshape(bbox,newshape=(2,4),order='F')
angle = math.atan2(-(bbox[0,1]-bbox[0,0]),bbox[1,1]-bbox[1,0])
center = [[0],[0]]
for i in range(4):
center[0] += bbox[0,i]
center[1] += bbox[1,i]
center = np.array(center,dtype=np.float32)/4.0
R = np.array([[math.cos(angle), -math.sin(angle)], [math.sin(angle), math.cos(angle)]], dtype=np.float32)
normalized = np.matmul(R.transpose(),bbox-center)
xmin = np.min(normalized[0,:])
xmax = np.max(normalized[0,:])
ymin = np.min(normalized[1,:])
ymax = np.max(normalized[1,:])
w = xmax - xmin + 1
h = ymax - ymin + 1
return [float(center[0]),float(center[1]),w,h,angle]
def cal_line_length(point1, point2):
return math.sqrt( math.pow(point1[0] - point2[0], 2) + math.pow(point1[1] - point2[1], 2))
def get_best_begin_point(coordinate):
x1 = coordinate[0][0]
y1 = coordinate[0][1]
x2 = coordinate[1][0]
y2 = coordinate[1][1]
x3 = coordinate[2][0]
y3 = coordinate[2][1]
x4 = coordinate[3][0]
y4 = coordinate[3][1]
xmin = min(x1, x2, x3, x4)
ymin = min(y1, y2, y3, y4)
xmax = max(x1, x2, x3, x4)
ymax = max(y1, y2, y3, y4)
combinate = [[[x1, y1], [x2, y2], [x3, y3], [x4, y4]], [[x2, y2], [x3, y3], [x4, y4], [x1, y1]],
[[x3, y3], [x4, y4], [x1, y1], [x2, y2]], [[x4, y4], [x1, y1], [x2, y2], [x3, y3]]]
dst_coordinate = [[xmin, ymin], [xmax, ymin], [xmax, ymax], [xmin, ymax]]
force = 100000000.0
force_flag = 0
for i in range(4):
temp_force = cal_line_length(combinate[i][0], dst_coordinate[0]) + cal_line_length(combinate[i][1],
dst_coordinate[
1]) + cal_line_length(
combinate[i][2], dst_coordinate[2]) + cal_line_length(combinate[i][3], dst_coordinate[3])
if temp_force < force:
force = temp_force
force_flag = i
if force_flag != 0:
print("choose one direction!")
return combinate[force_flag]
def dots4ToRecC(poly, img_w, img_h):
"""
求poly四点坐标的最小外接水平矩形,并返回yolo格式的矩形框表现形式xywh_center(归一化)
@param poly: poly – poly[4] [x,y]
@param img_w: 对应图像的width
@param img_h: 对应图像的height
@return: x_center,y_center,w,h(均归一化)
"""
xmin, ymin, xmax, ymax = dots4ToRec4(poly)
x = (xmin + xmax)/2
y = (ymin + ymax)/2
w = xmax - xmin
h = ymax - ymin
return x/img_w, y/img_h, w/img_w, h/img_h
================================================
FILE: evaluation_example/imgnamefile.txt
================================================
P0007
P0004
P0019
P0003
================================================
FILE: evaluation_example/result_classname/Task1_harbor.txt
================================================
P0019 0.64 2390.0 566.0 2381.0 380.0 2439.0 377.0 2448.0 563.0
P0019 0.626 5124.0 844.0 5058.0 844.0 5059.0 693.0 5125.0 693.0
P0019 0.609 1817.0 762.0 1759.0 759.0 1770.0 557.0 1828.0 560.0
P0019 0.604 718.0 2313.0 667.0 2299.0 695.0 2200.0 746.0 2214.0
P0019 0.596 4532.0 3283.0 4487.0 3281.0 4491.0 3190.0 4536.0 3192.0
P0019 0.591 3425.0 777.0 3390.0 770.0 3412.0 646.0 3447.0 653.0
P0019 0.586 5218.0 762.0 5178.0 759.0 5187.0 661.0 5227.0 664.0
P0019 0.586 4650.0 3320.0 4596.0 3313.0 4613.0 3193.0 4667.0 3200.0
P0019 0.579 4594.0 897.0 4585.0 757.0 4633.0 754.0 4642.0 894.0
P0019 0.566 3058.0 3462.0 3022.0 3459.0 3029.0 3351.0 3065.0 3354.0
P0019 0.565 3839.0 3406.0 3837.0 3286.0 3896.0 3285.0 3898.0 3405.0
P0019 0.562 3333.0 740.0 3279.0 734.0 3294.0 591.0 3348.0 597.0
P0019 0.562 5654.0 3545.0 5649.0 3433.0 5697.0 3430.0 5702.0 3542.0
P0019 0.562 2852.0 452.0 2820.0 450.0 2825.0 369.0 2857.0 371.0
P0019 0.561 3579.0 3487.0 3568.0 3366.0 3616.0 3362.0 3627.0 3483.0
P0019 0.561 478.0 2229.0 446.0 2211.0 505.0 2106.0 537.0 2124.0
P0019 0.546 1787.0 2727.0 1729.0 2704.0 1772.0 2594.0 1830.0 2617.0
P0019 0.541 4302.0 3275.0 4254.0 3274.0 4259.0 3160.0 4307.0 3161.0
P0019 0.538 1086.0 856.0 1042.0 752.0 1089.0 733.0 1133.0 837.0
P0019 0.533 4019.0 921.0 3951.0 909.0 3976.0 774.0 4044.0 786.0
P0019 0.527 5481.0 3570.0 5471.0 3365.0 5522.0 3363.0 5532.0 3568.0
P0019 0.523 359.0 1530.0 180.0 1514.0 184.0 1469.0 363.0 1485.0
P0019 0.523 391.0 1321.0 259.0 1273.0 278.0 1222.0 410.0 1270.0
P0019 0.51 5357.0 807.0 5319.0 802.0 5338.0 668.0 5376.0 673.0
P0019 0.508 469.0 1141.0 344.0 1059.0 370.0 1018.0 495.0 1100.0
P0019 0.508 2432.0 3107.0 2390.0 3096.0 2423.0 2964.0 2465.0 2975.0
P0019 0.507 6071.0 2214.0 6068.0 2152.0 6230.0 2143.0 6233.0 2205.0
P0019 0.505 6266.0 2873.0 6081.0 2866.0 6083.0 2822.0 6268.0 2829.0
P0019 0.499 6212.0 3122.0 6077.0 3056.0 6101.0 3007.0 6236.0 3073.0
P0019 0.491 6150.0 1772.0 5995.0 1771.0 5995.0 1703.0 6150.0 1704.0
P0019 0.489 3478.0 3490.0 3425.0 3485.0 3441.0 3303.0 3494.0 3308.0
P0019 0.486 6007.0 2058.0 6004.0 1992.0 6186.0 1983.0 6189.0 2049.0
P0019 0.48 5765.0 3464.0 5757.0 3340.0 5806.0 3337.0 5814.0 3461.0
P0019 0.475 206.0 1712.0 204.0 1674.0 353.0 1663.0 355.0 1701.0
P0019 0.468 6206.0 2640.0 6052.0 2635.0 6053.0 2587.0 6207.0 2592.0
P0019 0.467 842.0 854.0 818.0 852.0 827.0 717.0 851.0 719.0
P0019 0.444 577.0 2236.0 538.0 2210.0 586.0 2139.0 625.0 2165.0
P0019 0.442 5244.0 3470.0 5212.0 3470.0 5215.0 3355.0 5247.0 3355.0
P0019 0.438 574.0 997.0 464.0 886.0 483.0 868.0 593.0 979.0
P0019 0.436 3665.0 3463.0 3643.0 3410.0 3704.0 3386.0 3726.0 3439.0
P0019 0.419 4874.0 3361.0 4868.0 3260.0 4915.0 3258.0 4921.0 3359.0
P0019 0.379 3299.0 3501.0 3252.0 3476.0 3293.0 3394.0 3340.0 3419.0
P0019 0.376 4798.0 740.0 4795.0 693.0 4813.0 693.0 4816.0 740.0
P0019 0.364 635.0 899.0 602.0 767.0 656.0 754.0 689.0 886.0
P0019 0.362 1431.0 813.0 1397.0 813.0 1400.0 686.0 1434.0 686.0
P0019 0.357 378.0 2122.0 363.0 2099.0 441.0 2049.0 456.0 2072.0
P0019 0.336 961.0 832.0 935.0 830.0 942.0 733.0 968.0 735.0
P0019 0.333 4827.0 729.0 4825.0 700.0 4872.0 696.0 4874.0 725.0
P0019 0.332 5124.0 3471.0 5064.0 3470.0 5067.0 3332.0 5127.0 3333.0
P0019 0.312 1488.0 2551.0 1484.0 2470.0 1511.0 2468.0 1515.0 2549.0
P0019 0.296 2616.0 3222.0 2582.0 3210.0 2609.0 3133.0 2643.0 3145.0
P0019 0.277 5488.0 857.0 5460.0 850.0 5503.0 678.0 5531.0 685.0
P0019 0.271 6188.0 2434.0 6012.0 2430.0 6013.0 2405.0 6189.0 2409.0
P0019 0.27 2654.0 422.0 2639.0 420.0 2643.0 375.0 2658.0 377.0
P0019 0.265 6228.0 3266.0 5978.0 3221.0 5985.0 3177.0 6235.0 3222.0
================================================
FILE: evaluation_example/result_classname/Task1_large-vehicle.txt
================================================
P0007 0.724 1223.0 682.0 1073.0 573.0 1088.0 551.0 1238.0 660.0
P0007 0.722 957.0 688.0 924.0 686.0 934.0 513.0 967.0 515.0
P0007 0.721 854.0 1631.0 829.0 1610.0 945.0 1468.0 970.0 1489.0
P0007 0.714 1232.0 943.0 1103.0 823.0 1121.0 804.0 1250.0 924.0
P0007 0.701 1212.0 727.0 1067.0 609.0 1083.0 588.0 1228.0 706.0
P0007 0.693 1192.0 1022.0 1080.0 884.0 1101.0 867.0 1213.0 1005.0
P0007 0.69 1223.0 607.0 1066.0 509.0 1080.0 488.0 1237.0 586.0
P0007 0.679 1205.0 839.0 1066.0 723.0 1082.0 704.0 1221.0 820.0
P0007 0.675 1168.0 1259.0 1048.0 1146.0 1065.0 1128.0 1185.0 1241.0
P0007 0.675 1177.0 1232.0 1054.0 1095.0 1074.0 1077.0 1197.0 1214.0
P0007 0.672 1219.0 806.0 1078.0 695.0 1092.0 677.0 1233.0 788.0
P0007 0.671 965.0 483.0 939.0 482.0 948.0 308.0 974.0 309.0
P0007 0.669 1186.0 1069.0 1076.0 932.0 1095.0 916.0 1205.0 1053.0
P0007 0.666 1138.0 1632.0 966.0 1622.0 967.0 1599.0 1139.0 1609.0
P0007 0.666 849.0 1573.0 673.0 1564.0 674.0 1540.0 850.0 1549.0
P0007 0.649 997.0 485.0 966.0 485.0 970.0 304.0 1001.0 304.0
P0007 0.647 667.0 1424.0 493.0 1414.0 494.0 1391.0 668.0 1401.0
P0007 0.643 361.0 1289.0 183.0 1289.0 184.0 1264.0 362.0 1264.0
P0007 0.643 332.0 1854.0 153.0 1850.0 153.0 1825.0 332.0 1829.0
P0007 0.643 840.0 1661.0 664.0 1651.0 665.0 1626.0 841.0 1636.0
P0007 0.639 1235.0 344.0 1052.0 298.0 1058.0 275.0 1241.0 321.0
P0007 0.639 1157.0 1286.0 1027.0 1180.0 1044.0 1159.0 1174.0 1265.0
P0007 0.638 352.0 1379.0 174.0 1369.0 175.0 1344.0 353.0 1354.0
P0007 0.638 666.0 1538.0 488.0 1528.0 489.0 1505.0 667.0 1515.0
P0007 0.637 661.0 1594.0 481.0 1590.0 482.0 1565.0 662.0 1569.0
P0007 0.637 650.0 1647.0 474.0 1644.0 475.0 1620.0 651.0 1623.0
P0007 0.636 1151.0 1405.0 968.0 1395.0 970.0 1370.0 1153.0 1380.0
P0007 0.635 841.0 1630.0 660.0 1620.0 662.0 1595.0 843.0 1605.0
P0007 0.63 937.0 485.0 906.0 484.0 916.0 306.0 947.0 307.0
P0007 0.629 841.0 1514.0 673.0 1505.0 674.0 1483.0 842.0 1492.0
P0007 0.628 670.0 1480.0 491.0 1471.0 493.0 1447.0 672.0 1456.0
P0007 0.628 1197.0 1205.0 1069.0 1077.0 1086.0 1060.0 1214.0 1188.0
P0007 0.628 1145.0 1521.0 961.0 1511.0 962.0 1486.0 1146.0 1496.0
P0007 0.624 1081.0 1544.0 953.0 1542.0 954.0 1517.0 1082.0 1519.0
P0007 0.622 1191.0 1164.0 1070.0 1029.0 1088.0 1013.0 1209.0 1148.0
P0007 0.617 343.0 1666.0 161.0 1657.0 162.0 1633.0 344.0 1642.0
P0007 0.616 1152.0 1376.0 973.0 1367.0 975.0 1343.0 1154.0 1352.0
P0007 0.615 1248.0 258.0 1063.0 255.0 1063.0 231.0 1248.0 234.0
P0007 0.613 358.0 1348.0 175.0 1339.0 177.0 1315.0 360.0 1324.0
P0007 0.612 346.0 1549.0 168.0 1540.0 169.0 1518.0 347.0 1527.0
P0007 0.612 347.0 1522.0 167.0 1512.0 168.0 1489.0 348.0 1499.0
P0007 0.61 904.0 813.0 741.0 801.0 743.0 776.0 906.0 788.0
P0007 0.608 660.0 1676.0 481.0 1673.0 481.0 1649.0 660.0 1652.0
P0007 0.607 1135.0 1694.0 957.0 1684.0 958.0 1659.0 1136.0 1669.0
P0007 0.606 913.0 855.0 738.0 846.0 740.0 823.0 915.0 831.0
P0007 0.606 845.0 1485.0 667.0 1476.0 668.0 1452.0 846.0 1461.0
P0007 0.605 334.0 1809.0 158.0 1805.0 159.0 1782.0 335.0 1786.0
P0007 0.605 1145.0 1462.0 965.0 1453.0 966.0 1429.0 1146.0 1438.0
P0007 0.605 1248.0 294.0 1057.0 280.0 1059.0 255.0 1250.0 269.0
P0007 0.604 665.0 1567.0 488.0 1557.0 490.0 1532.0 667.0 1542.0
P0007 0.603 342.0 1435.0 172.0 1425.0 173.0 1402.0 343.0 1412.0
P0007 0.601 1243.0 445.0 1069.0 391.0 1076.0 368.0 1250.0 422.0
P0007 0.6 569.0 1037.0 380.0 1037.0 380.0 1006.0 569.0 1006.0
P0007 0.599 349.0 1404.0 171.0 1395.0 172.0 1371.0 350.0 1380.0
P0007 0.594 886.0 479.0 859.0 478.0 865.0 340.0 892.0 341.0
P0007 0.592 884.0 657.0 856.0 655.0 863.0 532.0 891.0 534.0
P0007 0.591 905.0 1124.0 743.0 1123.0 744.0 1097.0 906.0 1098.0
P0007 0.59 841.0 1456.0 667.0 1447.0 668.0 1423.0 842.0 1432.0
P0007 0.587 851.0 1370.0 676.0 1370.0 676.0 1347.0 851.0 1347.0
P0007 0.587 1137.0 1661.0 957.0 1651.0 958.0 1628.0 1138.0 1638.0
P0007 0.586 1248.0 229.0 1064.0 229.0 1065.0 204.0 1249.0 204.0
P0007 0.584 902.0 897.0 743.0 888.0 745.0 864.0 904.0 873.0
P0007 0.583 332.0 1578.0 176.0 1569.0 177.0 1547.0 333.0 1556.0
P0007 0.581 1198.0 973.0 1084.0 846.0 1105.0 828.0 1219.0 955.0
P0007 0.578 1414.0 1203.0 1389.0 1201.0 1393.0 1112.0 1418.0 1114.0
P0007 0.571 850.0 1398.0 680.0 1397.0 681.0 1373.0 851.0 1374.0
P0007 0.569 341.0 1695.0 157.0 1685.0 158.0 1662.0 342.0 1672.0
P0007 0.562 1236.0 379.0 1055.0 330.0 1061.0 306.0 1242.0 355.0
P0007 0.561 838.0 1718.0 652.0 1707.0 653.0 1681.0 839.0 1692.0
P0007 0.558 1226.0 498.0 1078.0 453.0 1085.0 433.0 1233.0 478.0
P0007 0.558 1148.0 1605.0 964.0 1595.0 965.0 1572.0 1149.0 1582.0
P0007 0.557 345.0 1462.0 171.0 1456.0 172.0 1433.0 346.0 1439.0
P0007 0.549 1180.0 160.0 1075.0 153.0 1077.0 129.0 1182.0 136.0
P0007 0.548 686.0 1367.0 491.0 1364.0 491.0 1340.0 686.0 1343.0
P0007 0.545 1150.0 1436.0 966.0 1426.0 967.0 1401.0 1151.0 1411.0
P0007 0.543 681.0 1397.0 495.0 1387.0 496.0 1364.0 682.0 1374.0
P0007 0.543 845.0 1342.0 659.0 1339.0 660.0 1315.0 846.0 1318.0
P0007 0.542 347.0 1491.0 169.0 1482.0 170.0 1460.0 348.0 1469.0
P0007 0.537 655.0 1623.0 473.0 1616.0 474.0 1594.0 656.0 1601.0
P0007 0.536 1249.0 199.0 1067.0 199.0 1068.0 174.0 1250.0 174.0
P0007 0.535 340.0 1719.0 152.0 1712.0 153.0 1688.0 341.0 1695.0
P0007 0.535 1212.0 765.0 1081.0 659.0 1095.0 642.0 1226.0 748.0
P0007 0.532 1197.0 1122.0 1072.0 997.0 1088.0 981.0 1213.0 1106.0
P0007 0.525 657.0 1709.0 473.0 1700.0 474.0 1674.0 658.0 1683.0
P0007 0.525 283.0 447.0 218.0 442.0 220.0 420.0 285.0 425.0
P0007 0.524 330.0 1605.0 162.0 1595.0 163.0 1572.0 331.0 1582.0
P0007 0.521 1126.0 1843.0 956.0 1834.0 957.0 1810.0 1127.0 1819.0
P0007 0.52 1135.0 1811.0 941.0 1800.0 942.0 1772.0 1136.0 1783.0
P0007 0.519 850.0 1090.0 838.0 1057.0 1017.0 995.0 1029.0 1028.0
P0007 0.518 1153.0 1349.0 972.0 1336.0 974.0 1312.0 1155.0 1325.0
P0007 0.512 1040.0 792.0 1000.0 792.0 1001.0 637.0 1041.0 637.0
P0007 0.503 666.0 1505.0 488.0 1502.0 489.0 1480.0 667.0 1483.0
P0007 0.492 1082.0 1573.0 948.0 1569.0 949.0 1544.0 1083.0 1548.0
P0007 0.479 555.0 1734.0 476.0 1733.0 476.0 1707.0 555.0 1708.0
P0007 0.475 344.0 1640.0 165.0 1630.0 167.0 1605.0 346.0 1615.0
P0007 0.473 362.0 1265.0 184.0 1256.0 185.0 1232.0 363.0 1241.0
P0007 0.471 334.0 1779.0 155.0 1778.0 155.0 1754.0 334.0 1755.0
P0007 0.468 696.0 1739.0 607.0 1735.0 609.0 1710.0 698.0 1714.0
P0007 0.468 1240.0 472.0 1064.0 418.0 1071.0 397.0 1247.0 451.0
P0007 0.467 1386.0 1197.0 1361.0 1195.0 1367.0 1114.0 1392.0 1116.0
P0007 0.466 796.0 1769.0 713.0 1765.0 715.0 1740.0 798.0 1744.0
P0007 0.449 1137.0 1781.0 945.0 1771.0 946.0 1746.0 1138.0 1756.0
P0007 0.439 639.0 766.0 543.0 760.0 544.0 739.0 640.0 745.0
P0007 0.427 628.0 958.0 526.0 955.0 527.0 933.0 629.0 936.0
P0007 0.426 56.0 1919.0 29.0 1916.0 37.0 1816.0 64.0 1819.0
P0007 0.425 359.0 1320.0 183.0 1310.0 184.0 1287.0 360.0 1297.0
P0007 0.387 704.0 194.0 678.0 192.0 683.0 127.0 709.0 129.0
P0007 0.36 287.0 1875.0 155.0 1875.0 156.0 1854.0 288.0 1854.0
P0007 0.334 834.0 394.0 832.0 331.0 855.0 331.0 857.0 394.0
P0007 0.327 294.0 1752.0 155.0 1742.0 157.0 1719.0 296.0 1729.0
P0007 0.306 489.0 198.0 467.0 198.0 468.0 155.0 490.0 155.0
P0007 0.294 1100.0 1714.0 1030.0 1714.0 1031.0 1693.0 1101.0 1693.0
P0007 0.285 555.0 194.0 527.0 193.0 530.0 129.0 558.0 130.0
P0007 0.281 1069.0 1747.0 961.0 1744.0 962.0 1718.0 1070.0 1721.0
P0007 0.275 617.0 192.0 592.0 191.0 596.0 135.0 621.0 136.0
P0007 0.26 654.0 193.0 628.0 191.0 633.0 126.0 659.0 128.0
P0007 0.258 623.0 1118.0 509.0 1113.0 510.0 1087.0 624.0 1092.0
P0007 0.254 734.0 189.0 708.0 187.0 713.0 122.0 739.0 124.0
P0003 0.713 301.0 524.0 211.0 474.0 224.0 453.0 314.0 503.0
P0003 0.711 573.0 329.0 552.0 229.0 576.0 224.0 597.0 324.0
P0003 0.701 659.0 309.0 638.0 209.0 662.0 204.0 683.0 304.0
P0003 0.7 398.0 358.0 378.0 256.0 403.0 251.0 423.0 353.0
P0003 0.693 539.0 333.0 522.0 234.0 546.0 230.0 563.0 329.0
P0003 0.688 769.0 574.0 762.0 550.0 860.0 521.0 867.0 545.0
P0003 0.688 499.0 342.0 475.0 239.0 498.0 233.0 522.0 336.0
P0003 0.668 372.0 365.0 351.0 265.0 375.0 260.0 396.0 360.0
P0003 0.662 779.0 903.0 754.0 901.0 758.0 814.0 783.0 816.0
P0003 0.661 602.0 325.0 582.0 221.0 607.0 216.0 627.0 320.0
P0003 0.648 339.0 362.0 320.0 272.0 344.0 267.0 363.0 357.0
P0003 0.646 323.0 629.0 226.0 575.0 238.0 554.0 335.0 608.0
P0003 0.646 817.0 899.0 810.0 798.0 836.0 796.0 843.0 897.0
P0003 0.636 306.0 356.0 290.0 272.0 313.0 267.0 329.0 351.0
P0003 0.622 328.0 664.0 229.0 612.0 241.0 591.0 340.0 643.0
P0003 0.604 635.0 523.0 572.0 518.0 574.0 494.0 637.0 499.0
P0003 0.592 629.0 606.0 531.0 606.0 532.0 581.0 630.0 581.0
P0003 0.582 240.0 329.0 190.0 300.0 201.0 280.0 251.0 309.0
P0003 0.566 537.0 488.0 473.0 487.0 474.0 463.0 538.0 464.0
P0003 0.562 239.0 390.0 188.0 364.0 198.0 343.0 249.0 369.0
P0003 0.551 255.0 462.0 202.0 437.0 212.0 415.0 265.0 440.0
P0003 0.545 247.0 429.0 197.0 401.0 208.0 380.0 258.0 408.0
P0003 0.54 331.0 850.0 272.0 844.0 274.0 821.0 333.0 827.0
P0003 0.532 317.0 822.0 265.0 794.0 276.0 773.0 328.0 801.0
P0003 0.527 790.0 894.0 786.0 832.0 811.0 831.0 815.0 893.0
P0003 0.505 838.0 628.0 828.0 606.0 883.0 583.0 893.0 605.0
P0003 0.493 692.0 960.0 631.0 958.0 631.0 935.0 692.0 937.0
P0003 0.488 624.0 549.0 566.0 549.0 567.0 526.0 625.0 526.0
P0003 0.487 500.0 550.0 499.0 524.0 561.0 521.0 562.0 547.0
P0003 0.464 548.0 517.0 486.0 516.0 487.0 492.0 549.0 493.0
P0003 0.463 659.0 575.0 597.0 575.0 598.0 552.0 660.0 552.0
P0003 0.443 304.0 709.0 252.0 684.0 261.0 664.0 313.0 689.0
P0003 0.412 181.0 275.0 157.0 161.0 182.0 156.0 206.0 270.0
P0003 0.38 868.0 904.0 843.0 902.0 847.0 843.0 872.0 845.0
P0003 0.377 737.0 906.0 714.0 905.0 718.0 849.0 741.0 850.0
P0003 0.325 5.0 885.0 4.0 865.0 44.0 862.0 45.0 882.0
P0003 0.306 157.0 89.0 142.0 5.0 168.0 0.0 183.0 84.0
P0003 0.288 305.0 782.0 265.0 759.0 276.0 739.0 316.0 762.0
P0003 0.281 231.0 264.0 221.0 207.0 244.0 203.0 254.0 260.0
P0003 0.253 236.0 77.0 222.0 6.0 253.0 0.0 267.0 71.0
P0004 0.695 511.0 918.0 510.0 895.0 594.0 889.0 595.0 912.0
P0004 0.626 152.0 523.0 148.0 501.0 257.0 480.0 261.0 502.0
P0004 0.619 620.0 574.0 488.0 565.0 489.0 543.0 621.0 552.0
P0004 0.617 607.0 526.0 507.0 518.0 508.0 497.0 608.0 505.0
P0004 0.612 624.0 500.0 508.0 499.0 509.0 477.0 625.0 478.0
P0004 0.611 337.0 1352.0 303.0 1351.0 306.0 1179.0 340.0 1180.0
P0004 0.611 457.0 954.0 455.0 930.0 626.0 919.0 628.0 943.0
P0004 0.61 434.0 1183.0 432.0 1161.0 561.0 1152.0 563.0 1174.0
P0004 0.606 167.0 678.0 167.0 656.0 286.0 655.0 286.0 677.0
P0004 0.6 519.0 475.0 518.0 454.0 602.0 452.0 603.0 473.0
P0004 0.577 515.0 196.0 497.0 181.0 560.0 107.0 578.0 122.0
P0004 0.577 141.0 469.0 137.0 445.0 258.0 425.0 262.0 448.0
P0004 0.555 604.0 1291.0 471.0 1291.0 471.0 1268.0 604.0 1268.0
P0004 0.545 174.0 605.0 173.0 583.0 271.0 578.0 272.0 600.0
P0004 0.543 247.0 187.0 232.0 91.0 256.0 88.0 271.0 184.0
P0004 0.542 480.0 1259.0 479.0 1237.0 579.0 1234.0 580.0 1256.0
P0004 0.54 274.0 758.0 156.0 757.0 157.0 735.0 275.0 736.0
P0004 0.535 148.0 1024.0 147.0 1003.0 277.0 1001.0 278.0 1022.0
P0004 0.534 133.0 500.0 129.0 477.0 256.0 455.0 260.0 478.0
P0004 0.529 381.0 685.0 356.0 682.0 366.0 586.0 391.0 589.0
P0004 0.528 151.0 580.0 146.0 558.0 262.0 531.0 267.0 553.0
P0004 0.527 612.0 548.0 507.0 541.0 509.0 521.0 614.0 528.0
P0004 0.527 629.0 622.0 500.0 613.0 502.0 591.0 631.0 600.0
P0004 0.526 167.0 440.0 164.0 418.0 260.0 405.0 263.0 427.0
P0004 0.525 163.0 548.0 159.0 526.0 260.0 505.0 264.0 527.0
P0004 0.505 606.0 686.0 523.0 680.0 525.0 657.0 608.0 663.0
P0004 0.505 148.0 393.0 145.0 372.0 243.0 356.0 246.0 377.0
P0004 0.502 146.0 415.0 143.0 394.0 241.0 382.0 244.0 403.0
P0004 0.501 376.0 710.0 319.0 710.0 319.0 689.0 376.0 689.0
P0004 0.498 479.0 1108.0 477.0 1087.0 596.0 1079.0 598.0 1100.0
P0004 0.483 125.0 325.0 123.0 304.0 222.0 290.0 224.0 311.0
P0004 0.483 271.0 878.0 150.0 878.0 150.0 857.0 271.0 857.0
P0004 0.48 156.0 830.0 155.0 810.0 275.0 803.0 276.0 823.0
P0004 0.478 155.0 633.0 154.0 612.0 272.0 604.0 273.0 625.0
P0004 0.477 150.0 951.0 149.0 930.0 279.0 924.0 280.0 945.0
P0004 0.475 415.0 186.0 412.0 90.0 434.0 89.0 437.0 185.0
P0004 0.474 481.0 1081.0 479.0 1059.0 606.0 1050.0 608.0 1072.0
P0004 0.471 327.0 181.0 312.0 84.0 334.0 80.0 349.0 177.0
P0004 0.469 511.0 223.0 507.0 200.0 620.0 182.0 624.0 205.0
P0004 0.468 149.0 1047.0 148.0 1026.0 278.0 1024.0 279.0 1045.0
P0004 0.462 150.0 999.0 150.0 978.0 279.0 976.0 279.0 997.0
P0004 0.454 155.0 977.0 154.0 956.0 282.0 950.0 283.0 971.0
P0004 0.451 158.0 804.0 157.0 784.0 273.0 779.0 274.0 799.0
P0004 0.451 138.0 368.0 136.0 347.0 239.0 335.0 241.0 356.0
P0004 0.448 391.0 186.0 384.0 90.0 406.0 89.0 413.0 185.0
P0004 0.438 491.0 1204.0 489.0 1183.0 620.0 1175.0 622.0 1196.0
P0004 0.43 516.0 452.0 515.0 431.0 627.0 425.0 628.0 446.0
P0004 0.423 260.0 714.0 148.0 713.0 149.0 691.0 261.0 692.0
P0004 0.422 152.0 1204.0 151.0 1182.0 283.0 1173.0 284.0 1195.0
P0004 0.421 509.0 428.0 508.0 406.0 636.0 399.0 637.0 421.0
P0004 0.42 286.0 183.0 272.0 87.0 293.0 84.0 307.0 180.0
P0004 0.412 167.0 653.0 166.0 634.0 274.0 628.0 275.0 647.0
P0004 0.411 102.0 979.0 98.0 924.0 119.0 922.0 123.0 977.0
P0004 0.409 149.0 927.0 148.0 907.0 278.0 900.0 279.0 920.0
P0004 0.408 156.0 1124.0 155.0 1103.0 285.0 1095.0 286.0 1116.0
P0004 0.403 151.0 1075.0 150.0 1055.0 278.0 1048.0 279.0 1068.0
P0004 0.401 368.0 183.0 358.0 86.0 379.0 84.0 389.0 181.0
P0004 0.401 479.0 184.0 476.0 89.0 498.0 89.0 501.0 184.0
P0004 0.393 276.0 900.0 148.0 899.0 149.0 879.0 277.0 880.0
P0004 0.391 133.0 346.0 131.0 327.0 230.0 315.0 232.0 334.0
P0004 0.388 510.0 380.0 509.0 359.0 605.0 353.0 606.0 374.0
P0004 0.382 459.0 188.0 458.0 92.0 480.0 91.0 481.0 187.0
P0004 0.374 75.0 451.0 69.0 382.0 92.0 380.0 98.0 449.0
P0004 0.37 155.0 1099.0 154.0 1080.0 284.0 1072.0 285.0 1091.0
P0004 0.37 513.0 356.0 511.0 336.0 630.0 327.0 632.0 347.0
P0004 0.365 117.0 260.0 114.0 239.0 196.0 227.0 199.0 248.0
P0004 0.365 503.0 335.0 501.0 314.0 620.0 304.0 622.0 325.0
P0004 0.353 304.0 181.0 292.0 85.0 313.0 82.0 325.0 178.0
P0004 0.349 492.0 1231.0 491.0 1210.0 625.0 1204.0 626.0 1225.0
P0004 0.333 152.0 1178.0 150.0 1158.0 279.0 1149.0 281.0 1169.0
P0004 0.332 117.0 281.0 115.0 261.0 214.0 248.0 216.0 268.0
P0004 0.332 618.0 597.0 524.0 591.0 525.0 570.0 619.0 576.0
P0004 0.327 634.0 644.0 512.0 635.0 513.0 615.0 635.0 624.0
P0004 0.326 437.0 189.0 436.0 94.0 458.0 94.0 459.0 189.0
P0004 0.323 348.0 185.0 339.0 88.0 359.0 86.0 368.0 183.0
P0004 0.322 231.0 1239.0 175.0 1238.0 176.0 1218.0 232.0 1219.0
P0004 0.312 523.0 308.0 522.0 287.0 618.0 281.0 619.0 302.0
P0004 0.301 507.0 246.0 504.0 225.0 622.0 207.0 625.0 228.0
P0004 0.296 513.0 289.0 511.0 267.0 638.0 252.0 640.0 274.0
P0004 0.288 468.0 714.0 395.0 713.0 395.0 693.0 468.0 694.0
P0004 0.282 291.0 1289.0 227.0 1288.0 228.0 1266.0 292.0 1267.0
P0004 0.271 511.0 401.0 509.0 381.0 636.0 372.0 638.0 392.0
P0004 0.266 318.0 53.0 251.0 52.0 251.0 30.0 318.0 31.0
P0004 0.262 623.0 662.0 514.0 653.0 516.0 633.0 625.0 642.0
================================================
FILE: evaluation_example/result_classname/Task1_ship.txt
================================================
P0019 0.698 5803.0 3656.0 5790.0 3638.0 5828.0 3613.0 5841.0 3631.0
P0019 0.661 6157.0 2640.0 6129.0 2614.0 6140.0 2603.0 6168.0 2629.0
P0019 0.659 2177.0 500.0 2157.0 492.0 2174.0 451.0 2194.0 459.0
P0019 0.656 5537.0 3619.0 5537.0 3584.0 5550.0 3584.0 5550.0 3619.0
P0019 0.636 4005.0 947.0 3962.0 930.0 3970.0 910.0 4013.0 927.0
P0019 0.602 5612.0 713.0 5601.0 680.0 5613.0 676.0 5624.0 709.0
P0019 0.6 3450.0 3383.0 3434.0 3379.0 3441.0 3348.0 3457.0 3352.0
P0019 0.576 6125.0 2828.0 6124.0 2812.0 6158.0 2811.0 6159.0 2827.0
P0019 0.515 554.0 944.0 515.0 906.0 533.0 887.0 572.0 925.0
P0019 0.487 5780.0 3650.0 5770.0 3640.0 5791.0 3621.0 5801.0 3631.0
P0019 0.462 679.0 884.0 670.0 869.0 698.0 851.0 707.0 866.0
P0019 0.445 6126.0 2458.0 6058.0 2457.0 6059.0 2429.0 6127.0 2430.0
P0019 0.439 6028.0 1788.0 6026.0 1767.0 6069.0 1765.0 6071.0 1786.0
P0019 0.417 4783.0 3368.0 4766.0 3367.0 4768.0 3333.0 4785.0 3334.0
P0019 0.376 4430.0 792.0 4428.0 773.0 4457.0 769.0 4459.0 788.0
P0019 0.376 2321.0 3093.0 2283.0 3047.0 2304.0 3030.0 2342.0 3076.0
P0019 0.374 3558.0 3422.0 3553.0 3372.0 3579.0 3369.0 3584.0 3419.0
P0019 0.356 1431.0 146.0 1408.0 145.0 1412.0 93.0 1435.0 94.0
P0019 0.343 888.0 2406.0 877.0 2365.0 893.0 2361.0 904.0 2402.0
P0019 0.341 6321.0 2782.0 6316.0 2741.0 6332.0 2739.0 6337.0 2780.0
P0019 0.339 1424.0 714.0 1410.0 713.0 1411.0 681.0 1425.0 682.0
P0019 0.335 635.0 824.0 611.0 804.0 622.0 791.0 646.0 811.0
P0019 0.328 5329.0 733.0 5323.0 704.0 5340.0 700.0 5346.0 729.0
P0019 0.316 193.0 1479.0 165.0 1477.0 166.0 1460.0 194.0 1462.0
P0019 0.303 4999.0 669.0 4997.0 640.0 5012.0 638.0 5014.0 667.0
P0019 0.302 3650.0 3459.0 3633.0 3434.0 3649.0 3424.0 3666.0 3449.0
P0019 0.301 3547.0 3506.0 3543.0 3489.0 3582.0 3479.0 3586.0 3496.0
P0019 0.295 6306.0 3223.0 6266.0 3210.0 6271.0 3192.0 6311.0 3205.0
P0019 0.292 5069.0 728.0 5056.0 727.0 5058.0 693.0 5071.0 694.0
P0019 0.287 3559.0 3521.0 3555.0 3507.0 3580.0 3500.0 3584.0 3514.0
P0019 0.287 5228.0 3392.0 5212.0 3382.0 5235.0 3349.0 5251.0 3359.0
P0019 0.277 2233.0 2953.0 2186.0 2927.0 2200.0 2902.0 2247.0 2928.0
P0019 0.276 6307.0 3208.0 6277.0 3198.0 6282.0 3183.0 6312.0 3193.0
P0019 0.263 5509.0 3424.0 5494.0 3424.0 5494.0 3399.0 5509.0 3399.0
P0019 0.258 3928.0 674.0 3915.0 640.0 3933.0 633.0 3946.0 667.0
P0019 0.25 5499.0 3447.0 5499.0 3422.0 5510.0 3422.0 5510.0 3447.0
================================================
FILE: evaluation_example/result_classname/Task1_small-vehicle.txt
================================================
P0019 0.646 3833.0 160.0 3830.0 140.0 3872.0 135.0 3875.0 155.0
P0019 0.633 262.0 395.0 246.0 353.0 265.0 346.0 281.0 388.0
P0019 0.628 849.0 3366.0 829.0 3364.0 834.0 3319.0 854.0 3321.0
P0019 0.627 1110.0 2878.0 1109.0 2834.0 1129.0 2833.0 1130.0 2877.0
P0019 0.614 1116.0 3246.0 1109.0 3204.0 1129.0 3201.0 1136.0 3243.0
P0019 0.611 6417.0 3629.0 6391.0 3628.0 6394.0 3572.0 6420.0 3573.0
P0019 0.608 1467.0 86.0 1446.0 47.0 1464.0 37.0 1485.0 76.0
P0019 0.602 438.0 3334.0 388.0 3327.0 391.0 3305.0 441.0 3312.0
P0019 0.599 1666.0 187.0 1644.0 150.0 1661.0 138.0 1684.0 175.0
P0019 0.589 387.0 2700.0 340.0 2685.0 346.0 2665.0 393.0 2680.0
P0019 0.585 4646.0 171.0 4644.0 151.0 4685.0 148.0 4687.0 168.0
P0019 0.583 1509.0 3264.0 1467.0 3259.0 1470.0 3239.0 1512.0 3244.0
P0019 0.582 4203.0 220.0 4154.0 215.0 4156.0 195.0 4205.0 200.0
P0019 0.574 1156.0 3285.0 1135.0 3285.0 1135.0 3238.0 1156.0 3238.0
P0019 0.567 3290.0 186.0 3289.0 126.0 3313.0 125.0 3314.0 185.0
P0019 0.56 4638.0 238.0 4638.0 218.0 4685.0 217.0 4685.0 237.0
P0019 0.554 131.0 3452.0 86.0 3448.0 88.0 3427.0 133.0 3431.0
P0019 0.551 2183.0 3440.0 2139.0 3440.0 2140.0 3421.0 2184.0 3421.0
P0019 0.534 877.0 3372.0 856.0 3371.0 858.0 3333.0 879.0 3334.0
P0019 0.519 4050.0 188.0 4028.0 187.0 4029.0 139.0 4051.0 140.0
P0019 0.517 411.0 2656.0 365.0 2643.0 370.0 2623.0 416.0 2636.0
P0019 0.509 144.0 3293.0 140.0 3246.0 161.0 3244.0 165.0 3291.0
P0019 0.509 1656.0 86.0 1651.0 65.0 1703.0 55.0 1708.0 76.0
P0019 0.507 4198.0 195.0 4146.0 187.0 4149.0 166.0 4201.0 174.0
P0019 0.479 3881.0 260.0 3875.0 209.0 3896.0 207.0 3902.0 258.0
P0019 0.474 805.0 3417.0 783.0 3413.0 790.0 3368.0 812.0 3372.0
P0019 0.448 5195.0 258.0 5177.0 258.0 5178.0 215.0 5196.0 215.0
P0019 0.44 1757.0 3132.0 1710.0 3131.0 1710.0 3109.0 1757.0 3110.0
P0019 0.436 121.0 790.0 95.0 788.0 100.0 727.0 126.0 729.0
P0019 0.425 4540.0 177.0 4523.0 171.0 4535.0 138.0 4552.0 144.0
P0019 0.387 957.0 186.0 954.0 142.0 976.0 141.0 979.0 185.0
P0019 0.33 121.0 3355.0 99.0 3355.0 102.0 3300.0 124.0 3300.0
P0019 0.301 3303.0 378.0 3300.0 333.0 3324.0 331.0 3327.0 376.0
P0019 0.261 1151.0 2901.0 1131.0 2901.0 1132.0 2852.0 1152.0 2852.0
P0019 0.253 814.0 3368.0 787.0 3365.0 793.0 3311.0 820.0 3314.0
P0019 0.252 752.0 3497.0 706.0 3480.0 713.0 3458.0 759.0 3475.0
P0007 0.706 372.0 425.0 366.0 410.0 401.0 396.0 407.0 411.0
P0007 0.684 415.0 475.0 409.0 461.0 440.0 448.0 446.0 462.0
P0007 0.669 1307.0 1122.0 1288.0 1122.0 1290.0 1077.0 1309.0 1077.0
P0007 0.668 1364.0 442.0 1355.0 429.0 1383.0 409.0 1392.0 422.0
P0007 0.663 419.0 499.0 412.0 485.0 448.0 468.0 455.0 482.0
P0007 0.659 414.0 357.0 408.0 342.0 445.0 328.0 451.0 343.0
P0007 0.656 1423.0 1994.0 1403.0 1993.0 1404.0 1951.0 1424.0 1952.0
P0007 0.656 1375.0 1993.0 1355.0 1992.0 1358.0 1946.0 1378.0 1947.0
P0007 0.655 1368.0 410.0 1359.0 397.0 1391.0 375.0 1400.0 388.0
P0007 0.652 1376.0 1858.0 1358.0 1858.0 1359.0 1823.0 1377.0 1823.0
P0007 0.644 1374.0 1393.0 1334.0 1392.0 1335.0 1374.0 1375.0 1375.0
P0007 0.64 1352.0 1855.0 1333.0 1854.0 1335.0 1818.0 1354.0 1819.0
P0007 0.64 414.0 384.0 407.0 369.0 441.0 355.0 448.0 370.0
P0007 0.636 372.0 496.0 366.0 481.0 403.0 467.0 409.0 482.0
P0007 0.63 1394.0 1429.0 1375.0 1428.0 1375.0 1388.0 1394.0 1389.0
P0007 0.63 413.0 454.0 407.0 440.0 444.0 423.0 450.0 437.0
P0007 0.625 1351.0 1984.0 1333.0 1983.0 1336.0 1945.0 1354.0 1946.0
P0007 0.61 1373.0 379.0 1363.0 364.0 1400.0 338.0 1410.0 353.0
P0007 0.604 370.0 448.0 364.0 434.0 399.0 419.0 405.0 433.0
P0007 0.601 947.0 162.0 945.0 144.0 986.0 139.0 988.0 157.0
P0007 0.6 1414.0 1432.0 1394.0 1431.0 1395.0 1389.0 1415.0 1390.0
P0007 0.599 615.0 425.0 580.0 425.0 580.0 410.0 615.0 410.0
P0007 0.597 414.0 406.0 408.0 393.0 445.0 377.0 451.0 390.0
P0007 0.589 1366.0 1508.0 1324.0 1508.0 1325.0 1487.0 1367.0 1487.0
P0007 0.587 90.0 263.0 71.0 262.0 73.0 222.0 92.0 223.0
P0007 0.586 1424.0 2134.0 1405.0 2134.0 1405.0 2095.0 1424.0 2095.0
P0007 0.577 369.0 403.0 362.0 388.0 400.0 372.0 407.0 387.0
P0007 0.562 415.0 312.0 409.0 295.0 452.0 279.0 458.0 296.0
P0007 0.554 92.0 173.0 73.0 172.0 75.0 122.0 94.0 123.0
P0007 0.553 1293.0 1069.0 1292.0 1026.0 1310.0 1026.0 1311.0 1069.0
P0007 0.551 1387.0 2128.0 1368.0 2126.0 1372.0 2085.0 1391.0 2087.0
P0007 0.545 605.0 734.0 569.0 732.0 570.0 715.0 606.0 717.0
P0007 0.544 1366.0 471.0 1355.0 456.0 1391.0 432.0 1402.0 447.0
P0007 0.54 1416.0 1082.0 1397.0 1082.0 1397.0 1041.0 1416.0 1041.0
P0007 0.534 1358.0 353.0 1341.0 353.0 1343.0 312.0 1360.0 312.0
P0007 0.532 1369.0 1530.0 1329.0 1530.0 1330.0 1511.0 1370.0 1511.0
P0007 0.531 1468.0 511.0 1434.0 484.0 1447.0 468.0 1481.0 495.0
P0007 0.523 1374.0 273.0 1366.0 257.0 1399.0 240.0 1407.0 256.0
P0007 0.513 415.0 426.0 410.0 413.0 446.0 397.0 451.0 410.0
P0007 0.502 1474.0 478.0 1443.0 450.0 1455.0 437.0 1486.0 465.0
P0007 0.502 1434.0 1432.0 1413.0 1430.0 1415.0 1391.0 1436.0 1393.0
P0007 0.497 1371.0 1433.0 1333.0 1431.0 1334.0 1412.0 1372.0 1414.0
P0007 0.487 1376.0 295.0 1367.0 281.0 1401.0 260.0 1410.0 274.0
P0007 0.486 1474.0 447.0 1439.0 417.0 1451.0 402.0 1486.0 432.0
P0007 0.485 223.0 338.0 222.0 319.0 266.0 317.0 267.0 336.0
P0007 0.484 1404.0 971.0 1366.0 968.0 1367.0 952.0 1405.0 955.0
P0007 0.481 1401.0 991.0 1365.0 990.0 1366.0 974.0 1402.0 975.0
P0007 0.471 1365.0 501.0 1355.0 485.0 1396.0 458.0 1406.0 474.0
P0007 0.468 1438.0 1205.0 1419.0 1205.0 1419.0 1166.0 1438.0 1166.0
P0007 0.457 1372.0 347.0 1362.0 332.0 1397.0 308.0 1407.0 323.0
P0007 0.455 1477.0 385.0 1452.0 363.0 1464.0 350.0 1489.0 372.0
P0007 0.45 1451.0 1002.0 1403.0 1001.0 1404.0 981.0 1452.0 982.0
P0007 0.448 1377.0 246.0 1367.0 229.0 1410.0 205.0 1420.0 222.0
P0007 0.438 1377.0 184.0 1370.0 168.0 1402.0 155.0 1409.0 171.0
P0007 0.423 713.0 391.0 691.0 390.0 694.0 348.0 716.0 349.0
P0007 0.408 1475.0 417.0 1439.0 387.0 1452.0 372.0 1488.0 402.0
P0007 0.389 205.0 798.0 204.0 779.0 248.0 779.0 249.0 798.0
P0007 0.386 381.0 2102.0 354.0 2078.0 368.0 2063.0 395.0 2087.0
P0007 0.339 131.0 565.0 130.0 546.0 180.0 542.0 181.0 561.0
P0007 0.327 784.0 379.0 781.0 331.0 803.0 330.0 806.0 378.0
P0007 0.294 217.0 486.0 216.0 470.0 254.0 469.0 255.0 485.0
P0007 0.277 756.0 391.0 755.0 332.0 779.0 332.0 780.0 391.0
P0007 0.277 1399.0 160.0 1376.0 158.0 1378.0 109.0 1401.0 111.0
P0007 0.259 912.0 655.0 893.0 653.0 897.0 608.0 916.0 610.0
P0007 0.257 1454.0 1206.0 1444.0 1206.0 1447.0 1167.0 1457.0 1167.0
P0003 0.734 1055.0 664.0 1037.0 627.0 1054.0 619.0 1072.0 656.0
P0003 0.653 1091.0 987.0 1076.0 979.0 1092.0 948.0 1107.0 956.0
P0003 0.637 964.0 462.0 949.0 424.0 967.0 417.0 982.0 455.0
P0003 0.632 1100.0 1013.0 1084.0 1005.0 1103.0 968.0 1119.0 976.0
P0003 0.626 1002.0 549.0 986.0 510.0 1005.0 502.0 1021.0 541.0
P0003 0.625 11.0 808.0 10.0 789.0 48.0 785.0 49.0 804.0
P0003 0.618 970.0 191.0 955.0 158.0 971.0 150.0 986.0 183.0
P0003 0.611 1105.0 666.0 1087.0 630.0 1104.0 621.0 1122.0 657.0
P0003 0.478 -3.0 981.0 -4.0 961.0 43.0 958.0 44.0 978.0
P0003 0.475 1106.0 756.0 1082.0 713.0 1101.0 703.0 1125.0 746.0
P0003 0.461 0.0 956.0 -1.0 935.0 43.0 933.0 45.0 954.0
P0003 0.43 1.0 932.0 1.0 914.0 40.0 913.0 40.0 931.0
P0003 0.39 936.0 911.0 917.0 910.0 919.0 872.0 938.0 873.0
P0003 0.373 42.0 657.0 9.0 656.0 9.0 636.0 42.0 637.0
P0003 0.339 853.0 653.0 845.0 633.0 892.0 616.0 900.0 636.0
P0004 0.664 719.0 1296.0 701.0 1295.0 704.0 1253.0 722.0 1254.0
P0004 0.651 110.0 894.0 107.0 858.0 123.0 857.0 126.0 893.0
P0004 0.628 717.0 1354.0 700.0 1354.0 702.0 1315.0 719.0 1315.0
P0004 0.62 748.0 277.0 730.0 276.0 733.0 238.0 751.0 239.0
P0004 0.617 797.0 249.0 779.0 249.0 780.0 212.0 798.0 212.0
P0004 0.616 108.0 1013.0 98.0 1002.0 123.0 980.0 133.0 991.0
P0004 0.595 692.0 1347.0 675.0 1346.0 677.0 1308.0 694.0 1309.0
P0004 0.592 56.0 977.0 54.0 940.0 71.0 940.0 73.0 977.0
P0004 0.578 547.0 41.0 507.0 35.0 510.0 16.0 550.0 22.0
P0004 0.572 741.0 1375.0 723.0 1374.0 726.0 1336.0 744.0 1337.0
P0004 0.568 85.0 900.0 81.0 861.0 98.0 859.0 102.0 898.0
P0004 0.563 723.0 1151.0 707.0 1150.0 708.0 1116.0 724.0 1117.0
P0004 0.521 802.0 110.0 785.0 110.0 787.0 73.0 804.0 73.0
P0004 0.498 81.0 268.0 80.0 231.0 98.0 231.0 99.0 268.0
P0004 0.484 314.0 728.0 295.0 727.0 297.0 687.0 316.0 688.0
P0004 0.473 742.0 589.0 724.0 588.0 727.0 548.0 745.0 549.0
P0004 0.433 819.0 196.0 807.0 195.0 808.0 159.0 820.0 160.0
P0004 0.35 816.0 284.0 805.0 284.0 805.0 247.0 816.0 247.0
P0004 0.316 32.0 356.0 31.0 322.0 45.0 321.0 46.0 355.0
P0004 0.293 823.0 76.0 813.0 75.0 814.0 43.0 824.0 44.0
P0004 0.257 200.0 15.0 158.0 15.0 159.0 4.0 201.0 4.0
================================================
FILE: evaluation_example/row_DOTA_labels/P0003.txt
================================================
imagesource:GoogleEarth
gsd:0.115726939386
937.0 913.0 921.0 912.0 923.0 874.0 940.0 875.0 small-vehicle 0
638.0 959.0 638.0 935.0 694.0 939.0 693.0 962.0 large-vehicle 0
545.0 494.0 548.0 518.0 489.0 519.0 488.0 493.0 large-vehicle 0
536.0 468.0 535.0 489.0 477.0 486.0 478.0 464.0 large-vehicle 0
683.0 302.0 659.0 309.0 643.0 213.0 660.0 205.0 large-vehicle 0
627.0 319.0 605.0 326.0 584.0 223.0 608.0 216.0 large-vehicle 0
594.0 323.0 573.0 328.0 556.0 234.0 575.0 229.0 large-vehicle 0
563.0 326.0 540.0 333.0 527.0 238.0 547.0 232.0 large-vehicle 0
521.0 334.0 500.0 341.0 478.0 241.0 500.0 236.0 large-vehicle 0
422.0 349.0 401.0 356.0 382.0 258.0 402.0 253.0 large-vehicle 0
396.0 358.0 375.0 366.0 356.0 269.0 374.0 263.0 large-vehicle 0
360.0 359.0 340.0 363.0 326.0 278.0 347.0 273.0 large-vehicle 0
329.0 352.0 305.0 356.0 292.0 274.0 313.0 272.0 large-vehicle 0
277.0 842.0 278.0 823.0 335.0 827.0 332.0 853.0 large-vehicle 0
573.0 519.0 579.0 494.0 638.0 498.0 637.0 523.0 large-vehicle 0
328.0 803.0 317.0 821.0 265.0 794.0 277.0 772.0 large-vehicle 0
265.0 757.0 280.0 742.0 318.0 764.0 305.0 782.0 large-vehicle 1
258.0 683.0 262.0 669.0 315.0 689.0 305.0 712.0 large-vehicle 1
280.0 638.0 293.0 619.0 338.0 643.0 328.0 663.0 large-vehicle 0
232.0 610.0 243.0 591.0 286.0 616.0 276.0 636.0 large-vehicle 0
278.0 601.0 288.0 582.0 336.0 607.0 323.0 628.0 large-vehicle 0
230.0 577.0 238.0 559.0 284.0 578.0 273.0 598.0 large-vehicle 1
315.0 507.0 303.0 525.0 213.0 475.0 226.0 455.0 large-vehicle 0
204.0 441.0 213.0 419.0 269.0 441.0 257.0 463.0 large-vehicle 0
200.0 401.0 211.0 383.0 258.0 411.0 250.0 428.0 large-vehicle 0
186.0 365.0 198.0 342.0 249.0 368.0 236.0 390.0 large-vehicle 0
558.0 523.0 563.0 546.0 501.0 554.0 501.0 529.0 large-vehicle 0
627.0 529.0 628.0 547.0 569.0 549.0 568.0 530.0 large-vehicle 0
958.0 158.0 972.0 152.0 984.0 182.0 967.0 187.0 small-vehicle 1
45.0 864.0 47.0 882.0 5.0 882.0 4.0 867.0 large-vehicle 1
1093.0 949.0 1107.0 957.0 1091.0 987.0 1077.0 981.0 small-vehicle 1
1106.0 969.0 1119.0 974.0 1102.0 1012.0 1085.0 1005.0 small-vehicle 0
1126.0 747.0 1110.0 757.0 1088.0 714.0 1105.0 706.0 large-vehicle 0
1089.0 632.0 1105.0 621.0 1126.0 656.0 1107.0 667.0 small-vehicle 1
1071.0 656.0 1058.0 664.0 1038.0 627.0 1055.0 620.0 small-vehicle 0
990.0 513.0 1004.0 504.0 1022.0 539.0 1003.0 548.0 small-vehicle 1
978.0 458.0 964.0 463.0 953.0 428.0 967.0 421.0 small-vehicle 1
4.0 979.0 3.0 964.0 43.0 961.0 44.0 979.0 small-vehicle 0
2.0 956.0 4.0 939.0 42.0 936.0 42.0 954.0 small-vehicle 0
3.0 931.0 4.0 916.0 39.0 916.0 42.0 929.0 small-vehicle 0
5.0 908.0 5.0 892.0 40.0 889.0 41.0 907.0 small-vehicle 0
6.0 842.0 38.0 842.0 37.0 857.0 3.0 859.0 large-vehicle 1
660.0 555.0 662.0 576.0 603.0 577.0 602.0 555.0 large-vehicle 0
47.0 787.0 48.0 805.0 15.0 811.0 13.0 793.0 small-vehicle 0
41.0 690.0 41.0 704.0 8.0 706.0 11.0 690.0 small-vehicle 1
41.0 640.0 44.0 656.0 12.0 656.0 11.0 640.0 small-vehicle 1
867.0 904.0 847.0 904.0 849.0 847.0 870.0 849.0 large-vehicle 0
841.0 897.0 821.0 897.0 813.0 802.0 835.0 800.0 large-vehicle 0
813.0 896.0 795.0 897.0 790.0 834.0 809.0 829.0 large-vehicle 0
763.0 817.0 782.0 814.0 781.0 906.0 760.0 904.0 large-vehicle 0
721.0 852.0 742.0 851.0 740.0 906.0 716.0 906.0 large-vehicle 1
883.0 586.0 895.0 603.0 840.0 631.0 827.0 609.0 large-vehicle 0
773.0 574.0 767.0 555.0 856.0 523.0 865.0 544.0 large-vehicle 0
630.0 586.0 629.0 607.0 532.0 604.0 534.0 580.0 large-vehicle 0
191.0 299.0 205.0 276.0 257.0 304.0 238.0 330.0 large-vehicle 0
================================================
FILE: evaluation_example/row_DOTA_labels/P0004.txt
================================================
imagesource:GoogleEarth
gsd:0.132459767176
398.0 716.0 398.0 694.0 464.0 698.0 465.0 718.0 large-vehicle 0
513.0 542.0 514.0 524.0 613.0 529.0 613.0 548.0 large-vehicle 0
526.0 591.0 528.0 571.0 623.0 578.0 621.0 599.0 large-vehicle 1
504.0 614.0 506.0 591.0 632.0 603.0 629.0 622.0 large-vehicle 0
521.0 636.0 521.0 617.0 635.0 627.0 634.0 644.0 large-vehicle 0
518.0 656.0 523.0 639.0 638.0 646.0 635.0 669.0 large-vehicle 0
528.0 681.0 533.0 662.0 611.0 669.0 610.0 690.0 large-vehicle 0
194.0 230.0 197.0 249.0 121.0 259.0 118.0 242.0 large-vehicle 0
217.0 249.0 220.0 271.0 118.0 283.0 117.0 264.0 large-vehicle 0
205.0 272.0 208.0 293.0 118.0 303.0 113.0 284.0 large-vehicle 1
219.0 293.0 226.0 315.0 128.0 329.0 124.0 307.0 large-vehicle 0
229.0 318.0 232.0 336.0 136.0 351.0 133.0 331.0 large-vehicle 0
239.0 336.0 243.0 356.0 146.0 371.0 144.0 351.0 large-vehicle 0
244.0 359.0 247.0 378.0 152.0 393.0 148.0 374.0 large-vehicle 0
235.0 385.0 240.0 402.0 146.0 419.0 144.0 399.0 large-vehicle 1
263.0 407.0 265.0 427.0 166.0 440.0 166.0 418.0 large-vehicle 0
259.0 432.0 260.0 454.0 143.0 472.0 140.0 447.0 large-vehicle 0
371.0 589.0 389.0 591.0 381.0 684.0 360.0 681.0 large-vehicle 1
258.0 459.0 261.0 477.0 136.0 502.0 133.0 480.0 large-vehicle 0
258.0 484.0 263.0 502.0 154.0 524.0 150.0 504.0 large-vehicle 1
258.0 507.0 264.0 527.0 166.0 549.0 161.0 529.0 large-vehicle 0
258.0 534.0 264.0 553.0 151.0 582.0 148.0 561.0 large-vehicle 0
272.0 579.0 274.0 601.0 174.0 605.0 174.0 586.0 large-vehicle 0
271.0 606.0 274.0 626.0 156.0 636.0 156.0 612.0 large-vehicle 0
268.0 632.0 271.0 651.0 171.0 656.0 171.0 636.0 large-vehicle 0
495.0 567.0 498.0 546.0 621.0 553.0 622.0 573.0 large-vehicle 0
509.0 522.0 511.0 503.0 607.0 506.0 606.0 526.0 large-vehicle 0
261.0 694.0 261.0 717.0 150.0 714.0 152.0 692.0 large-vehicle 1
511.0 497.0 513.0 479.0 627.0 480.0 627.0 502.0 large-vehicle 0
273.0 92.0 291.0 88.0 305.0 177.0 286.0 180.0 large-vehicle 1
294.0 88.0 312.0 84.0 326.0 176.0 308.0 178.0 large-vehicle 1
317.0 86.0 334.0 82.0 348.0 175.0 330.0 178.0 large-vehicle 1
339.0 94.0 356.0 89.0 369.0 180.0 350.0 184.0 large-vehicle 1
359.0 87.0 377.0 84.0 389.0 176.0 373.0 180.0 large-vehicle 1
390.0 93.0 408.0 92.0 412.0 185.0 392.0 186.0 large-vehicle 1
417.0 92.0 433.0 90.0 436.0 184.0 418.0 185.0 large-vehicle 1
439.0 98.0 457.0 97.0 458.0 188.0 441.0 189.0 large-vehicle 1
460.0 94.0 477.0 94.0 479.0 186.0 462.0 186.0 large-vehicle 1
481.0 91.0 498.0 91.0 498.0 183.0 481.0 183.0 large-vehicle 1
561.0 111.0 576.0 121.0 516.0 194.0 502.0 184.0 large-vehicle 1
513.0 203.0 621.0 184.0 625.0 204.0 515.0 222.0 large-vehicle 1
508.0 228.0 618.0 211.0 621.0 228.0 511.0 247.0 large-vehicle 1
511.0 249.0 630.0 229.0 633.0 249.0 514.0 267.0 large-vehicle 1
517.0 268.0 638.0 256.0 639.0 276.0 518.0 288.0 large-vehicle 1
526.0 311.0 524.0 292.0 616.0 282.0 619.0 299.0 large-vehicle 1
506.0 336.0 505.0 316.0 618.0 304.0 621.0 324.0 large-vehicle 0
518.0 356.0 518.0 338.0 629.0 329.0 632.0 349.0 large-vehicle 1
511.0 381.0 508.0 363.0 603.0 352.0 606.0 371.0 large-vehicle 1
513.0 403.0 511.0 385.0 633.0 372.0 636.0 392.0 large-vehicle 1
511.0 428.0 511.0 409.0 638.0 402.0 641.0 424.0 large-vehicle 0
518.0 453.0 516.0 435.0 628.0 428.0 628.0 448.0 large-vehicle 1
519.0 473.0 521.0 458.0 603.0 455.0 604.0 474.0 large-vehicle 0
286.0 656.0 287.0 676.0 171.0 677.0 169.0 658.0 large-vehicle 0
274.0 738.0 274.0 760.0 154.0 757.0 157.0 736.0 large-vehicle 0
314.0 727.0 298.0 726.0 299.0 689.0 314.0 688.0 small-vehicle 1
454.0 38.0 453.0 60.0 386.0 57.0 387.0 34.0 large-vehicle 0
788.0 76.0 806.0 76.0 804.0 111.0 786.0 109.0 small-vehicle 0
812.0 159.0 824.0 162.0 822.0 193.0 809.0 196.0 small-vehicle 1
781.0 214.0 797.0 215.0 798.0 246.0 780.0 246.0 small-vehicle 0
751.0 278.0 736.0 276.0 736.0 241.0 754.0 240.0 small-vehicle 0
806.0 250.0 818.0 250.0 818.0 283.0 804.0 284.0 small-vehicle 1
745.0 591.0 726.0 589.0 729.0 550.0 746.0 549.0 small-vehicle 0
725.0 1151.0 707.0 1151.0 709.0 1118.0 726.0 1116.0 small-vehicle 0
231.0 1219.0 229.0 1242.0 178.0 1236.0 176.0 1217.0 large-vehicle 0
288.0 1269.0 288.0 1290.0 236.0 1285.0 237.0 1266.0 large-vehicle 0
218.0 1264.0 216.0 1287.0 159.0 1283.0 160.0 1262.0 large-vehicle 0
719.0 1296.0 704.0 1294.0 705.0 1257.0 721.0 1254.0 small-vehicle 0
693.0 1344.0 679.0 1344.0 681.0 1313.0 695.0 1311.0 small-vehicle 0
720.0 1353.0 706.0 1354.0 706.0 1318.0 721.0 1317.0 small-vehicle 0
741.0 1375.0 726.0 1374.0 728.0 1338.0 743.0 1339.0 small-vehicle 0
83.0 864.0 98.0 861.0 103.0 898.0 87.0 899.0 small-vehicle 0
109.0 859.0 125.0 859.0 126.0 892.0 110.0 893.0 small-vehicle 0
100.0 927.0 119.0 926.0 121.0 979.0 103.0 982.0 large-vehicle 0
56.0 942.0 69.0 939.0 73.0 974.0 58.0 977.0 small-vehicle 1
123.0 982.0 132.0 992.0 109.0 1013.0 99.0 1003.0 small-vehicle 0
45.0 356.0 32.0 356.0 33.0 323.0 46.0 322.0 small-vehicle 1
83.0 235.0 96.0 233.0 98.0 265.0 83.0 267.0 small-vehicle 1
196.0 4.0 197.0 17.0 163.0 14.0 162.0 2.0 small-vehicle 1
324.0 711.0 327.0 690.0 375.0 691.0 374.0 711.0 large-vehicle 0
551.0 25.0 546.0 43.0 508.0 36.0 513.0 17.0 small-vehicle 0
315.0 31.0 313.0 54.0 250.0 51.0 252.0 30.0 large-vehicle 0
273.0 781.0 275.0 803.0 158.0 804.0 157.0 782.0 large-vehicle 0
475.0 1289.0 476.0 1269.0 604.0 1271.0 604.0 1292.0 large-vehicle 0
275.0 806.0 276.0 828.0 157.0 830.0 157.0 809.0 large-vehicle 0
268.0 861.0 269.0 879.0 153.0 878.0 153.0 858.0 large-vehicle 0
275.0 881.0 277.0 901.0 147.0 903.0 147.0 880.0 large-vehicle 0
277.0 904.0 279.0 924.0 149.0 928.0 149.0 908.0 large-vehicle 0
278.0 926.0 280.0 946.0 150.0 951.0 151.0 933.0 large-vehicle 0
285.0 951.0 286.0 975.0 158.0 978.0 158.0 956.0 large-vehicle 0
280.0 978.0 281.0 996.0 151.0 1001.0 152.0 983.0 large-vehicle 0
277.0 1003.0 277.0 1023.0 149.0 1026.0 150.0 1006.0 large-vehicle 0
277.0 1026.0 277.0 1047.0 149.0 1049.0 151.0 1030.0 large-vehicle 0
279.0 1050.0 281.0 1069.0 152.0 1075.0 152.0 1056.0 large-vehicle 0
281.0 1073.0 286.0 1093.0 158.0 1101.0 156.0 1082.0 large-vehicle 0
285.0 1097.0 287.0 1117.0 159.0 1124.0 158.0 1105.0 large-vehicle 0
278.0 1150.0 282.0 1172.0 154.0 1181.0 152.0 1161.0 large-vehicle 0
279.0 1176.0 281.0 1197.0 155.0 1205.0 153.0 1183.0 large-vehicle 0
332.0 1348.0 310.0 1348.0 313.0 1183.0 333.0 1184.0 large-vehicle 0
460.0 954.0 458.0 933.0 624.0 921.0 626.0 942.0 large-vehicle 0
513.0 916.0 513.0 897.0 595.0 891.0 597.0 912.0 large-vehicle 0
484.0 1081.0 484.0 1063.0 613.0 1053.0 613.0 1073.0 large-vehicle 0
482.0 1106.0 482.0 1088.0 596.0 1081.0 598.0 1100.0 large-vehicle 0
434.0 1181.0 435.0 1159.0 560.0 1154.0 563.0 1174.0 large-vehicle 0
496.0 1206.0 493.0 1186.0 619.0 1175.0 623.0 1195.0 large-vehicle 0
498.0 1231.0 498.0 1211.0 625.0 1204.0 626.0 1226.0 large-vehicle 0
485.0 1259.0 484.0 1241.0 583.0 1234.0 583.0 1255.0 large-vehicle 0
233.0 94.0 254.0 89.0 271.0 181.0 248.0 186.0 large-vehicle 1
================================================
FILE: evaluation_example/row_DOTA_labels/P0007.txt
================================================
imagesource:GoogleEarth
gsd:0.127603145209
1381.0 182.0 1375.0 168.0 1403.0 156.0 1408.0 171.0 small-vehicle 1
950.0 1837.0 951.0 1812.0 1128.0 1820.0 1129.0 1843.0 large-vehicle 1
839.0 1491.0 841.0 1512.0 674.0 1506.0 675.0 1485.0 large-vehicle 0
846.0 1463.0 843.0 1485.0 674.0 1480.0 675.0 1456.0 large-vehicle 0
840.0 1436.0 839.0 1458.0 667.0 1451.0 667.0 1426.0 large-vehicle 0
852.0 1374.0 853.0 1401.0 682.0 1397.0 686.0 1375.0 large-vehicle 0
853.0 1350.0 854.0 1370.0 682.0 1370.0 682.0 1350.0 large-vehicle 0
840.0 1324.0 840.0 1344.0 661.0 1339.0 662.0 1316.0 large-vehicle 0
863.0 1627.0 839.0 1602.0 944.0 1477.0 963.0 1492.0 large-vehicle 0
944.0 1800.0 946.0 1779.0 1133.0 1787.0 1131.0 1810.0 large-vehicle 0
837.0 1610.0 836.0 1629.0 665.0 1620.0 667.0 1599.0 large-vehicle 0
946.0 1774.0 949.0 1746.0 1140.0 1758.0 1138.0 1780.0 large-vehicle 0
960.0 1686.0 962.0 1664.0 1140.0 1669.0 1141.0 1692.0 large-vehicle 0
961.0 1652.0 966.0 1631.0 1142.0 1642.0 1140.0 1664.0 large-vehicle 0
970.0 1624.0 974.0 1604.0 1141.0 1612.0 1140.0 1632.0 large-vehicle 0
966.0 1599.0 970.0 1578.0 1146.0 1584.0 1146.0 1604.0 large-vehicle 0
965.0 1569.0 970.0 1549.0 1148.0 1556.0 1149.0 1575.0 large-vehicle 0
970.0 1541.0 972.0 1520.0 1150.0 1526.0 1150.0 1546.0 large-vehicle 0
851.0 1552.0 851.0 1572.0 676.0 1566.0 679.0 1542.0 large-vehicle 0
840.0 1638.0 839.0 1661.0 662.0 1651.0 664.0 1628.0 large-vehicle 0
973.0 1457.0 973.0 1433.0 1141.0 1438.0 1140.0 1460.0 large-vehicle 0
481.0 1619.0 485.0 1598.0 663.0 1602.0 663.0 1625.0 large-vehicle 0
331.0 1787.0 332.0 1812.0 161.0 1807.0 165.0 1783.0 large-vehicle 0
334.0 1862.0 334.0 1886.0 159.0 1878.0 160.0 1854.0 large-vehicle 0
331.0 1832.0 332.0 1853.0 152.0 1854.0 152.0 1830.0 large-vehicle 0
613.0 1735.0 614.0 1712.0 772.0 1718.0 772.0 1737.0 large-vehicle 0
475.0 1698.0 476.0 1677.0 654.0 1686.0 654.0 1707.0 large-vehicle 0
485.0 1671.0 489.0 1650.0 667.0 1658.0 667.0 1680.0 large-vehicle 0
475.0 1647.0 475.0 1622.0 661.0 1626.0 661.0 1647.0 large-vehicle 0
483.0 1590.0 483.0 1569.0 664.0 1571.0 664.0 1594.0 large-vehicle 0
836.0 1692.0 836.0 1714.0 660.0 1710.0 663.0 1686.0 large-vehicle 0
491.0 1562.0 493.0 1537.0 672.0 1543.0 670.0 1566.0 large-vehicle 0
494.0 1531.0 497.0 1508.0 672.0 1514.0 672.0 1537.0 large-vehicle 0
489.0 1504.0 492.0 1482.0 672.0 1485.0 670.0 1508.0 large-vehicle 0
496.0 1472.0 498.0 1450.0 672.0 1458.0 672.0 1482.0 large-vehicle 0
490.0 1414.0 495.0 1393.0 671.0 1403.0 670.0 1425.0 large-vehicle 0
500.0 1390.0 503.0 1368.0 681.0 1374.0 679.0 1398.0 large-vehicle 0
494.0 1362.0 495.0 1341.0 677.0 1349.0 676.0 1369.0 large-vehicle 0
964.0 1512.0 968.0 1489.0 1144.0 1498.0 1143.0 1520.0 large-vehicle 0
973.0 1429.0 974.0 1405.0 1152.0 1411.0 1151.0 1434.0 large-vehicle 0
1012.0 995.0 1022.0 1047.0 849.0 1087.0 838.0 1029.0 large-vehicle 0
935.0 483.0 912.0 482.0 921.0 307.0 946.0 309.0 large-vehicle 0
1073.0 396.0 1081.0 374.0 1257.0 426.0 1250.0 447.0 large-vehicle 0
1059.0 335.0 1070.0 308.0 1242.0 357.0 1239.0 377.0 large-vehicle 0
1057.0 305.0 1068.0 280.0 1239.0 325.0 1233.0 348.0 large-vehicle 0
1064.0 282.0 1065.0 258.0 1242.0 268.0 1243.0 289.0 large-vehicle 0
1067.0 255.0 1070.0 234.0 1250.0 236.0 1251.0 258.0 large-vehicle 0
1068.0 226.0 1071.0 205.0 1251.0 208.0 1250.0 229.0 large-vehicle 0
1071.0 199.0 1070.0 175.0 1252.0 177.0 1253.0 199.0 large-vehicle 0
950.0 306.0 968.0 305.0 966.0 483.0 942.0 483.0 large-vehicle 0
1083.0 453.0 1091.0 433.0 1232.0 480.0 1228.0 500.0 large-vehicle 0
975.0 310.0 998.0 310.0 1000.0 485.0 974.0 485.0 large-vehicle 0
937.0 519.0 961.0 517.0 959.0 688.0 931.0 687.0 large-vehicle 0
1008.0 632.0 1032.0 629.0 1036.0 785.0 1007.0 785.0 large-vehicle 0
899.0 1102.0 900.0 1123.0 747.0 1119.0 748.0 1099.0 large-vehicle 0
903.0 789.0 905.0 811.0 745.0 803.0 748.0 778.0 large-vehicle 0
909.0 835.0 908.0 857.0 737.0 843.0 737.0 823.0 large-vehicle 0
900.0 873.0 900.0 897.0 749.0 891.0 751.0 865.0 large-vehicle 0
1064.0 424.0 1072.0 401.0 1243.0 446.0 1236.0 471.0 large-vehicle 0
1068.0 506.0 1084.0 491.0 1236.0 587.0 1224.0 607.0 large-vehicle 0
976.0 1397.0 976.0 1375.0 1154.0 1382.0 1154.0 1404.0 large-vehicle 0
1074.0 996.0 1092.0 983.0 1210.0 1109.0 1192.0 1126.0 large-vehicle 0
974.0 1366.0 975.0 1347.0 1155.0 1353.0 1153.0 1374.0 large-vehicle 0
978.0 1337.0 979.0 1314.0 1156.0 1326.0 1155.0 1347.0 large-vehicle 0
1175.0 1268.0 1162.0 1286.0 1029.0 1181.0 1045.0 1161.0 large-vehicle 0
1049.0 1151.0 1067.0 1135.0 1184.0 1242.0 1169.0 1259.0 large-vehicle 0
1057.0 1099.0 1072.0 1087.0 1195.0 1214.0 1175.0 1229.0 large-vehicle 0
1075.0 1076.0 1091.0 1064.0 1215.0 1190.0 1201.0 1207.0 large-vehicle 0
1069.0 1032.0 1085.0 1018.0 1212.0 1147.0 1194.0 1165.0 large-vehicle 0
1076.0 933.0 1093.0 922.0 1207.0 1052.0 1187.0 1067.0 large-vehicle 0
1075.0 573.0 1090.0 555.0 1237.0 663.0 1223.0 682.0 large-vehicle 0
1079.0 884.0 1097.0 872.0 1213.0 1007.0 1194.0 1023.0 large-vehicle 0
1084.0 839.0 1107.0 827.0 1217.0 959.0 1197.0 973.0 large-vehicle 0
1102.0 824.0 1118.0 804.0 1248.0 925.0 1234.0 941.0 large-vehicle 0
1070.0 722.0 1084.0 708.0 1224.0 823.0 1208.0 843.0 large-vehicle 0
1079.0 693.0 1095.0 676.0 1233.0 790.0 1219.0 811.0 large-vehicle 0
1085.0 660.0 1102.0 642.0 1228.0 751.0 1213.0 770.0 large-vehicle 0
1070.0 605.0 1086.0 594.0 1227.0 706.0 1210.0 723.0 large-vehicle 0
328.0 1754.0 330.0 1779.0 157.0 1777.0 155.0 1754.0 large-vehicle 0
339.0 1697.0 339.0 1718.0 160.0 1716.0 158.0 1692.0 large-vehicle 0
340.0 1669.0 339.0 1691.0 162.0 1688.0 164.0 1665.0 large-vehicle 0
1396.0 1387.0 1418.0 1388.0 1415.0 1432.0 1396.0 1432.0 small-vehicle 1
1419.0 1167.0 1440.0 1166.0 1439.0 1206.0 1419.0 1205.0 small-vehicle 0
1403.0 1002.0 1404.0 980.0 1462.0 983.0 1460.0 1004.0 small-vehicle 0
1405.0 975.0 1405.0 994.0 1365.0 992.0 1366.0 973.0 small-vehicle 0
1408.0 953.0 1407.0 972.0 1368.0 971.0 1368.0 951.0 small-vehicle 0
1290.0 1076.0 1310.0 1076.0 1309.0 1124.0 1290.0 1124.0 small-vehicle 0
1292.0 1024.0 1315.0 1023.0 1314.0 1072.0 1293.0 1072.0 small-vehicle 0
1417.0 1390.0 1436.0 1392.0 1435.0 1434.0 1415.0 1434.0 small-vehicle 1
1377.0 1388.0 1395.0 1388.0 1394.0 1432.0 1376.0 1431.0 small-vehicle 1
1343.0 310.0 1363.0 311.0 1362.0 358.0 1342.0 358.0 small-vehicle 0
1376.0 1376.0 1376.0 1395.0 1334.0 1392.0 1335.0 1375.0 small-vehicle 0
1376.0 1416.0 1372.0 1435.0 1334.0 1430.0 1336.0 1411.0 small-vehicle 1
1368.0 1489.0 1367.0 1510.0 1324.0 1508.0 1326.0 1486.0 small-vehicle 0
1371.0 1511.0 1370.0 1532.0 1329.0 1530.0 1330.0 1510.0 small-vehicle 1
1403.0 1951.0 1427.0 1951.0 1424.0 1996.0 1402.0 1995.0 small-vehicle 1
1377.0 1996.0 1355.0 1996.0 1356.0 1946.0 1380.0 1947.0 small-vehicle 1
1338.0 1940.0 1358.0 1943.0 1352.0 1987.0 1332.0 1983.0 small-vehicle 1
1447.0 1167.0 1456.0 1168.0 1454.0 1210.0 1444.0 1207.0 small-vehicle 1
1400.0 337.0 1414.0 354.0 1372.0 382.0 1360.0 365.0 small-vehicle 0
339.0 1643.0 336.0 1664.0 160.0 1658.0 163.0 1638.0 large-vehicle 0
1479.0 427.0 1478.0 452.0 1439.0 418.0 1451.0 404.0 small-vehicle 1
244.0 15.0 246.0 4.0 292.0 7.0 290.0 17.0 small-vehicle 1
268.0 319.0 267.0 338.0 231.0 338.0 230.0 320.0 small-vehicle 1
216.0 488.0 217.0 470.0 258.0 469.0 256.0 488.0 small-vehicle 0
1374.0 212.0 1366.0 195.0 1419.0 171.0 1426.0 189.0 small-vehicle 1
1481.0 308.0 1482.0 332.0 1443.0 300.0 1454.0 286.0 small-vehicle 1
1439.0 485.0 1450.0 469.0 1475.0 490.0 1475.0 514.0 small-vehicle 1
1478.0 459.0 1477.0 482.0 1443.0 452.0 1455.0 438.0 small-vehicle 1
1478.0 395.0 1480.0 421.0 1439.0 389.0 1452.0 374.0 small-vehicle 1
1375.0 248.0 1366.0 230.0 1413.0 204.0 1420.0 223.0 small-vehicle 0
1451.0 364.0 1465.0 350.0 1480.0 364.0 1480.0 386.0 small-vehicle 1
1397.0 307.0 1410.0 324.0 1375.0 350.0 1362.0 332.0 small-vehicle 0
1400.0 428.0 1411.0 444.0 1366.0 473.0 1355.0 456.0 small-vehicle 1
1363.0 445.0 1355.0 431.0 1385.0 410.0 1394.0 424.0 small-vehicle 0
1367.0 414.0 1357.0 398.0 1396.0 372.0 1406.0 388.0 small-vehicle 1
1403.0 258.0 1412.0 274.0 1376.0 296.0 1366.0 282.0 small-vehicle 1
1402.0 243.0 1408.0 258.0 1374.0 272.0 1368.0 259.0 small-vehicle 0
1360.0 1820.0 1378.0 1820.0 1376.0 1860.0 1359.0 1859.0 small-vehicle 1
1355.0 1858.0 1335.0 1857.0 1336.0 1815.0 1356.0 1816.0 small-vehicle 1
1405.0 2092.0 1426.0 2092.0 1426.0 2136.0 1406.0 2135.0 small-vehicle 1
348.0 1382.0 348.0 1403.0 177.0 1398.0 176.0 1374.0 large-vehicle 0
41.0 1752.0 66.0 1752.0 55.0 1917.0 30.0 1915.0 large-vehicle 0
868.0 338.0 890.0 337.0 888.0 478.0 865.0 478.0 large-vehicle 0
360.0 1243.0 357.0 1263.0 185.0 1260.0 190.0 1235.0 large-vehicle 0
359.0 1269.0 357.0 1291.0 181.0 1290.0 182.0 1266.0 large-vehicle 0
361.0 1297.0 362.0 1318.0 191.0 1312.0 191.0 1292.0 large-vehicle 0
357.0 1327.0 354.0 1348.0 173.0 1338.0 176.0 1314.0 large-vehicle 0
354.0 1356.0 352.0 1376.0 180.0 1370.0 181.0 1347.0 large-vehicle 0
345.0 1414.0 345.0 1435.0 173.0 1428.0 173.0 1402.0 large-vehicle 0
1389.0 2132.0 1366.0 2130.0 1371.0 2083.0 1395.0 2086.0 small-vehicle 1
348.0 1439.0 350.0 1459.0 172.0 1458.0 172.0 1433.0 large-vehicle 0
348.0 1472.0 349.0 1492.0 173.0 1482.0 175.0 1462.0 large-vehicle 0
345.0 1500.0 345.0 1523.0 169.0 1514.0 171.0 1490.0 large-vehicle 0
344.0 1529.0 345.0 1548.0 167.0 1546.0 169.0 1520.0 large-vehicle 0
337.0 1556.0 335.0 1576.0 183.0 1571.0 186.0 1552.0 large-vehicle 0
336.0 1581.0 338.0 1604.0 159.0 1598.0 161.0 1575.0 large-vehicle 0
341.0 1615.0 340.0 1639.0 168.0 1634.0 169.0 1609.0 large-vehicle 0
1388.0 1204.0 1365.0 1204.0 1369.0 1118.0 1393.0 1119.0 large-vehicle 0
1415.0 1204.0 1393.0 1204.0 1397.0 1122.0 1419.0 1119.0 large-vehicle 0
79.0 118.0 98.0 121.0 92.0 165.0 73.0 164.0 small-vehicle 0
452.0 278.0 460.0 299.0 416.0 315.0 408.0 295.0 small-vehicle 0
610.0 716.0 609.0 736.0 569.0 734.0 570.0 715.0 small-vehicle 1
451.0 467.0 459.0 484.0 417.0 504.0 410.0 486.0 small-vehicle 0
414.0 430.0 408.0 415.0 449.0 396.0 455.0 411.0 small-vehicle 1
371.0 499.0 364.0 485.0 405.0 465.0 412.0 481.0 small-vehicle 1
370.0 451.0 363.0 435.0 402.0 419.0 408.0 434.0 small-vehicle 1
364.0 412.0 371.0 429.0 411.0 411.0 404.0 395.0 small-vehicle 1
368.0 406.0 362.0 391.0 402.0 373.0 408.0 387.0 small-vehicle 1
131.0 566.0 130.0 545.0 181.0 542.0 181.0 561.0 small-vehicle 1
947.0 165.0 942.0 148.0 986.0 138.0 990.0 154.0 small-vehicle 1
72.0 224.0 93.0 225.0 90.0 264.0 71.0 263.0 small-vehicle 1
414.0 411.0 407.0 394.0 448.0 374.0 454.0 391.0 small-vehicle 0
414.0 479.0 408.0 463.0 442.0 447.0 449.0 464.0 small-vehicle 0
412.0 458.0 406.0 441.0 446.0 422.0 454.0 439.0 small-vehicle 0
416.0 359.0 408.0 343.0 447.0 327.0 454.0 343.0 small-vehicle 0
412.0 388.0 406.0 370.0 444.0 355.0 450.0 372.0 small-vehicle 0
565.0 1014.0 567.0 1035.0 385.0 1035.0 385.0 1010.0 large-vehicle 0
================================================
FILE: evaluation_example/row_DOTA_labels/P0019.txt
================================================
imagesource:GoogleEarth
gsd:0.108079065446
2762.0 305.0 2774.0 305.0 2772.0 335.0 2756.0 335.0 ship 0
1109.0 3205.0 1130.0 3201.0 1139.0 3243.0 1118.0 3249.0 small-vehicle 0
283.0 389.0 263.0 396.0 246.0 355.0 264.0 347.0 small-vehicle 0
3315.0 187.0 3289.0 187.0 3290.0 123.0 3315.0 125.0 small-vehicle 0
3903.0 258.0 3883.0 262.0 3875.0 211.0 3895.0 209.0 small-vehicle 0
3871.0 137.0 3872.0 156.0 3832.0 160.0 3830.0 141.0 small-vehicle 1
4205.0 198.0 4204.0 221.0 4154.0 216.0 4155.0 196.0 small-vehicle 0
4146.0 188.0 4148.0 166.0 4203.0 174.0 4200.0 196.0 small-vehicle 0
4637.0 238.0 4636.0 218.0 4682.0 216.0 4682.0 238.0 small-vehicle 1
4647.0 172.0 4644.0 150.0 4687.0 145.0 4689.0 166.0 small-vehicle 1
4537.0 136.0 4558.0 142.0 4541.0 178.0 4522.0 171.0 small-vehicle 1
1516.0 3244.0 1511.0 3263.0 1469.0 3258.0 1469.0 3237.0 small-vehicle 0
1157.0 3284.0 1136.0 3284.0 1138.0 3234.0 1159.0 3235.0 small-vehicle 0
1486.0 79.0 1468.0 87.0 1446.0 48.0 1465.0 40.0 small-vehicle 0
412.0 1270.0 396.0 1310.0 269.0 1267.0 282.0 1223.0 harbor 0
1642.0 154.0 1660.0 140.0 1687.0 178.0 1668.0 191.0 small-vehicle 0
1653.0 88.0 1648.0 67.0 1705.0 53.0 1710.0 74.0 small-vehicle 0
1112.0 2833.0 1131.0 2835.0 1130.0 2880.0 1113.0 2879.0 small-vehicle 1
2191.0 2930.0 2200.0 2906.0 2242.0 2931.0 2233.0 2953.0 ship 0
4020.0 932.0 3933.0 920.0 3959.0 772.0 4049.0 788.0 harbor 0
3427.0 779.0 3392.0 774.0 3417.0 649.0 3449.0 652.0 harbor 0
2853.0 454.0 2820.0 451.0 2825.0 369.0 2859.0 372.0 harbor 0
2444.0 564.0 2385.0 568.0 2382.0 373.0 2440.0 374.0 harbor 0
1823.0 761.0 1762.0 760.0 1772.0 531.0 1834.0 533.0 harbor 0
1136.0 837.0 1112.0 846.0 1067.0 747.0 1089.0 735.0 harbor 0
682.0 894.0 636.0 908.0 600.0 728.0 635.0 717.0 harbor 0
6417.0 3630.0 6394.0 3630.0 6394.0 3576.0 6417.0 3575.0 small-vehicle 0
1756.0 3109.0 1757.0 3132.0 1712.0 3132.0 1711.0 3109.0 small-vehicle 0
834.0 3318.0 856.0 3320.0 848.0 3368.0 827.0 3364.0 small-vehicle 0
388.0 3328.0 392.0 3306.0 443.0 3312.0 440.0 3334.0 small-vehicle 0
1489.0 2471.0 1515.0 2470.0 1517.0 2551.0 1491.0 2552.0 harbor 0
2436.0 2973.0 2467.0 2983.0 2426.0 3111.0 2402.0 3104.0 harbor 0
3303.0 3403.0 3322.0 3410.0 3287.0 3480.0 3265.0 3478.0 harbor 0
4895.0 3261.0 4917.0 3261.0 4919.0 3341.0 4897.0 3343.0 harbor 0
4492.0 3194.0 4536.0 3193.0 4533.0 3287.0 4488.0 3288.0 harbor 0
5216.0 3356.0 5241.0 3355.0 5241.0 3472.0 5215.0 3466.0 harbor 0
3330.0 740.0 3308.0 739.0 3321.0 587.0 3338.0 589.0 harbor 0
1432.0 813.0 1399.0 813.0 1401.0 686.0 1433.0 684.0 harbor 0
962.0 831.0 941.0 832.0 946.0 746.0 967.0 741.0 harbor 0
841.0 855.0 821.0 855.0 830.0 713.0 850.0 712.0 harbor 0
598.0 982.0 582.0 998.0 461.0 881.0 475.0 865.0 harbor 0
2176.0 503.0 2157.0 493.0 2175.0 453.0 2193.0 461.0 ship 0
2172.0 528.0 2155.0 531.0 2147.0 444.0 2161.0 440.0 harbor 0
3964.0 933.0 3970.0 912.0 4012.0 928.0 4006.0 948.0 ship 0
6130.0 2617.0 6141.0 2606.0 6168.0 2627.0 6158.0 2640.0 ship 0
5825.0 3610.0 5841.0 3630.0 5806.0 3658.0 5791.0 3638.0 ship 0
3441.0 3349.0 3457.0 3352.0 3449.0 3382.0 3432.0 3376.0 ship 0
120.0 790.0 98.0 789.0 104.0 730.0 124.0 732.0 large-vehicle 0
1332.0 2397.0 1351.0 2400.0 1335.0 2476.0 1318.0 2475.0 harbor 0
396.0 2681.0 390.0 2700.0 341.0 2685.0 347.0 2666.0 small-vehicle 0
362.0 2642.0 370.0 2622.0 419.0 2638.0 411.0 2659.0 small-vehicle 1
163.0 3293.0 142.0 3292.0 141.0 3242.0 165.0 3243.0 small-vehicle 1
125.0 3358.0 101.0 3357.0 102.0 3299.0 127.0 3299.0 small-vehicle 0
496.0 1103.0 471.0 1143.0 340.0 1053.0 368.0 1016.0 harbor 0
358.0 1479.0 356.0 1529.0 164.0 1515.0 165.0 1469.0 harbor 0
5692.0 687.0 5681.0 686.0 5682.0 665.0 5694.0 664.0 ship 0
862.0 3334.0 882.0 3336.0 875.0 3376.0 854.0 3375.0 small-vehicle 1
5125.0 845.0 5057.0 847.0 5059.0 670.0 5123.0 671.0 harbor 0
4650.0 899.0 4594.0 898.0 4590.0 763.0 4643.0 758.0 harbor 0
4816.0 741.0 4799.0 742.0 4798.0 693.0 4816.0 691.0 harbor 0
683.0 884.0 674.0 870.0 697.0 855.0 706.0 869.0 ship 1
181.0 1649.0 196.0 1640.0 211.0 1673.0 194.0 1679.0 ship 1
6037.0 3204.0 6039.0 3186.0 6080.0 3193.0 6077.0 3213.0 ship 1
6320.0 2743.0 6328.0 2741.0 6333.0 2778.0 6323.0 2781.0 ship 1
6129.0 2827.0 6127.0 2813.0 6156.0 2812.0 6160.0 2827.0 ship 1
5042.0 673.0 5034.0 670.0 5051.0 624.0 5060.0 627.0 ship 0
4998.0 643.0 5011.0 640.0 5014.0 666.0 5001.0 668.0 ship 0
4433.0 792.0 4432.0 775.0 4458.0 773.0 4459.0 790.0 ship 1
3635.0 3437.0 3648.0 3427.0 3665.0 3450.0 3651.0 3460.0 ship 0
355.0 1664.0 358.0 1703.0 194.0 1718.0 194.0 1678.0 harbor 0
3584.0 3416.0 3564.0 3421.0 3553.0 3373.0 3576.0 3371.0 ship 0
3578.0 3498.0 3583.0 3517.0 3560.0 3521.0 3556.0 3505.0 ship 0
3583.0 3487.0 3585.0 3497.0 3550.0 3504.0 3549.0 3495.0 ship 0
4004.0 3340.0 3991.0 3351.0 3969.0 3330.0 3982.0 3317.0 ship 0
3976.0 3369.0 3960.0 3377.0 3950.0 3358.0 3963.0 3348.0 ship 0
4775.0 3336.0 4783.0 3334.0 4782.0 3367.0 4774.0 3368.0 ship 0
4769.0 3332.0 4775.0 3333.0 4776.0 3365.0 4766.0 3366.0 ship 0
4757.0 3336.0 4766.0 3336.0 4768.0 3363.0 4754.0 3362.0 ship 0
6121.0 2428.0 6121.0 2458.0 6068.0 2455.0 6067.0 2429.0 ship 0
6067.0 1766.0 6068.0 1784.0 6031.0 1789.0 6031.0 1769.0 ship 0
5603.0 682.0 5613.0 678.0 5622.0 705.0 5614.0 711.0 ship 0
5218.0 765.0 5177.0 761.0 5197.0 648.0 5237.0 654.0 harbor 0
5359.0 807.0 5321.0 801.0 5342.0 657.0 5382.0 664.0 harbor 0
6006.0 1781.0 6004.0 1744.0 6144.0 1739.0 6149.0 1777.0 harbor 0
6006.0 2058.0 6005.0 1991.0 6201.0 1987.0 6203.0 2054.0 harbor 0
379.0 1946.0 391.0 1995.0 296.0 2030.0 270.0 1972.0 harbor 0
442.0 2049.0 458.0 2071.0 385.0 2120.0 374.0 2099.0 harbor 0
582.0 2141.0 622.0 2171.0 561.0 2265.0 513.0 2236.0 harbor 0
697.0 2204.0 745.0 2218.0 708.0 2328.0 666.0 2314.0 harbor 0
871.0 2278.0 902.0 2282.0 891.0 2344.0 860.0 2343.0 harbor 0
1775.0 2596.0 1828.0 2616.0 1787.0 2738.0 1734.0 2714.0 harbor 0
2221.0 2890.0 2265.0 2910.0 2232.0 2992.0 2184.0 2970.0 harbor 0
3028.0 3352.0 3066.0 3355.0 3059.0 3462.0 3024.0 3457.0 harbor 0
3439.0 3341.0 3484.0 3340.0 3480.0 3467.0 3435.0 3467.0 harbor 0
3577.0 3367.0 3619.0 3360.0 3638.0 3482.0 3595.0 3491.0 harbor 0
3838.0 3288.0 3895.0 3284.0 3900.0 3405.0 3841.0 3412.0 harbor 0
4257.0 3160.0 4306.0 3161.0 4305.0 3283.0 4255.0 3282.0 harbor 0
4620.0 3197.0 4666.0 3204.0 4651.0 3327.0 4604.0 3317.0 harbor 0
5075.0 3330.0 5131.0 3332.0 5132.0 3407.0 5077.0 3407.0 harbor 0
5473.0 3364.0 5530.0 3363.0 5535.0 3568.0 5485.0 3572.0 harbor 0
5650.0 3432.0 5697.0 3432.0 5704.0 3543.0 5656.0 3546.0 harbor 0
5760.0 3371.0 5809.0 3366.0 5812.0 3468.0 5767.0 3469.0 harbor 0
5976.0 3230.0 5985.0 3191.0 6155.0 3229.0 6143.0 3266.0 harbor 0
6080.0 3060.0 6101.0 3009.0 6247.0 3076.0 6229.0 3124.0 harbor 0
6081.0 2866.0 6082.0 2824.0 6275.0 2833.0 6273.0 2871.0 harbor 0
6054.0 2638.0 6055.0 2591.0 6214.0 2594.0 6214.0 2647.0 harbor 0
6022.0 2479.0 6018.0 2411.0 6201.0 2412.0 6201.0 2480.0 harbor 0
6071.0 2213.0 6067.0 2154.0 6249.0 2146.0 6253.0 2203.0 harbor 0
511.0 2113.0 527.0 2121.0 472.0 2223.0 459.0 2213.0 harbor 0
================================================
FILE: example/labelTxt/P0706.txt
================================================
imagesource:GoogleEarth
gsd:0.255589285596
1054 1028 1063 1011 1111 1040 1112 1062 ship 1
807 331 800 324 817 309 823 316 ship 0
879 366 888 373 870 393 861 386 ship 0
862 384 855 377 873 356 882 363 ship 0
867 348 874 355 856 375 849 369 ship 0
840 362 832 354 850 335 859 343 ship 0
828 352 823 345 845 327 851 334 ship 0
823 344 817 335 839 317 847 326 ship 0
899 278 907 286 882 308 875 300 ship 0
891 269 899 276 875 300 867 292 ship 0
884 260 891 269 872 287 865 280 ship 0
876 253 884 260 862 283 855 276 ship 0
869 245 875 252 854 271 846 263 ship 0
862 238 869 245 848 262 842 254 ship 0
852 231 858 237 839 257 831 250 ship 0
816 337 809 329 835 306 841 314 ship 0
801 322 795 315 816 296 823 304 ship 0
853 401 861 409 839 431 831 424 ship 0
809 288 816 296 793 316 786 309 ship 0
385 595 394 604 367 634 357 624 ship 0
395 605 404 615 376 642 367 633 ship 0
404 616 413 626 383 653 375 643 ship 0
391 671 380 660 414 624 425 636 ship 0
423 637 431 644 404 678 395 669 ship 0
412 688 403 678 434 644 444 655 ship 0
444 654 453 663 423 696 414 687 ship 0
453 663 463 673 436 705 426 697 ship 0
441 717 432 707 460 677 470 687 ship 0
456 723 447 712 473 686 483 697 ship 0
482 697 491 707 464 729 456 720 ship 0
492 704 503 715 470 744 460 734 ship 0
503 715 513 724 481 754 472 743 ship 0
889 377 896 385 876 401 870 393 ship 0
862 409 870 416 851 436 843 428 ship 0
970 1153 979 1138 1029 1174 1010 1182 ship 1
922 447 915 440 936 420 943 427 ship 0
952 330 959 337 938 357 930 350 ship 0
939 315 944 321 925 338 919 332 ship 0
1009 531 1002 524 1023 503 1029 510 ship 0
1000 524 992 516 1012 495 1021 504 ship 0
991 516 983 508 1003 489 1010 497 ship 0
980 528 986 536 961 557 955 549 ship 0
970 519 977 526 949 552 942 543 ship 0
976 501 969 493 989 474 996 482 ship 0
970 491 964 484 984 465 991 472 ship 0
975 459 983 468 961 487 954 478 ship 0
953 478 946 472 965 453 971 460 ship 0
948 469 941 462 962 437 971 445 ship 0
951 432 959 440 938 463 931 455 ship 0
944 425 951 432 932 454 924 447 ship 0
916 439 908 430 928 411 936 419 ship 0
854 451 846 443 869 417 878 426 ship 0
908 431 902 424 920 407 926 413 ship 0
900 423 893 415 916 394 924 403 ship 0
890 416 885 408 905 390 911 399 ship 0
885 407 879 400 895 384 902 391 ship 0
962 511 968 518 944 541 936 533 ship 0
952 500 960 509 936 532 928 524 ship 0
944 494 950 502 927 523 920 516 ship 0
936 486 943 492 924 512 916 505 ship 0
919 470 927 478 904 500 896 492 ship 0
912 461 919 469 895 493 887 485 ship 0
903 453 910 462 886 485 879 477 ship 0
896 443 905 451 883 471 875 463 ship 0
886 436 894 445 872 468 864 460 ship 0
877 427 886 436 861 461 853 453 ship 0
510 726 520 736 491 766 482 756 ship 0
523 734 532 744 506 772 497 762 ship 0
537 755 548 764 520 795 509 785 ship 0
251 457 260 466 235 493 226 485 ship 0
299 720 290 710 320 681 329 692 ship 0
287 713 277 704 309 671 320 681 ship 0
277 704 268 695 298 661 308 673 ship 0
286 654 295 663 268 693 258 683 ship 0
257 682 247 673 270 648 281 658 ship 0
251 671 241 663 267 633 278 641 ship 0
239 662 230 653 259 621 268 631 ship 0
230 651 222 642 247 615 256 623 ship 0
221 641 213 633 242 600 250 609 ship 0
210 632 202 626 217 606 225 613 ship 0
200 623 191 614 214 589 223 597 ship 0
192 612 184 603 211 577 218 584 ship 0
182 601 173 591 200 565 208 576 ship 0
219 484 210 474 235 452 244 463 ship 0
243 504 234 495 260 467 269 476 ship 0
550 766 559 775 532 801 524 792 ship 0
270 478 278 488 250 513 242 504 ship 0
259 525 249 515 280 487 289 497 ship 0
299 509 308 519 274 550 265 540 ship 0
290 499 296 506 282 519 276 513 ship 0
307 518 316 525 295 551 286 544 ship 0
327 534 337 545 304 578 293 567 ship 0
338 547 347 555 322 580 314 572 ship 0
328 592 319 582 347 557 356 568 ship 0
336 607 326 597 355 568 365 577 ship 0
366 577 375 587 349 613 340 603 ship 0
691 822 699 831 670 861 660 852 ship 0
659 851 650 843 674 818 684 827 ship 0
650 842 642 834 668 806 677 814 ship 0
641 833 632 823 660 795 670 803 ship 0
305 731 298 724 316 705 324 713 ship 0
342 699 361 718 328 751 309 732 ship 0
336 762 329 754 359 722 367 731 ship 0
356 781 347 771 374 742 384 751 ship 0
559 775 568 784 540 819 529 809 ship 0
567 786 577 794 553 821 545 813 ship 0
577 795 587 804 559 833 550 824 ship 0
584 807 593 817 569 842 559 832 ship 0
600 814 609 824 579 850 571 840 ship 0
608 824 618 833 587 861 579 851 ship 0
618 834 627 844 597 873 589 863 ship 0
629 845 637 854 609 881 600 871 ship 0
619 894 609 883 639 854 649 864 ship 0
645 869 653 878 627 903 619 896 ship 0
574 935 583 946 551 977 541 969 ship 0
560 927 571 938 541 970 530 959 ship 0
531 959 520 951 544 924 554 933 ship 0
522 947 513 940 535 913 545 920 ship 0
527 902 537 911 510 940 501 932 ship 0
500 928 492 919 517 892 526 900 ship 0
492 919 484 911 505 887 514 895 ship 0
483 910 473 900 504 868 515 879 ship 0
489 862 499 873 473 901 462 891 ship 0
462 891 453 882 479 852 490 861 ship 0
452 882 444 872 469 845 478 853 ship 0
443 869 435 862 458 832 467 840 ship 0
434 862 425 853 447 824 458 833 ship 0
445 808 455 816 425 850 414 841 ship 0
413 841 404 831 434 800 443 809 ship 0
396 820 387 812 412 782 422 790 ship 0
401 771 412 780 384 813 374 803 ship 0
375 801 366 792 392 763 402 773 ship 0
366 791 356 783 382 754 392 763 ship 0
960 340 966 347 949 362 942 355 ship 0
974 352 983 360 961 385 951 377 ship 0
989 370 996 377 979 394 972 387 ship 0
617 136 609 127 632 108 641 117 ship 0
380 185 369 196 333 159 344 147 ship 0
393 174 382 183 344 144 353 134 ship 0
355 135 360 128 378 145 371 152 ship 0
419 160 407 173 361 127 372 116 ship 0
425 142 413 152 375 115 386 103 ship 0
427 124 417 133 387 105 397 93 ship 0
444 116 434 127 398 94 408 82 ship 0
469 91 459 100 429 67 440 57 ship 0
478 80 467 89 441 55 453 47 ship 0
506 74 492 86 453 44 467 31 ship 0
510 52 500 63 467 31 478 20 ship 0
526 44 515 56 477 18 488 7 ship 0
594 112 587 103 610 84 617 94 ship 0
601 120 595 112 618 93 626 102 ship 0
626 146 618 139 637 119 645 128 ship 0
324 849 314 837 351 800 361 811 ship 0
141 465 152 477 120 511 107 499 ship 0
150 573 142 564 164 537 174 546 ship 0
183 536 194 545 162 585 151 575 ship 0
187 558 195 567 171 592 162 584 ship 0
53 509 42 521 3 482 13 471 ship 0
47 530 32 543 1 507 1 482 ship 1
29 541 18 552 0 534 1 510 ship 1
236 762 224 748 260 712 272 724 ship 0
272 724 282 733 253 767 241 757 ship 0
284 735 295 746 261 780 250 768 ship 0
295 746 305 756 272 793 261 783 ship 0
307 755 318 766 286 799 276 789 ship 0
321 768 330 780 292 811 283 800 ship 0
329 780 340 790 301 828 291 817 ship 0
369 196 359 208 319 169 331 157 ship 0
357 212 347 222 307 181 317 169 ship 0
343 219 335 228 298 192 306 182 ship 0
323 222 314 230 287 200 296 192 ship 0
478 214 488 202 908 628 895 640 harbor 0
358 330 370 320 781 736 771 748 harbor 0
241 447 253 435 663 856 652 866 harbor 0
118 566 130 554 542 975 531 986 harbor 0
117 630 107 618 140 588 150 599 ship 0
90 616 79 603 117 567 128 578 ship 0
136 658 125 646 161 610 173 622 ship 0
173 622 183 632 150 667 139 656 ship 0
156 683 144 671 183 633 196 646 ship 0
196 646 206 656 171 692 160 680 ship 0
206 656 216 666 176 709 165 697 ship 0
216 666 227 676 198 712 186 701 ship 0
227 678 238 689 206 728 194 716 ship 0
224 731 212 721 239 689 250 701 ship 0
250 701 260 712 230 742 220 731 ship 0
155 399 144 411 108 376 119 365 ship 0
163 383 154 394 121 365 131 354 ship 0
179 373 170 383 130 352 140 340 ship 0
182 359 175 369 141 341 150 330 ship 0
204 359 193 370 153 328 164 317 ship 0
223 347 211 359 169 321 180 309 ship 0
185 301 194 291 229 324 220 334 ship 0
247 321 233 331 198 287 211 278 ship 0
255 296 245 306 210 274 221 263 ship 0
264 282 256 291 225 260 233 251 ship 0
246 243 254 232 285 259 277 269 ship 0
308 258 297 270 255 232 265 220 ship 0
303 237 294 245 269 219 277 210 ship 0
312 228 304 237 277 210 285 201 ship 0
340 789 350 801 314 837 305 826 ship 0
361 811 372 822 337 859 326 848 ship 0
1004 384 1012 392 989 412 982 405 ship 0
999 931 986 944 944 896 956 884 ship 0
792 1017 783 1025 754 999 763 989 ship 0
769 989 777 979 802 1005 795 1013 ship 0
813 1074 804 1083 776 1054 786 1045 ship 0
795 1088 798 1077 830 1088 827 1099 ship 0
805 1101 812 1094 833 1114 824 1122 ship 0
835 988 849 974 895 1021 883 1034 ship 0
838 1040 849 1030 884 1064 873 1075 ship 0
782 1022 798 1010 850 1070 835 1083 ship 0
884 1064 894 1064 895 1083 886 1084 ship 0
923 979 914 989 871 951 882 939 ship 0
885 937 897 928 940 973 930 983 ship 0
900 928 913 918 948 961 936 971 ship 0
964 950 952 961 912 917 924 906 ship 0
981 940 969 952 926 906 939 893 ship 0
1008 912 997 924 952 881 962 868 ship 0
372 822 383 833 349 870 339 860 ship 0
964 864 976 853 1013 890 1003 902 ship 0
1034 883 1023 897 973 851 984 839 ship 0
1052 872 1040 888 986 839 999 825 ship 0
1001 826 1012 814 1052 852 1042 863 ship 0
1016 816 1030 803 1071 844 1058 856 ship 0
1078 831 1068 841 1034 804 1044 794 ship 0
1039 789 1048 778 1085 813 1075 823 ship 0
1101 804 1093 816 1049 778 1058 766 ship 0
1062 765 1073 754 1104 787 1094 796 ship 0
1071 453 1078 461 1054 484 1046 477 ship 0
1056 437 1063 444 1042 464 1034 456 ship 0
1035 416 1043 424 1024 444 1015 436 ship 0
1024 409 1032 415 1013 441 1005 435 ship 0
1020 399 1028 407 1006 428 997 419 ship 0
807 938 814 930 836 953 828 960 ship 0
815 920 823 911 854 941 845 950 ship 0
795 941 785 929 814 902 824 912 ship 0
782 892 774 898 754 874 762 868 ship 0
384 833 394 844 359 880 350 870 ship 0
395 845 405 855 371 889 361 879 ship 0
403 857 414 868 381 900 371 890 ship 0
414 867 425 878 394 909 383 898 ship 0
403 927 392 914 426 881 436 894 ship 0
413 937 403 927 439 892 448 901 ship 0
428 944 417 932 448 902 460 914 ship 0
460 914 471 924 435 965 423 952 ship 0
449 970 439 960 471 925 482 936 ship 0
482 936 493 946 457 986 446 976 ship 0
493 947 504 958 470 994 458 984 ship 0
513 971 523 980 492 1014 481 1003 ship 0
503 962 513 971 481 1003 472 993 ship 0
503 1026 492 1016 526 981 536 992 ship 0
546 1074 535 1086 486 1042 498 1029 ship 0
335 1062 343 1069 314 1098 306 1090 ship 0
360 1054 374 1068 322 1120 309 1105 ship 0
284 1072 275 1065 293 1042 303 1050 ship 0
245 1131 238 1124 255 1106 262 1112 ship 0
361 1085 370 1097 329 1131 321 1120 ship 0
389 1115 397 1127 346 1161 338 1148 ship 0
394 1131 403 1145 355 1175 345 1163 ship 0
404 1146 413 1161 379 1182 349 1182 ship 1
696 1043 701 1051 677 1067 671 1060 ship 0
633 967 646 959 679 1004 668 1013 ship 0
652 953 663 944 697 984 687 994 ship 0
673 936 686 926 714 961 701 971 ship 0
782 925 772 915 800 886 810 896 ship 0
795 884 787 893 755 862 765 852 ship 0
631 822 622 813 648 785 658 795 ship 0
620 812 611 803 641 772 651 781 ship 0
611 802 603 794 631 764 639 773 ship 0
613 327 605 321 631 294 640 302 ship 0
776 493 769 485 791 461 799 468 ship 0
767 485 760 478 780 455 788 463 ship 0
760 478 753 470 772 449 779 456 ship 0
753 469 745 462 766 439 774 446 ship 0
744 461 735 452 757 429 767 438 ship 0
728 446 720 438 743 413 752 420 ship 0
718 435 712 429 736 405 742 412 ship 0
725 395 735 402 712 428 703 419 ship 0
703 417 694 407 720 385 728 393 ship 0
697 362 704 371 677 396 668 388 ship 0
663 379 654 370 677 343 687 353 ship 0
653 370 646 362 665 342 672 349 ship 0
646 362 637 353 660 328 669 337 ship 0
638 304 647 312 622 335 614 327 ship 0
620 290 628 297 604 319 597 312 ship 0
639 161 634 153 660 135 666 144 ship 0
596 311 589 304 612 282 618 289 ship 0
588 300 582 293 607 270 614 277 ship 0
600 261 607 268 582 292 576 285 ship 0
558 150 550 143 576 117 583 125 ship 0
593 133 600 140 583 157 576 150 ship 0
600 143 607 149 587 169 580 162 ship 0
631 176 640 185 617 210 609 202 ship 0
641 186 649 194 627 219 618 211 ship 0
651 195 659 204 635 226 626 219 ship 0
665 211 672 218 648 240 641 234 ship 0
673 218 681 227 658 249 649 241 ship 0
688 234 699 244 673 274 662 264 ship 0
692 281 684 272 706 252 713 260 ship 0
714 261 721 269 699 290 692 282 ship 0
799 471 807 479 785 503 777 494 ship 0
796 510 787 501 810 476 819 486 ship 0
809 527 801 519 819 498 828 507 ship 0
831 504 840 512 820 535 810 526 ship 0
662 403 671 413 644 440 635 431 ship 0
662 460 653 448 681 423 691 433 ship 0
674 468 665 459 692 432 700 442 ship 0
680 486 671 476 700 444 709 452 ship 0
711 453 720 462 695 487 686 477 ship 0
715 464 726 472 701 506 690 496 ship 0
713 508 705 497 730 472 741 483 ship 0
740 482 749 492 721 519 711 510 ship 0
749 491 759 502 730 531 720 521 ship 0
742 535 732 524 759 501 767 512 ship 0
754 548 744 539 771 511 780 520 ship 0
779 522 788 531 763 557 753 548 ship 0
768 571 759 559 789 531 799 542 ship 0
777 581 769 570 799 542 808 551 ship 0
808 551 817 561 794 587 784 577 ship 0
798 599 790 589 818 561 827 571 ship 0
827 571 837 581 803 612 794 601 ship 0
823 611 817 604 840 584 846 591 ship 0
847 591 856 601 828 630 818 619 ship 0
866 611 876 621 846 650 837 640 ship 0
876 621 885 631 857 658 849 649 ship 0
914 587 923 593 902 619 894 610 ship 0
886 538 893 530 915 549 907 558 ship 0
877 595 867 587 891 560 901 569 ship 0
867 586 859 578 882 550 892 559 ship 0
858 578 850 569 869 548 878 555 ship 0
850 569 842 560 865 537 873 545 ship 0
834 552 826 545 846 525 853 533 ship 0
826 544 818 537 840 511 850 520 ship 0
630 152 626 144 650 128 655 136 ship 0
656 175 649 167 671 148 677 156 ship 0
643 383 651 391 623 419 616 410 ship 0
232 908 244 920 211 954 201 943 ship 0
51 716 73 737 31 777 11 755 ship 0
64 746 74 757 42 787 31 777 ship 0
78 756 89 768 54 801 43 788 ship 0
99 777 109 787 75 821 65 810 ship 0
114 786 124 796 86 833 78 823 ship 0
120 802 130 812 97 845 87 835 ship 0
136 808 147 820 109 856 99 846 ship 0
118 864 111 858 131 837 138 844 ship 0
163 842 175 851 139 889 128 878 ship 0
175 855 186 864 150 899 141 889 ship 0
182 870 192 880 162 911 152 900 ship 0
191 882 199 891 172 922 161 913 ship 0
206 886 219 898 188 932 175 920 ship 0
218 898 229 909 200 944 188 932 ship 0
243 922 252 930 217 968 206 958 ship 0
663 183 656 175 678 157 685 165 ship 0
226 980 215 971 244 940 254 951 ship 0
263 941 276 952 239 991 227 980 ship 0
280 950 292 962 250 1003 239 992 ship 0
286 970 297 983 261 1014 252 1003 ship 0
304 997 312 1006 279 1034 271 1025 ship 0
1054 1048 1062 1032 1110 1060 1104 1074 ship 0
1048 1064 1053 1050 1106 1078 1099 1092 ship 0
1032 1075 1042 1059 1093 1091 1086 1106 ship 0
1027 1089 1034 1076 1083 1107 1076 1119 ship 0
1009 1100 1018 1084 1071 1118 1064 1132 ship 0
999 1115 1007 1099 1063 1136 1055 1149 ship 0
1051 1151 1045 1162 1005 1137 1012 1125 ship 0
1041 1164 1034 1176 982 1141 991 1127 ship 0
950 1161 960 1147 1008 1182 978 1182 ship 1
742 115 748 120 724 146 717 139 ship 0
750 122 756 129 731 151 726 144 ship 0
757 132 762 139 737 161 731 154 ship 0
762 140 770 147 748 171 740 165 ship 0
673 192 665 186 679 168 687 174 ship 0
687 207 680 198 701 179 709 187 ship 0
707 189 714 196 695 214 689 208 ship 0
710 229 703 221 722 202 730 210 ship 0
733 210 741 217 717 239 710 231 ship 0
743 217 750 224 727 245 719 238 ship 0
741 262 733 253 756 232 764 240 ship 0
748 267 741 261 764 241 769 247 ship 0
754 277 747 270 770 247 778 256 ship 0
762 283 755 276 777 257 782 264 ship 0
786 261 795 270 770 293 762 284 ship 0
777 301 770 293 793 272 800 281 ship 0
787 307 781 299 800 282 806 291 ship 0
722 268 730 276 709 298 700 290 ship 0
730 276 738 283 717 306 709 298 ship 0
740 284 747 293 726 313 717 305 ship 0
748 294 755 301 735 320 729 312 ship 0
755 301 763 309 742 333 732 324 ship 0
778 325 787 334 764 358 755 348 ship 0
787 337 795 345 776 364 769 357 ship 0
795 345 802 351 783 373 775 367 ship 0
802 352 811 359 792 382 783 375 ship 0
797 390 790 382 813 360 821 369 ship 0
821 370 828 377 806 397 799 390 ship 0
829 377 838 386 813 408 805 398 ship 0
845 391 852 399 828 420 822 412 ship 0
788 163 794 170 776 185 771 178 ship 0
766 184 759 177 778 154 786 161 ship 0
771 147 778 153 756 178 749 171 ship 0
650 394 659 402 633 430 624 422 ship 0
631 374 640 384 611 413 602 404 ship 0
602 793 592 783 623 752 633 761 ship 0
573 548 581 556 556 583 549 576 ship 0
417 391 426 400 394 427 386 416 ship 0
427 400 437 411 400 442 392 430 ship 0
437 412 446 421 416 450 407 441 ship 0
424 465 414 455 446 420 458 431 ship 0
458 430 465 438 439 466 432 458 ship 0
475 451 484 460 455 491 446 482 ship 0
489 459 500 471 465 505 455 495 ship 0
507 478 515 487 487 516 478 507 ship 0
497 528 488 518 515 489 525 499 ship 0
526 500 534 509 509 533 500 525 ship 0
535 509 544 518 513 549 504 540 ship 0
545 521 553 531 523 559 515 549 ship 0
553 532 561 540 537 566 528 558 ship 0
563 539 572 548 548 574 539 567 ship 0
562 598 553 588 584 558 593 569 ship 0
748 726 757 734 725 768 717 758 ship 0
574 606 566 597 593 570 602 579 ship 0
602 579 611 588 585 616 576 607 ship 0
614 589 622 595 608 612 601 606 ship 0
623 598 632 607 603 633 595 623 ship 0
636 608 643 618 610 644 603 634 ship 0
642 618 649 626 625 652 617 643 ship 0
651 627 659 636 631 663 623 653 ship 0
644 669 636 664 659 637 666 644 ship 0
672 648 681 659 650 683 641 671 ship 0
686 658 692 666 660 693 653 685 ship 0
670 709 660 698 689 670 699 679 ship 0
710 687 719 695 692 721 684 712 ship 0
721 698 729 706 700 735 692 728 ship 0
731 708 740 716 711 747 701 738 ship 0
408 380 417 389 391 413 383 404 ship 0
400 369 408 378 379 407 371 398 ship 0
390 359 399 367 369 398 360 389 ship 0
380 350 389 359 355 391 347 382 ship 0
593 782 584 774 613 744 621 752 ship 0
583 773 573 763 599 736 611 747 ship 0
572 762 564 754 588 728 596 735 ship 0
589 709 597 719 564 750 555 740 ship 0
545 734 534 724 564 693 575 704 ship 0
534 723 525 715 552 686 562 697 ship 0
525 712 516 702 546 674 555 684 ship 0
516 702 506 692 538 661 548 670 ship 0
506 692 496 683 526 651 536 662 ship 0
495 682 485 670 512 645 521 656 ship 0
476 663 468 655 495 624 505 634 ship 0
482 619 492 627 467 655 459 646 ship 0
455 642 447 633 475 606 484 614 ship 0
470 592 479 601 447 633 438 622 ship 0
437 622 429 613 454 588 463 598 ship 0
417 602 409 595 430 573 438 581 ship 0
410 592 401 583 430 556 440 565 ship 0
399 585 389 575 417 548 427 558 ship 0
389 575 379 565 413 529 424 539 ship 0
380 564 370 555 396 525 407 535 ship 0
361 545 351 536 378 506 389 516 ship 0
350 534 340 524 367 500 376 509 ship 0
331 515 322 505 351 474 363 484 ship 0
320 503 313 496 341 468 348 475 ship 0
330 458 339 468 312 495 302 485 ship 0
300 484 292 474 320 442 332 453 ship 0
284 466 274 456 300 427 310 439 ship 0
364 331 371 340 348 356 341 348 ship 0
371 338 380 349 349 377 341 368 ship 0
740 717 748 726 718 755 711 747 ship 0
736 769 730 760 759 736 766 746 ship 0
613 352 623 362 590 394 581 384 ship 0
548 261 539 253 559 228 569 236 ship 0
449 398 440 390 464 358 475 365 ship 0
461 344 471 352 441 385 431 375 ship 0
430 376 422 368 446 343 455 351 ship 0
422 367 412 358 439 331 449 339 ship 0
411 358 402 349 430 319 440 328 ship 0
402 347 393 338 423 308 432 316 ship 0
394 335 385 327 409 298 420 308 ship 0
400 289 410 298 382 328 371 318 ship 0
477 215 486 225 457 251 450 241 ship 0
498 210 491 202 516 177 524 185 ship 0
506 216 499 208 526 185 532 193 ship 0
528 192 537 199 514 227 505 220 ship 0
520 235 514 228 531 211 538 220 ship 0
532 241 524 233 547 210 555 217 ship 0
557 267 549 259 572 234 581 242 ship 0
744 788 732 776 765 744 777 756 ship 0
507 244 515 252 486 280 479 272 ship 0
498 290 489 282 514 255 522 264 ship 0
525 264 534 274 507 302 497 293 ship 0
535 274 544 283 516 313 508 304 ship 0
543 286 551 294 527 322 518 314 ship 0
554 293 563 303 535 332 526 323 ship 0
564 277 557 270 578 246 587 254 ship 0
572 286 564 278 585 257 593 266 ship 0
540 347 530 336 564 303 574 313 ship 0
575 314 584 324 556 349 548 339 ship 0
584 325 592 334 563 359 556 350 ship 0
594 333 601 343 574 367 567 357 ship 0
586 378 576 367 605 342 613 352 ship 0
622 363 630 373 601 403 592 393 ship 0
458 409 450 400 478 373 486 381 ship 0
468 418 459 410 489 378 500 387 ship 0
490 397 498 403 480 423 473 416 ship 0
488 437 479 427 509 398 517 408 ship 0
810 702 819 711 791 743 781 735 ship 0
799 694 809 704 779 734 770 725 ship 0
788 685 798 694 770 724 761 716 ship 0
778 673 789 682 761 715 750 705 ship 0
772 660 782 668 750 703 740 693 ship 0
741 692 733 685 761 654 770 662 ship 0
751 645 761 653 734 681 725 672 ship 0
738 640 746 648 721 673 714 665 ship 0
727 631 736 640 714 664 704 655 ship 0
715 604 725 613 694 645 684 635 ship 0
683 636 674 626 700 599 711 609 ship 0
674 624 665 613 693 585 703 596 ship 0
684 576 692 586 662 616 653 606 ship 0
654 604 644 595 670 568 680 576 ship 0
645 594 636 585 662 555 672 565 ship 0
635 586 627 579 651 547 659 554 ship 0
642 541 650 549 624 577 615 567 ship 0
631 516 649 534 614 566 597 547 ship 0
600 539 594 532 616 511 622 518 ship 0
586 536 577 526 603 500 613 510 ship 0
595 485 605 494 577 525 567 517 ship 0
567 515 558 505 584 479 592 487 ship 0
574 467 585 476 556 507 546 497 ship 0
563 459 573 467 546 497 537 487 ship 0
537 486 530 477 560 448 567 456 ship 0
548 437 558 445 529 478 519 467 ship 0
533 435 540 444 520 465 511 456 ship 0
525 417 536 426 510 456 499 446 ship 0
518 407 526 415 499 444 491 436 ship 0
573 117 585 107 1003 530 993 540 harbor 0
================================================
FILE: example/labelTxt/P0770.txt
================================================
imagesource:GoogleEarth
gsd:0.266578848023
856 696 1469 1008 1341 1298 716 988 ground-track-field 0
1148 658 1255 711 1217 787 1110 735 swimming-pool 0
349 491 388 508 353 591 313 573 tennis-court 0
346 362 362 369 345 405 328 398 swimming-pool 0
248 577 330 613 314 652 231 614 tennis-court 0
543 66 560 76 540 115 521 104 swimming-pool 0
283 491 306 490 305 534 282 533 swimming-pool 0
244 643 292 664 278 694 231 672 swimming-pool 0
210 686 254 704 247 720 204 702 swimming-pool 0
223 1010 240 1018 226 1050 209 1043 swimming-pool 0
14 1091 56 1108 45 1131 5 1112 swimming-pool 0
125 1240 142 1247 130 1282 113 1275 swimming-pool 0
1002 339 1040 360 999 440 962 420 tennis-court 0
941 310 978 329 939 409 900 390 tennis-court 0
879 279 918 299 878 379 839 359 tennis-court 0
819 249 857 269 816 349 779 329 tennis-court 0
757 219 795 238 756 319 718 299 tennis-court 0
697 189 735 208 695 290 657 269 tennis-court 0
638 351 781 422 716 567 565 498 baseball-diamond 0
394 825 466 690 600 762 528 905 baseball-diamond 0
653 795 747 845 698 936 602 890 tennis-court 0
496 148 535 166 498 247 459 230 tennis-court 0
================================================
FILE: example/labelTxt/P1088.txt
================================================
imagesource:GoogleEarth
gsd:0.1377814038
226 738 225 756 191 756 191 739 small-vehicle 0
1033 545 948 547 949 490 1032 490 plane 0
407 532 323 535 323 479 410 478 plane 0
506 539 428 537 435 476 513 483 plane 0
615 545 528 541 533 486 615 488 plane 0
711 538 630 540 630 484 711 482 plane 0
816 545 730 544 733 479 819 483 plane 0
918 547 837 545 844 487 923 490 plane 0
1242 25 1238 107 1178 107 1184 22 plane 0
248 666 248 687 191 685 192 669 small-vehicle 0
1121 286 1040 282 1045 223 1127 227 plane 0
1016 278 942 276 944 225 1018 229 plane 0
919 281 840 280 836 220 922 221 plane 0
809 279 741 277 745 222 814 226 plane 0
617 270 541 271 541 220 616 221 plane 0
410 263 358 267 353 224 408 221 plane 0
384 914 252 910 261 797 393 802 plane 0
418 809 495 811 495 897 415 893 plane 0
540 783 670 787 669 908 536 909 plane 0
584 1165 689 1171 686 1282 576 1281 plane 0
756 1173 882 1179 879 1301 755 1297 plane 0
462 1664 630 1666 623 1831 467 1832 plane 0
988 1609 1162 1608 1161 1808 986 1805 plane 0
230 574 230 592 192 591 193 575 small-vehicle 0
230 595 229 615 193 614 193 595 small-vehicle 0
67 719 84 719 82 755 65 756 small-vehicle 0
101 738 116 736 115 771 100 771 small-vehicle 0
124 732 140 731 138 767 124 767 small-vehicle 0
191 1103 208 1103 206 1138 191 1137 small-vehicle 0
261 384 260 411 182 410 184 385 large-vehicle 0
267 432 267 454 200 457 200 434 large-vehicle 0
245 478 244 499 197 501 199 481 large-vehicle 0
64 734 46 735 47 691 66 691 small-vehicle 0
321 267 241 268 239 214 323 217 plane 0
================================================
FILE: poly_nms_gpu/Makefile
================================================
all:
python setup.py build_ext --inplace
rm -rf build
================================================
FILE: poly_nms_gpu/__init__.py
================================================
================================================
FILE: poly_nms_gpu/nms_wrapper.py
================================================
# --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
# from nms.gpu_nms import gpu_nms
# from nms.cpu_nms import cpu_nms
from .poly_nms import poly_gpu_nms
def poly_nms_gpu(dets, thresh, force_cpu=False):
"""Dispatch to either CPU or GPU NMS implementations."""
if dets.shape[0] == 0:
return []
return poly_gpu_nms(dets, thresh, device_id=0)
================================================
FILE: poly_nms_gpu/poly_nms.hpp
================================================
//
// Created by dingjian on 18-5-24.
//
#ifndef DOTA_DEVKIT_POLY_NMS_HPP
#define DOTA_DEVKIT_POLY_NMS_HPP
void _poly_nms(int* keep_out, int* num_out, const float* polys_host, int polys_num,
int polys_dim, float nms_overlap_thresh, int device_id);
#endif //DOTA_DEVKIT_POLY_NMS_HPP
================================================
FILE: poly_nms_gpu/poly_nms.pyx
================================================
import numpy as np
cimport numpy as np
assert sizeof(int) == sizeof(np.int32_t)
cdef extern from "poly_nms.hpp":
void _poly_nms(np.int32_t*, int*, np.float32_t*, int, int, float, int)
def poly_gpu_nms(np.ndarray[np.float32_t, ndim=2] dets, np.float thresh,
np.int32_t device_id=0):
cdef int boxes_num = dets.shape[0]
cdef int boxes_dim = dets.shape[1]
cdef int num_out
cdef np.ndarray[np.int32_t, ndim=1] \
keep = np.zeros(boxes_num, dtype=np.int32)
cdef np.ndarray[np.float32_t, ndim=1] \
scores = dets[:, 8]
cdef np.ndarray[np.int_t, ndim=1] \
order = scores.argsort()[::-1]
cdef np.ndarray[np.float32_t, ndim=2] \
sorted_dets = dets[order, :]
_poly_nms(&keep[0], &num_out, &sorted_dets[0, 0], boxes_num, boxes_dim, thresh, device_id)
keep = keep[:num_out]
return list(order[keep])
================================================
FILE: poly_nms_gpu/poly_nms_kernel.cu
================================================
#include "poly_nms.hpp"
#include
#include
#include
#include
#include
using namespace std;
//##define CUDA_CHECK(condition)\
//
// do {
// cudaError_t error = condition;
// if (error != cudaSuccess) {
//
// }
// }
#define CUDA_CHECK(condition) \
/* Code block avoids redefinition of cudaError_t error */ \
do { \
cudaError_t error = condition; \
if (error != cudaSuccess) { \
std::cout << cudaGetErrorString(error) << std::endl; \
} \
} while (0)
#define DIVUP(m,n) ((m) / (n) + ((m) % (n) > 0))
int const threadsPerBlock = sizeof(unsigned long long) * 8;
#define maxn 51
const double eps=1E-8;
__device__ inline int sig(float d){
return(d>eps)-(d<-eps);
}
// struct Point{
// double x,y; Point(){}
// Point(double x,double y):x(x),y(y){}
// bool operator==(const Point&p)const{
// return sig(x-p.x)==0&&sig(y-p.y)==0;
// }
// };
__device__ inline int point_eq(const float2 a, const float2 b) {
return sig(a.x - b.x) == 0 && sig(a.y - b.y)==0;
}
__device__ inline void point_swap(float2 *a, float2 *b) {
float2 temp = *a;
*a = *b;
*b = temp;
}
__device__ inline void point_reverse(float2 *first, float2* last)
{
while ((first!=last)&&(first!=--last)) {
point_swap (first,last);
++first;
}
}
// void point_reverse(Point* first, Point* last)
// {
// while ((first!=last)&&(first!=--last)) {
// point_swap (first,last);
// ++first;
// }
// }
__device__ inline float cross(float2 o,float2 a,float2 b){ //叉积
return(a.x-o.x)*(b.y-o.y)-(b.x-o.x)*(a.y-o.y);
}
__device__ inline float area(float2* ps,int n){
ps[n]=ps[0];
float res=0;
for(int i=0;i0) pp[m++]=p[i];
// if(sig(cross(a,b,p[i]))!=sig(cross(a,b,p[i+1])))
// lineCross(a,b,p[i],p[i+1],pp[m++]);
// }
// n=0;
// for(int i=0;i1&&p[n-1]==p[0])n--;
// while(n>1&&point_eq(p[n-1], p[0]))n--;
// }
__device__ inline void polygon_cut(float2*p,int&n,float2 a,float2 b, float2* pp){
int m=0;p[n]=p[0];
for(int i=0;i0) pp[m++]=p[i];
if(sig(cross(a,b,p[i]))!=sig(cross(a,b,p[i+1])))
lineCross(a,b,p[i],p[i+1],pp[m++]);
}
n=0;
for(int i=0;i1&&p[n-1]==p[0])n--;
while(n>1&&point_eq(p[n-1], p[0]))n--;
}
//---------------华丽的分隔线-----------------//
//返回三角形oab和三角形ocd的有向交面积,o是原点//
__device__ inline float intersectArea(float2 a,float2 b,float2 c,float2 d){
float2 o = make_float2(0,0);
int s1=sig(cross(o,a,b));
int s2=sig(cross(o,c,d));
if(s1==0||s2==0)return 0.0;//退化,面积为0
// if(s1==-1) swap(a,b);
// if(s2==-1) swap(c,d);
if (s1 == -1) point_swap(&a, &b);
if (s2 == -1) point_swap(&c, &d);
float2 p[10]={o,a,b};
int n=3;
float2 pp[maxn];
polygon_cut(p,n,o,c,pp);
polygon_cut(p,n,c,d,pp);
polygon_cut(p,n,d,o,pp);
float res=fabs(area(p,n));
if(s1*s2==-1) res=-res;return res;
}
//求两多边形的交面积
__device__ inline float intersectArea(float2*ps1,int n1,float2*ps2,int n2){
if(area(ps1,n1)<0) point_reverse(ps1,ps1+n1);
if(area(ps2,n2)<0) point_reverse(ps2,ps2+n2);
ps1[n1]=ps1[0];
ps2[n2]=ps2[0];
float res=0;
for(int i=0;i p, vector q) {
// Point ps1[maxn],ps2[maxn];
// int n1 = 4;
// int n2 = 4;
// for (int i = 0; i < 4; i++) {
// ps1[i].x = p[i * 2];
// ps1[i].y = p[i * 2 + 1];
//
// ps2[i].x = q[i * 2];
// ps2[i].y = q[i * 2 + 1];
// }
// double inter_area = intersectArea(ps1, n1, ps2, n2);
// double union_area = fabs(area(ps1, n1)) + fabs(area(ps2, n2)) - inter_area;
// double iou = inter_area / union_area;
//
//// cout << "inter_area:" << inter_area << endl;
//// cout << "union_area:" << union_area << endl;
//// cout << "iou:" << iou << endl;
//
// return iou;
//}
__device__ inline float devPolyIoU(float const * const p, float const * const q) {
float2 ps1[maxn], ps2[maxn];
int n1 = 4;
int n2 = 4;
for (int i = 0; i < 4; i++) {
ps1[i].x = p[i * 2];
ps1[i].y = p[i * 2 + 1];
ps2[i].x = q[i * 2];
ps2[i].y = q[i * 2 + 1];
}
float inter_area = intersectArea(ps1, n1, ps2, n2);
float union_area = fabs(area(ps1, n1)) + fabs(area(ps2, n2)) - inter_area;
float iou = 0;
if (union_area == 0) {
iou = (inter_area + 1) / (union_area + 1);
} else {
iou = inter_area / union_area;
}
return iou;
}
__global__ void poly_nms_kernel(const int n_polys, const float nms_overlap_thresh,
const float *dev_polys, unsigned long long *dev_mask) {
const int row_start = blockIdx.y;
const int col_start = blockIdx.x;
const int row_size =
min(n_polys - row_start * threadsPerBlock, threadsPerBlock);
const int cols_size =
min(n_polys - col_start * threadsPerBlock, threadsPerBlock);
__shared__ float block_polys[threadsPerBlock * 9];
if (threadIdx.x < cols_size) {
block_polys[threadIdx.x * 9 + 0] =
dev_polys[(threadsPerBlock * col_start + threadIdx.x) * 9 + 0];
block_polys[threadIdx.x * 9 + 1] =
dev_polys[(threadsPerBlock * col_start + threadIdx.x) * 9 + 1];
block_polys[threadIdx.x * 9 + 2] =
dev_polys[(threadsPerBlock * col_start + threadIdx.x) * 9 + 2];
block_polys[threadIdx.x * 9 + 3] =
dev_polys[(threadsPerBlock * col_start + threadIdx.x) * 9 + 3];
block_polys[threadIdx.x * 9 + 4] =
dev_polys[(threadsPerBlock * col_start + threadIdx.x) * 9 + 4];
block_polys[threadIdx.x * 9 + 5] =
dev_polys[(threadsPerBlock * col_start + threadIdx.x) * 9 + 5];
block_polys[threadIdx.x * 9 + 6] =
dev_polys[(threadsPerBlock * col_start + threadIdx.x) * 9 + 6];
block_polys[threadIdx.x * 9 + 7] =
dev_polys[(threadsPerBlock * col_start + threadIdx.x) * 9 + 7];
block_polys[threadIdx.x * 9 + 8] =
dev_polys[(threadsPerBlock * col_start + threadIdx.x) * 9 + 8];
}
__syncthreads();
if (threadIdx.x < row_size) {
const int cur_box_idx = threadsPerBlock * row_start + threadIdx.x;
const float *cur_box = dev_polys + cur_box_idx * 9;
int i = 0;
unsigned long long t = 0;
int start = 0;
if (row_start == col_start) {
start = threadIdx.x + 1;
}
for (i = start; i < cols_size; i++) {
if (devPolyIoU(cur_box, block_polys + i * 9) > nms_overlap_thresh) {
t |= 1ULL << i;
}
}
const int col_blocks = DIVUP(n_polys, threadsPerBlock);
dev_mask[cur_box_idx * col_blocks + col_start] = t;
}
}
void _set_device(int device_id) {
int current_device;
CUDA_CHECK(cudaGetDevice(¤t_device));
if (current_device == device_id) {
return;
}
// The call to cudaSetDevice must come before any calls to Get, which
// may perform initailization using the GPU.
CUDA_CHECK(cudaSetDevice(device_id));
}
void _poly_nms(int* keep_out, int* num_out, const float* polys_host, int polys_num,
int polys_dim, float nms_overlap_thresh, int device_id) {
float* polys_dev = NULL;
unsigned long long* mask_dev = NULL;
const int col_blocks = DIVUP(polys_num, threadsPerBlock);
CUDA_CHECK(cudaMalloc(&polys_dev,
polys_num * polys_dim * sizeof(float)));
CUDA_CHECK(cudaMemcpy(polys_dev,
polys_host,
polys_num * polys_dim * sizeof(float),
cudaMemcpyHostToDevice));
CUDA_CHECK(cudaMalloc(&mask_dev,
polys_num * col_blocks * sizeof(unsigned long long)));
dim3 blocks(DIVUP(polys_num, threadsPerBlock),
DIVUP(polys_num, threadsPerBlock));
dim3 threads(threadsPerBlock);
// __global__ void poly_nms_kernel(const int n_polys, const float nms_overlap_thresh,
// const float *dev_polys, unsigned long long *dev_mask)
poly_nms_kernel<<>>(polys_num,
nms_overlap_thresh,
polys_dev,
mask_dev);
std::vector mask_host(polys_num * col_blocks);
CUDA_CHECK(cudaMemcpy(&mask_host[0],
mask_dev,
sizeof(unsigned long long) * polys_num * col_blocks,
cudaMemcpyDeviceToHost));
std::vector remv(col_blocks);
memset(&remv[0], 0, sizeof(unsigned long long) * col_blocks);
// TODO: figure out it
int num_to_keep = 0;
for (int i = 0; i < polys_num; i++) {
int nblock = i / threadsPerBlock;
int inblock = i % threadsPerBlock;
if (!(remv[nblock] & (1ULL << inblock))) {
keep_out[num_to_keep++] = i;
unsigned long long *p = &mask_host[0] + i * col_blocks;
for (int j = nblock; j < col_blocks; j++) {
remv[j] |= p[j];
}
}
}
*num_out = num_to_keep;
CUDA_CHECK(cudaFree(polys_dev));
CUDA_CHECK(cudaFree(mask_dev));
}
//
//int main(){
// double p[8] = {0, 0, 1, 0, 1, 1, 0, 1};
// double q[8] = {0.5, 0.5, 1.5, 0.5, 1.5, 1.5, 0.5, 1.5};
// vector P(p, p + 8);
// vector Q(q, q + 8);
// iou_poly(P, Q);
// return 0;
//}
//int main(){
// double p[8] = {0, 0, 1, 0, 1, 1, 0, 1};
// double q[8] = {0.5, 0.5, 1.5, 0.5, 1.5, 1.5, 0.5, 1.5};
// iou_poly(p, q);
// return 0;
//}
================================================
FILE: poly_nms_gpu/poly_nms_test.py
================================================
================================================
FILE: poly_nms_gpu/poly_overlaps.hpp
================================================
void _overlaps(float* overlaps,const float* boxes,const float* query_boxes, int n, int k, int device_id);
================================================
FILE: poly_nms_gpu/poly_overlaps.pyx
================================================
import numpy as np
cimport numpy as np
cdef extern from "poly_overlaps.hpp":
void _overlaps(np.float32_t*, np.float32_t*, np.float32_t*, int, int, int)
def poly_overlaps (np.ndarray[np.float32_t, ndim=2] boxes, np.ndarray[np.float32_t, ndim=2] query_boxes, np.int32_t device_id=0):
cdef int N = boxes.shape[0]
cdef int K = query_boxes.shape[0]
cdef np.ndarray[np.float32_t, ndim=2] overlaps = np.zeros((N, K), dtype = np.float32)
_overlaps(&overlaps[0, 0], &boxes[0, 0], &query_boxes[0, 0], N, K, device_id)
return overlaps
================================================
FILE: poly_nms_gpu/poly_overlaps_kernel.cu
================================================
#include "poly_overlaps.hpp"
#include
#include
#include
#include
#include
using namespace std;
//##define CUDA_CHECK(condition)\
//
// do {
// cudaError_t error = condition;
// if (error != cudaSuccess) {
//
// }
// }
#define CUDA_CHECK(condition) \
/* Code block avoids redefinition of cudaError_t error */ \
do { \
cudaError_t error = condition; \
if (error != cudaSuccess) { \
std::cout << cudaGetErrorString(error) << std::endl; \
} \
} while (0)
#define DIVUP(m,n) ((m) / (n) + ((m) % (n) > 0))
int const threadsPerBlock = sizeof(unsigned long long) * 8;
#define maxn 510
const double eps=1E-8;
__device__ inline int sig(float d){
return(d>eps)-(d<-eps);
}
// struct Point{
// double x,y; Point(){}
// Point(double x,double y):x(x),y(y){}
// bool operator==(const Point&p)const{
// return sig(x-p.x)==0&&sig(y-p.y)==0;
// }
// };
__device__ inline int point_eq(const float2 a, const float2 b) {
return (sig(a.x - b.x) == 0) && (sig(a.y - b.y)==0);
}
__device__ inline void point_swap(float2 *a, float2 *b) {
float2 temp = *a;
*a = *b;
*b = temp;
}
__device__ inline void point_reverse(float2 *first, float2* last)
{
while ((first!=last)&&(first!=--last)) {
point_swap (first,last);
++first;
}
}
// void point_reverse(Point* first, Point* last)
// {
// while ((first!=last)&&(first!=--last)) {
// point_swap (first,last);
// ++first;
// }
// }
__device__ inline float cross(float2 o,float2 a,float2 b){ //叉积
return(a.x-o.x)*(b.y-o.y)-(b.x-o.x)*(a.y-o.y);
}
__device__ inline float area(float2* ps,int n){
ps[n]=ps[0];
float res=0;
for(int i=0;i0) pp[m++]=p[i];
// if(sig(cross(a,b,p[i]))!=sig(cross(a,b,p[i+1])))
// lineCross(a,b,p[i],p[i+1],pp[m++]);
// }
// n=0;
// for(int i=0;i1&&p[n-1]==p[0])n--;
// while(n>1&&point_eq(p[n-1], p[0]))n--;
// // int x = blockIdx.x * blockDim.x + threadIdx.x;
// // // corresponding to k
// // int y = blockIdx.y * blockDim.y + threadIdx.y;
// // int offset = x * 1 + y;
// // printf("polygon_cut, offset\n");
// }
__device__ inline void polygon_cut(float2*p,int&n,float2 a,float2 b, float2* pp){
// TODO: The static variable may be the reason, why single thread is ok, multiple threads are not work
// printf("polygon_cut, offset\n");
// static float2 pp[maxn];
int m=0;p[n]=p[0];
for(int i=0;i0) pp[m++]=p[i];
if(sig(cross(a,b,p[i]))!=sig(cross(a,b,p[i+1])))
lineCross(a,b,p[i],p[i+1],pp[m++]);
}
n=0;
for(int i=0;i1&&p[n-1]==p[0])n--;
while(n>1&&point_eq(p[n-1], p[0]))n--;
// int x = blockIdx.x * blockDim.x + threadIdx.x;
// // corresponding to k
// int y = blockIdx.y * blockDim.y + threadIdx.y;
// int offset = x * 1 + y;
// printf("polygon_cut, offset\n");
}
//---------------华丽的分隔线-----------------//
//返回三角形oab和三角形ocd的有向交面积,o是原点//
__device__ inline float intersectArea(float2 a,float2 b,float2 c,float2 d){
float2 o = make_float2(0,0);
int s1=sig(cross(o,a,b));
int s2=sig(cross(o,c,d));
if(s1==0||s2==0)return 0.0;//退化,面积为0
// if(s1==-1) swap(a,b);
// if(s2==-1) swap(c,d);
// printf("before swap\n");
// printf("a.x %f, a.y %f\n", a.x, a.y);
// printf("b.x %f, b.y %f\n", b.x, b.y);
if(s1 == -1) point_swap(&a, &b);
// printf("a.x %f, a.y %f\n", a.x, a.y);
// printf("b.x %f, b.y %f\n", b.x, b.y);
// printf("after swap\n");
if(s2 == -1) point_swap(&c, &d);
float2 p[10]={o,a,b};
int n=3;
// // manually implement polygon_cut(p, n, a, b)
// float2 pp[maxn];
// // polygon_cut(p, n, o, c)
// int m=0;p[n]=p[0];
// for(int i=0;i0) pp[m++]=p[i];
// if(sig(cross(o,c,p[i]))!=sig(cross(o,c,p[i+1])))
// lineCross(o,c,p[i],p[i+1],pp[m++]);
// }
// n=0;
// for(int i=0;i1&&point_eq(p[n-1], p[0]))n--;
// // polygon_cut(p, n, c, d)
// m=0;p[n]=p[0];
// for(int i=0;i0) pp[m++]=p[i];
// if(sig(cross(c,d,p[i]))!=sig(cross(c,d,p[i+1])))
// lineCross(c,d,p[i],p[i+1],pp[m++]);
// }
// n=0;
// for(int i=0;i1&&point_eq(p[n-1], p[0]))n--;
// // polygon_cut(p, n, d, o)
// m=0;p[n]=p[0];
// for(int i=0;i0) pp[m++]=p[i];
// if(sig(cross(d,o,p[i]))!=sig(cross(d,o,p[i+1])))
// lineCross(d,o,p[i],p[i+1],pp[m++]);
// }
// n=0;
// for(int i=0;i1&&point_eq(p[n-1], p[0]))n--;
float2 pp[maxn];
polygon_cut(p,n,o,c,pp);
polygon_cut(p,n,c,d,pp);
polygon_cut(p,n,d,o,pp);
float res=fabs(area(p,n));
int x = blockIdx.x * blockDim.x + threadIdx.x;
// corresponding to k
int y = blockIdx.y * blockDim.y + threadIdx.y;
int offset = x * 1 + y;
// printf("intersectArea2, offset: %d, %f, %f, %f, %f, %f, %f, %f, %f, res: %f\n", offset, a.x, a.y, b.x, b.y, c.x, c.y, d.x, d.y, res);
if(s1*s2==-1) res=-res;return res;
}
//求两多边形的交面积
// TODO: here changed the input, this need to be debug
__device__ inline float intersectArea(float2*ps1,int n1,float2*ps2,int n2){
int x = blockIdx.x * blockDim.x + threadIdx.x;
// corresponding to k
int y = blockIdx.y * blockDim.y + threadIdx.y;
int offset = x * 1 + y;
if(area(ps1,n1)<0) point_reverse(ps1,ps1+n1);
if(area(ps2,n2)<0) point_reverse(ps2,ps2+n2);
ps1[n1]=ps1[0];
ps2[n2]=ps2[0];
float res=0;
for(int i=0;i p, vector q) {
// Point ps1[maxn],ps2[maxn];
// int n1 = 4;
// int n2 = 4;
// for (int i = 0; i < 4; i++) {
// ps1[i].x = p[i * 2];
// ps1[i].y = p[i * 2 + 1];
//
// ps2[i].x = q[i * 2];
// ps2[i].y = q[i * 2 + 1];
// }
// double inter_area = intersectArea(ps1, n1, ps2, n2);
// double union_area = fabs(area(ps1, n1)) + fabs(area(ps2, n2)) - inter_area;
// double iou = inter_area / union_area;
//
//// cout << "inter_area:" << inter_area << endl;
//// cout << "union_area:" << union_area << endl;
//// cout << "iou:" << iou << endl;
//
// return iou;
//}
__device__ inline void RotBox2Poly(float const * const dbox, float2 * ps) {
float cs = cos(dbox[4]);
float ss = sin(dbox[4]);
float w = dbox[2];
float h = dbox[3];
float x_ctr = dbox[0];
float y_ctr = dbox[1];
ps[0].x = x_ctr + cs * (w / 2.0) - ss * (-h / 2.0);
ps[1].x = x_ctr + cs * (w / 2.0) - ss * (h / 2.0);
ps[2].x = x_ctr + cs * (-w / 2.0) - ss * (h / 2.0);
ps[3].x = x_ctr + cs * (-w / 2.0) - ss * (-h / 2.0);
ps[0].y = y_ctr + ss * (w / 2.0) + cs * (-h / 2.0);
ps[1].y = y_ctr + ss * (w / 2.0) + cs * (h / 2.0);
ps[2].y = y_ctr + ss * (-w / 2.0) + cs * (h / 2.0);
ps[3].y = y_ctr + ss * (-w / 2.0) + cs * (-h / 2.0);
}
__device__ inline float devPolyIoU(float const * const dbbox1, float const * const dbbox2) {
float2 ps1[maxn], ps2[maxn];
int n1 = 4;
int n2 = 4;
RotBox2Poly(dbbox1, ps1);
RotBox2Poly(dbbox2, ps2);
// printf("ps1: %f, %f, %f, %f, %f, %f, %f, %f\n", ps1[0].x, ps1[0].y, ps1[1].x, ps1[1].y, ps1[2].x, ps1[2].y, ps1[3].x, ps1[3].y);
// printf("ps2: %f, %f, %f, %f, %f, %f, %f, %f\n", ps2[0].x, ps2[0].y, ps2[1].x, ps2[1].y, ps2[2].x, ps2[2].y, ps2[3].x, ps2[3].y);
float inter_area = intersectArea(ps1, n1, ps2, n2);
//printf("inter_area: %f \n", inter_area);
float union_area = fabs(area(ps1, n1)) + fabs(area(ps2, n2)) - inter_area;
//printf("before union_area\n");
//printf("union_area: %f \n", union_area);
float iou = 0;
if (union_area == 0) {
iou = (inter_area + 1) / (union_area + 1);
} else {
iou = inter_area / union_area;
}
// printf("iou: %f \n", iou);
return iou;
}
__global__ void overlaps_kernel(const int N, const int K, const float* dev_boxes,
const float * dev_query_boxes, float* dev_overlaps) {
// const int col_start = blockIdx.y;
// const int row_start = blockIdx.x;
// corresponding to n
int x = blockIdx.x * blockDim.x + threadIdx.x;
// corresponding to k
int y = blockIdx.y * blockDim.y + threadIdx.y;
if ((x < N) && (y < K)) {
int offset = x * K + y;
//printf
// printf("offset: %d dbbox: %f %f %f %f %f\n", offset, (dev_boxes + x*5)[0],
// (dev_boxes + x*5)[1], (dev_boxes + x*5)[2], (dev_boxes + x*5)[3],
// (dev_boxes + x*5)[4] );
// printf("offset: %d dbbox: %f %f %f %f %f\n", offset, (dev_query_boxes + y*5)[0],
// (dev_query_boxes + y*5)[1], (dev_query_boxes + y*5)[2], (dev_query_boxes + y*5)[3],
// (dev_query_boxes + y*5)[4] );
dev_overlaps[offset] = devPolyIoU(dev_boxes + x * 5, dev_query_boxes + y * 5);
}
}
void _set_device(int device_id) {
int current_device;
CUDA_CHECK(cudaGetDevice(¤t_device));
if (current_device == device_id) {
return;
}
// The call to cudaSetDevice must come before any calls to Get, which
// may perform initialization using the GPU.
CUDA_CHECK(cudaSetDevice(device_id));
}
void _overlaps(float* overlaps,const float* boxes,const float* query_boxes, int n, int k, int device_id) {
_set_device(device_id);
float* overlaps_dev = NULL;
float* boxes_dev = NULL;
float* query_boxes_dev = NULL;
CUDA_CHECK(cudaMalloc(&boxes_dev,
n * 5 * sizeof(float)));
CUDA_CHECK(cudaMemcpy(boxes_dev,
boxes,
n * 5 * sizeof(float),
cudaMemcpyHostToDevice));
CUDA_CHECK(cudaMalloc(&query_boxes_dev,
k * 5 * sizeof(float)));
CUDA_CHECK(cudaMemcpy(query_boxes_dev,
query_boxes,
k * 5 * sizeof(float),
cudaMemcpyHostToDevice));
CUDA_CHECK(cudaMalloc(&overlaps_dev,
n * k * sizeof(float)));
if (true){}
dim3 blocks(DIVUP(n, 32),
DIVUP(k, 32));
dim3 threads(32, 32);
overlaps_kernel<<>>(n, k,
boxes_dev,
query_boxes_dev,
overlaps_dev);
CUDA_CHECK(cudaMemcpy(overlaps,
overlaps_dev,
n * k * sizeof(float),
cudaMemcpyDeviceToHost));
CUDA_CHECK(cudaFree(overlaps_dev));
CUDA_CHECK(cudaFree(boxes_dev));
CUDA_CHECK(cudaFree(query_boxes_dev));
}
================================================
FILE: poly_nms_gpu/setup.py
================================================
"""
setup.py file for SWIG example
"""
import os
from os.path import join as pjoin
from setuptools import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
import subprocess
import numpy as np
def find_in_path(name, path):
"Find a file in a search path"
# Adapted fom
# http://code.activestate.com/recipes/52224-find-a-file-given-a-search-path/
for dir in path.split(os.pathsep):
binpath = pjoin(dir, name)
if os.path.exists(binpath):
return os.path.abspath(binpath)
return None
def locate_cuda():
"""Locate the CUDA environment on the system
Returns a dict with keys 'home', 'nvcc', 'include', and 'lib64'
and values giving the absolute path to each directory.
Starts by looking for the CUDAHOME env variable. If not found, everything
is based on finding 'nvcc' in the PATH.
"""
# first check if the CUDAHOME env variable is in use
if 'CUDAHOME' in os.environ:
home = os.environ['CUDAHOME']
nvcc = pjoin(home, 'bin', 'nvcc')
else:
# otherwise, search the PATH for NVCC
default_path = pjoin(os.sep, 'usr', 'local', 'cuda', 'bin')
nvcc = find_in_path('nvcc', os.environ['PATH'] + os.pathsep + default_path)
if nvcc is None:
raise EnvironmentError('The nvcc binary could not be '
'located in your $PATH. Either add it to your path, or set $CUDAHOME')
home = os.path.dirname(os.path.dirname(nvcc))
cudaconfig = {'home':home, 'nvcc':nvcc,
'include': pjoin(home, 'include'),
'lib64': pjoin(home, 'lib64')}
try:
for k, v in cudaconfig.iteritems():
if not os.path.exists(v):
raise EnvironmentError('The CUDA %s path could not be located in %s' % (k, v))
except:
for k, v in cudaconfig.items():
if not os.path.exists(v):
raise EnvironmentError('The CUDA %s path could not be located in %s' % (k, v))
return cudaconfig
CUDA = locate_cuda()
# Obtain the numpy include directory. This logic works across numpy versions.
try:
numpy_include = np.get_include()
except AttributeError:
numpy_include = np.get_numpy_include()
def customize_compiler_for_nvcc(self):
"""inject deep into distutils to customize how the dispatch
to gcc/nvcc works.
If you subclass UnixCCompiler, it's not trivial to get your subclass
injected in, and still have the right customizations (i.e.
distutils.sysconfig.customize_compiler) run on it. So instead of going
the OO route, I have this. Note, it's kindof like a wierd functional
subclassing going on."""
# tell the compiler it can processes .cu
self.src_extensions.append('.cu')
# save references to the default compiler_so and _comple methods
default_compiler_so = self.compiler_so
super = self._compile
# now redefine the _compile method. This gets executed for each
# object but distutils doesn't have the ability to change compilers
# based on source extension: we add it.
def _compile(obj, src, ext, cc_args, extra_postargs, pp_opts):
if os.path.splitext(src)[1] == '.cu':
# use the cuda for .cu files
self.set_executable('compiler_so', CUDA['nvcc'])
# use only a subset of the extra_postargs, which are 1-1 translated
# from the extra_compile_args in the Extension class
postargs = extra_postargs['nvcc']
else:
postargs = extra_postargs['gcc']
super(obj, src, ext, cc_args, postargs, pp_opts)
# reset the default compiler_so, which we might have changed for cuda
self.compiler_so = default_compiler_so
# inject our redefined _compile method into the class
self._compile = _compile
# run the customize_compiler
class custom_build_ext(build_ext):
def build_extensions(self):
customize_compiler_for_nvcc(self.compiler)
build_ext.build_extensions(self)
ext_modules = [
Extension('poly_nms',
['poly_nms_kernel.cu', 'poly_nms.pyx'],
library_dirs=[CUDA['lib64']],
libraries=['cudart'],
language='c++',
runtime_library_dirs=[CUDA['lib64']],
# this syntax is specific to this build system
# we're only going to use certain compiler args with nvcc and not with
# gcc the implementation of this trick is in customize_compiler() below
extra_compile_args={'gcc': ["-Wno-unused-function"],
'nvcc': ['-arch=sm_35',
'--ptxas-options=-v',
'-c',
'--compiler-options',
"'-fPIC'"]},
include_dirs=[numpy_include, CUDA['include']]
),
Extension('poly_overlaps',
['poly_overlaps_kernel.cu', 'poly_overlaps.pyx'],
library_dirs=[CUDA['lib64']],
libraries=['cudart'],
language='c++',
runtime_library_dirs=[CUDA['lib64']],
# this syntax is specific to this build system
# we're only going to use certain compiler args with nvcc and not with
# gcc the implementation of this trick is in customize_compiler() below
extra_compile_args={'gcc': ["-Wno-unused-function"],
'nvcc': ['-arch=sm_35',
'--ptxas-options=-v',
'-c',
'--compiler-options',
"'-fPIC'"]},
include_dirs=[numpy_include, CUDA['include']]
),
]
setup(
name='rotation',
ext_modules=ext_modules,
# inject our custom trigger
cmdclass={'build_ext': custom_build_ext},
)
================================================
FILE: polyiou.cpp
================================================
#include
#include
#include
#include
#include
using namespace std;
#define maxn 51
const double eps=1E-8;
int sig(double d){
return(d>eps)-(d<-eps);
}
struct Point{
double x,y; Point(){}
Point(double x,double y):x(x),y(y){}
bool operator==(const Point&p)const{
return sig(x-p.x)==0&&sig(y-p.y)==0;
}
};
double cross(Point o,Point a,Point b){//叉积
return(a.x-o.x)*(b.y-o.y)-(b.x-o.x)*(a.y-o.y);
}
double area(Point* ps,int n){
ps[n]=ps[0];
double res=0;
for(int i=0;i0) pp[m++]=p[i];
// if(sig(cross(a,b,p[i]))!=sig(cross(a,b,p[i+1])))
// lineCross(a,b,p[i],p[i+1],pp[m++]);
// }
// n=0;
// for(int i=0;i1&&p[n-1]==p[0])n--;
//}
void polygon_cut(Point*p,int&n,Point a,Point b, Point* pp){
// static Point pp[maxn];
int m=0;p[n]=p[0];
for(int i=0;i0) pp[m++]=p[i];
if(sig(cross(a,b,p[i]))!=sig(cross(a,b,p[i+1])))
lineCross(a,b,p[i],p[i+1],pp[m++]);
}
n=0;
for(int i=0;i1&&p[n-1]==p[0])n--;
}
//---------------华丽的分隔线-----------------//
//返回三角形oab和三角形ocd的有向交面积,o是原点//
double intersectArea(Point a,Point b,Point c,Point d){
Point o(0,0);
int s1=sig(cross(o,a,b));
int s2=sig(cross(o,c,d));
if(s1==0||s2==0)return 0.0;//退化,面积为0
if(s1==-1) swap(a,b);
if(s2==-1) swap(c,d);
Point p[10]={o,a,b};
int n=3;
Point pp[maxn];
polygon_cut(p,n,o,c, pp);
polygon_cut(p,n,c,d, pp);
polygon_cut(p,n,d,o, pp);
double res=fabs(area(p,n));
if(s1*s2==-1) res=-res;return res;
}
//求两多边形的交面积
double intersectArea(Point*ps1,int n1,Point*ps2,int n2){
if(area(ps1,n1)<0) reverse(ps1,ps1+n1);
if(area(ps2,n2)<0) reverse(ps2,ps2+n2);
ps1[n1]=ps1[0];
ps2[n2]=ps2[0];
double res=0;
for(int i=0;i p, vector q) {
Point ps1[maxn],ps2[maxn];
int n1 = 4;
int n2 = 4;
for (int i = 0; i < 4; i++) {
ps1[i].x = p[i * 2];
ps1[i].y = p[i * 2 + 1];
ps2[i].x = q[i * 2];
ps2[i].y = q[i * 2 + 1];
}
double inter_area = intersectArea(ps1, n1, ps2, n2);
double union_area = fabs(area(ps1, n1)) + fabs(area(ps2, n2)) - inter_area;
double iou = inter_area / union_area;
// cout << "inter_area:" << inter_area << endl;
// cout << "union_area:" << union_area << endl;
// cout << "iou:" << iou << endl;
return iou;
}
//
//int main(){
// double p[8] = {0, 0, 1, 0, 1, 1, 0, 1};
// double q[8] = {0.5, 0.5, 1.5, 0.5, 1.5, 1.5, 0.5, 1.5};
// vector P(p, p + 8);
// vector Q(q, q + 8);
// iou_poly(P, Q);
// return 0;
//}
//int main(){
// double p[8] = {0, 0, 1, 0, 1, 1, 0, 1};
// double q[8] = {0.5, 0.5, 1.5, 0.5, 1.5, 1.5, 0.5, 1.5};
// iou_poly(p, q);
// return 0;
//}
================================================
FILE: polyiou.h
================================================
//
// Created by dingjian on 18-2-3.
//
#ifndef POLYIOU_POLYIOU_H
#define POLYIOU_POLYIOU_H
#include
double iou_poly(std::vector p, std::vector q);
#endif //POLYIOU_POLYIOU_H
================================================
FILE: polyiou.i
================================================
%module polyiou
%include "std_vector.i"
namespace std {
%template(VectorDouble) vector;
};
%{
#define SWIG_FILE_WITH_INIT
#include
#include
#include
#include
#include "polyiou.h"
%}
%include "polyiou.h"
================================================
FILE: polyiou.py
================================================
# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2, 6, 0):
def swig_import_helper():
from os.path import dirname
import imp
fp = None
try:
fp, pathname, description = imp.find_module('_polyiou', [dirname(__file__)])
except ImportError:
import _polyiou
return _polyiou
if fp is not None:
try:
_mod = imp.load_module('_polyiou', fp, pathname, description)
finally:
fp.close()
return _mod
_polyiou = swig_import_helper()
del swig_import_helper
else:
import _polyiou
del version_info
try:
_swig_property = property
except NameError:
pass # Python < 2.2 doesn't have 'property'.
def _swig_setattr_nondynamic(self, class_type, name, value, static=1):
if (name == "thisown"):
return self.this.own(value)
if (name == "this"):
if type(value).__name__ == 'SwigPyObject':
self.__dict__[name] = value
return
method = class_type.__swig_setmethods__.get(name, None)
if method:
return method(self, value)
if (not static):
if _newclass:
object.__setattr__(self, name, value)
else:
self.__dict__[name] = value
else:
raise AttributeError("You cannot add attributes to %s" % self)
def _swig_setattr(self, class_type, name, value):
return _swig_setattr_nondynamic(self, class_type, name, value, 0)
def _swig_getattr_nondynamic(self, class_type, name, static=1):
if (name == "thisown"):
return self.this.own()
method = class_type.__swig_getmethods__.get(name, None)
if method:
return method(self)
if (not static):
return object.__getattr__(self, name)
else:
raise AttributeError(name)
def _swig_getattr(self, class_type, name):
return _swig_getattr_nondynamic(self, class_type, name, 0)
def _swig_repr(self):
try:
strthis = "proxy of " + self.this.__repr__()
except Exception:
strthis = ""
return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
try:
_object = object
_newclass = 1
except AttributeError:
class _object:
pass
_newclass = 0
class SwigPyIterator(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, SwigPyIterator, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, SwigPyIterator, name)
def __init__(self, *args, **kwargs):
raise AttributeError("No constructor defined - class is abstract")
__repr__ = _swig_repr
__swig_destroy__ = _polyiou.delete_SwigPyIterator
__del__ = lambda self: None
def value(self):
return _polyiou.SwigPyIterator_value(self)
def incr(self, n=1):
return _polyiou.SwigPyIterator_incr(self, n)
def decr(self, n=1):
return _polyiou.SwigPyIterator_decr(self, n)
def distance(self, x):
return _polyiou.SwigPyIterator_distance(self, x)
def equal(self, x):
return _polyiou.SwigPyIterator_equal(self, x)
def copy(self):
return _polyiou.SwigPyIterator_copy(self)
def next(self):
return _polyiou.SwigPyIterator_next(self)
def __next__(self):
return _polyiou.SwigPyIterator___next__(self)
def previous(self):
return _polyiou.SwigPyIterator_previous(self)
def advance(self, n):
return _polyiou.SwigPyIterator_advance(self, n)
def __eq__(self, x):
return _polyiou.SwigPyIterator___eq__(self, x)
def __ne__(self, x):
return _polyiou.SwigPyIterator___ne__(self, x)
def __iadd__(self, n):
return _polyiou.SwigPyIterator___iadd__(self, n)
def __isub__(self, n):
return _polyiou.SwigPyIterator___isub__(self, n)
def __add__(self, n):
return _polyiou.SwigPyIterator___add__(self, n)
def __sub__(self, *args):
return _polyiou.SwigPyIterator___sub__(self, *args)
def __iter__(self):
return self
SwigPyIterator_swigregister = _polyiou.SwigPyIterator_swigregister
SwigPyIterator_swigregister(SwigPyIterator)
class VectorDouble(_object):
__swig_setmethods__ = {}
__setattr__ = lambda self, name, value: _swig_setattr(self, VectorDouble, name, value)
__swig_getmethods__ = {}
__getattr__ = lambda self, name: _swig_getattr(self, VectorDouble, name)
__repr__ = _swig_repr
def iterator(self):
return _polyiou.VectorDouble_iterator(self)
def __iter__(self):
return self.iterator()
def __nonzero__(self):
return _polyiou.VectorDouble___nonzero__(self)
def __bool__(self):
return _polyiou.VectorDouble___bool__(self)
def __len__(self):
return _polyiou.VectorDouble___len__(self)
def __getslice__(self, i, j):
return _polyiou.VectorDouble___getslice__(self, i, j)
def __setslice__(self, *args):
return _polyiou.VectorDouble___setslice__(self, *args)
def __delslice__(self, i, j):
return _polyiou.VectorDouble___delslice__(self, i, j)
def __delitem__(self, *args):
return _polyiou.VectorDouble___delitem__(self, *args)
def __getitem__(self, *args):
return _polyiou.VectorDouble___getitem__(self, *args)
def __setitem__(self, *args):
return _polyiou.VectorDouble___setitem__(self, *args)
def pop(self):
return _polyiou.VectorDouble_pop(self)
def append(self, x):
return _polyiou.VectorDouble_append(self, x)
def empty(self):
return _polyiou.VectorDouble_empty(self)
def size(self):
return _polyiou.VectorDouble_size(self)
def swap(self, v):
return _polyiou.VectorDouble_swap(self, v)
def begin(self):
return _polyiou.VectorDouble_begin(self)
def end(self):
return _polyiou.VectorDouble_end(self)
def rbegin(self):
return _polyiou.VectorDouble_rbegin(self)
def rend(self):
return _polyiou.VectorDouble_rend(self)
def clear(self):
return _polyiou.VectorDouble_clear(self)
def get_allocator(self):
return _polyiou.VectorDouble_get_allocator(self)
def pop_back(self):
return _polyiou.VectorDouble_pop_back(self)
def erase(self, *args):
return _polyiou.VectorDouble_erase(self, *args)
def __init__(self, *args):
this = _polyiou.new_VectorDouble(*args)
try:
self.this.append(this)
except Exception:
self.this = this
def push_back(self, x):
return _polyiou.VectorDouble_push_back(self, x)
def front(self):
return _polyiou.VectorDouble_front(self)
def back(self):
return _polyiou.VectorDouble_back(self)
def assign(self, n, x):
return _polyiou.VectorDouble_assign(self, n, x)
def resize(self, *args):
return _polyiou.VectorDouble_resize(self, *args)
def insert(self, *args):
return _polyiou.VectorDouble_insert(self, *args)
def reserve(self, n):
return _polyiou.VectorDouble_reserve(self, n)
def capacity(self):
return _polyiou.VectorDouble_capacity(self)
__swig_destroy__ = _polyiou.delete_VectorDouble
__del__ = lambda self: None
VectorDouble_swigregister = _polyiou.VectorDouble_swigregister
VectorDouble_swigregister(VectorDouble)
def iou_poly(p, q):
return _polyiou.iou_poly(p, q)
iou_poly = _polyiou.iou_poly
# This file is compatible with both classic and new-style classes.
================================================
FILE: polyiou_wrap.cxx
================================================
/* ----------------------------------------------------------------------------
* This file was automatically generated by SWIG (http://www.swig.org).
* Version 3.0.8
*
* This file is not intended to be easily readable and contains a number of
* coding conventions designed to improve portability and efficiency. Do not make
* changes to this file unless you know what you are doing--modify the SWIG
* interface file instead.
* ----------------------------------------------------------------------------- */
#ifndef SWIGPYTHON
#define SWIGPYTHON
#endif
#define SWIG_PYTHON_DIRECTOR_NO_VTABLE
#ifdef __cplusplus
/* SwigValueWrapper is described in swig.swg */
template class SwigValueWrapper {
struct SwigMovePointer {
T *ptr;
SwigMovePointer(T *p) : ptr(p) { }
~SwigMovePointer() { delete ptr; }
SwigMovePointer& operator=(SwigMovePointer& rhs) { T* oldptr = ptr; ptr = 0; delete oldptr; ptr = rhs.ptr; rhs.ptr = 0; return *this; }
} pointer;
SwigValueWrapper& operator=(const SwigValueWrapper& rhs);
SwigValueWrapper(const SwigValueWrapper& rhs);
public:
SwigValueWrapper() : pointer(0) { }
SwigValueWrapper& operator=(const T& t) { SwigMovePointer tmp(new T(t)); pointer = tmp; return *this; }
operator T&() const { return *pointer.ptr; }
T *operator&() { return pointer.ptr; }
};
template T SwigValueInit() {
return T();
}
#endif
/* -----------------------------------------------------------------------------
* This section contains generic SWIG labels for method/variable
* declarations/attributes, and other compiler dependent labels.
* ----------------------------------------------------------------------------- */
/* template workaround for compilers that cannot correctly implement the C++ standard */
#ifndef SWIGTEMPLATEDISAMBIGUATOR
# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
# define SWIGTEMPLATEDISAMBIGUATOR template
# elif defined(__HP_aCC)
/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
# define SWIGTEMPLATEDISAMBIGUATOR template
# else
# define SWIGTEMPLATEDISAMBIGUATOR
# endif
#endif
/* inline attribute */
#ifndef SWIGINLINE
# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
# define SWIGINLINE inline
# else
# define SWIGINLINE
# endif
#endif
/* attribute recognised by some compilers to avoid 'unused' warnings */
#ifndef SWIGUNUSED
# if defined(__GNUC__)
# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
# elif defined(__ICC)
# define SWIGUNUSED __attribute__ ((__unused__))
# else
# define SWIGUNUSED
# endif
#endif
#ifndef SWIG_MSC_UNSUPPRESS_4505
# if defined(_MSC_VER)
# pragma warning(disable : 4505) /* unreferenced local function has been removed */
# endif
#endif
#ifndef SWIGUNUSEDPARM
# ifdef __cplusplus
# define SWIGUNUSEDPARM(p)
# else
# define SWIGUNUSEDPARM(p) p SWIGUNUSED
# endif
#endif
/* internal SWIG method */
#ifndef SWIGINTERN
# define SWIGINTERN static SWIGUNUSED
#endif
/* internal inline SWIG method */
#ifndef SWIGINTERNINLINE
# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
#endif
/* exporting methods */
#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
# ifndef GCC_HASCLASSVISIBILITY
# define GCC_HASCLASSVISIBILITY
# endif
#endif
#ifndef SWIGEXPORT
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# if defined(STATIC_LINKED)
# define SWIGEXPORT
# else
# define SWIGEXPORT __declspec(dllexport)
# endif
# else
# if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
# define SWIGEXPORT __attribute__ ((visibility("default")))
# else
# define SWIGEXPORT
# endif
# endif
#endif
/* calling conventions for Windows */
#ifndef SWIGSTDCALL
# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# define SWIGSTDCALL __stdcall
# else
# define SWIGSTDCALL
# endif
#endif
/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE
#endif
/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
# define _SCL_SECURE_NO_DEPRECATE
#endif
/* Deal with Apple's deprecated 'AssertMacros.h' from Carbon-framework */
#if defined(__APPLE__) && !defined(__ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES)
# define __ASSERT_MACROS_DEFINE_VERSIONS_WITHOUT_UNDERSCORES 0
#endif
/* Intel's compiler complains if a variable which was never initialised is
* cast to void, which is a common idiom which we use to indicate that we
* are aware a variable isn't used. So we just silence that warning.
* See: https://github.com/swig/swig/issues/192 for more discussion.
*/
#ifdef __INTEL_COMPILER
# pragma warning disable 592
#endif
#if defined(_DEBUG) && defined(SWIG_PYTHON_INTERPRETER_NO_DEBUG)
/* Use debug wrappers with the Python release dll */
# undef _DEBUG
# include
# define _DEBUG
#else
# include
#endif
/* -----------------------------------------------------------------------------
* swigrun.swg
*
* This file contains generic C API SWIG runtime support for pointer
* type checking.
* ----------------------------------------------------------------------------- */
/* This should only be incremented when either the layout of swig_type_info changes,
or for whatever reason, the runtime changes incompatibly */
#define SWIG_RUNTIME_VERSION "4"
/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
#ifdef SWIG_TYPE_TABLE
# define SWIG_QUOTE_STRING(x) #x
# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
#else
# define SWIG_TYPE_TABLE_NAME
#endif
/*
You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
creating a static or dynamic library from the SWIG runtime code.
In 99.9% of the cases, SWIG just needs to declare them as 'static'.
But only do this if strictly necessary, ie, if you have problems
with your compiler or suchlike.
*/
#ifndef SWIGRUNTIME
# define SWIGRUNTIME SWIGINTERN
#endif
#ifndef SWIGRUNTIMEINLINE
# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
#endif
/* Generic buffer size */
#ifndef SWIG_BUFFER_SIZE
# define SWIG_BUFFER_SIZE 1024
#endif
/* Flags for pointer conversions */
#define SWIG_POINTER_DISOWN 0x1
#define SWIG_CAST_NEW_MEMORY 0x2
/* Flags for new pointer objects */
#define SWIG_POINTER_OWN 0x1
/*
Flags/methods for returning states.
The SWIG conversion methods, as ConvertPtr, return an integer
that tells if the conversion was successful or not. And if not,
an error code can be returned (see swigerrors.swg for the codes).
Use the following macros/flags to set or process the returning
states.
In old versions of SWIG, code such as the following was usually written:
if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
// success code
} else {
//fail code
}
Now you can be more explicit:
int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
if (SWIG_IsOK(res)) {
// success code
} else {
// fail code
}
which is the same really, but now you can also do
Type *ptr;
int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
if (SWIG_IsOK(res)) {
// success code
if (SWIG_IsNewObj(res) {
...
delete *ptr;
} else {
...
}
} else {
// fail code
}
I.e., now SWIG_ConvertPtr can return new objects and you can
identify the case and take care of the deallocation. Of course that
also requires SWIG_ConvertPtr to return new result values, such as
int SWIG_ConvertPtr(obj, ptr,...) {
if () {
if () {
*ptr = ;
return SWIG_NEWOBJ;
} else {
*ptr = ;
return SWIG_OLDOBJ;
}
} else {
return SWIG_BADOBJ;
}
}
Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
SWIG errors code.
Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
allows to return the 'cast rank', for example, if you have this
int food(double)
int fooi(int);
and you call
food(1) // cast rank '1' (1 -> 1.0)
fooi(1) // cast rank '0'
just use the SWIG_AddCast()/SWIG_CheckState()
*/
#define SWIG_OK (0)
#define SWIG_ERROR (-1)
#define SWIG_IsOK(r) (r >= 0)
#define SWIG_ArgError(r) ((r != SWIG_ERROR) ? r : SWIG_TypeError)
/* The CastRankLimit says how many bits are used for the cast rank */
#define SWIG_CASTRANKLIMIT (1 << 8)
/* The NewMask denotes the object was created (using new/malloc) */
#define SWIG_NEWOBJMASK (SWIG_CASTRANKLIMIT << 1)
/* The TmpMask is for in/out typemaps that use temporal objects */
#define SWIG_TMPOBJMASK (SWIG_NEWOBJMASK << 1)
/* Simple returning values */
#define SWIG_BADOBJ (SWIG_ERROR)
#define SWIG_OLDOBJ (SWIG_OK)
#define SWIG_NEWOBJ (SWIG_OK | SWIG_NEWOBJMASK)
#define SWIG_TMPOBJ (SWIG_OK | SWIG_TMPOBJMASK)
/* Check, add and del mask methods */
#define SWIG_AddNewMask(r) (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
#define SWIG_DelNewMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
#define SWIG_IsNewObj(r) (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
#define SWIG_AddTmpMask(r) (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
#define SWIG_DelTmpMask(r) (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
#define SWIG_IsTmpObj(r) (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
/* Cast-Rank Mode */
#if defined(SWIG_CASTRANK_MODE)
# ifndef SWIG_TypeRank
# define SWIG_TypeRank unsigned long
# endif
# ifndef SWIG_MAXCASTRANK /* Default cast allowed */
# define SWIG_MAXCASTRANK (2)
# endif
# define SWIG_CASTRANKMASK ((SWIG_CASTRANKLIMIT) -1)
# define SWIG_CastRank(r) (r & SWIG_CASTRANKMASK)
SWIGINTERNINLINE int SWIG_AddCast(int r) {
return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
}
SWIGINTERNINLINE int SWIG_CheckState(int r) {
return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0;
}
#else /* no cast-rank mode */
# define SWIG_AddCast(r) (r)
# define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
#endif
#include
#ifdef __cplusplus
extern "C" {
#endif
typedef void *(*swig_converter_func)(void *, int *);
typedef struct swig_type_info *(*swig_dycast_func)(void **);
/* Structure to store information on one type */
typedef struct swig_type_info {
const char *name; /* mangled name of this type */
const char *str; /* human readable name of this type */
swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
struct swig_cast_info *cast; /* linked list of types that can cast into this type */
void *clientdata; /* language specific type data */
int owndata; /* flag if the structure owns the clientdata */
} swig_type_info;
/* Structure to store a type and conversion function used for casting */
typedef struct swig_cast_info {
swig_type_info *type; /* pointer to type that is equivalent to this type */
swig_converter_func converter; /* function to cast the void pointers */
struct swig_cast_info *next; /* pointer to next cast in linked list */
struct swig_cast_info *prev; /* pointer to the previous cast */
} swig_cast_info;
/* Structure used to store module information
* Each module generates one structure like this, and the runtime collects
* all of these structures and stores them in a circularly linked list.*/
typedef struct swig_module_info {
swig_type_info **types; /* Array of pointers to swig_type_info structures that are in this module */
size_t size; /* Number of types in this module */
struct swig_module_info *next; /* Pointer to next element in circularly linked list */
swig_type_info **type_initial; /* Array of initially generated type structures */
swig_cast_info **cast_initial; /* Array of initially generated casting structures */
void *clientdata; /* Language specific module data */
} swig_module_info;
/*
Compare two type names skipping the space characters, therefore
"char*" == "char *" and "Class" == "Class", etc.
Return 0 when the two name types are equivalent, as in
strncmp, but skipping ' '.
*/
SWIGRUNTIME int
SWIG_TypeNameComp(const char *f1, const char *l1,
const char *f2, const char *l2) {
for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
while ((*f1 == ' ') && (f1 != l1)) ++f1;
while ((*f2 == ' ') && (f2 != l2)) ++f2;
if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
}
return (int)((l1 - f1) - (l2 - f2));
}
/*
Check type equivalence in a name list like ||...
Return 0 if equal, -1 if nb < tb, 1 if nb > tb
*/
SWIGRUNTIME int
SWIG_TypeCmp(const char *nb, const char *tb) {
int equiv = 1;
const char* te = tb + strlen(tb);
const char* ne = nb;
while (equiv != 0 && *ne) {
for (nb = ne; *ne; ++ne) {
if (*ne == '|') break;
}
equiv = SWIG_TypeNameComp(nb, ne, tb, te);
if (*ne) ++ne;
}
return equiv;
}
/*
Check type equivalence in a name list like ||...
Return 0 if not equal, 1 if equal
*/
SWIGRUNTIME int
SWIG_TypeEquiv(const char *nb, const char *tb) {
return SWIG_TypeCmp(nb, tb) == 0 ? 1 : 0;
}
/*
Check the typename
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheck(const char *c, swig_type_info *ty) {
if (ty) {
swig_cast_info *iter = ty->cast;
while (iter) {
if (strcmp(iter->type->name, c) == 0) {
if (iter == ty->cast)
return iter;
/* Move iter to the top of the linked list */
iter->prev->next = iter->next;
if (iter->next)
iter->next->prev = iter->prev;
iter->next = ty->cast;
iter->prev = 0;
if (ty->cast) ty->cast->prev = iter;
ty->cast = iter;
return iter;
}
iter = iter->next;
}
}
return 0;
}
/*
Identical to SWIG_TypeCheck, except strcmp is replaced with a pointer comparison
*/
SWIGRUNTIME swig_cast_info *
SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *ty) {
if (ty) {
swig_cast_info *iter = ty->cast;
while (iter) {
if (iter->type == from) {
if (iter == ty->cast)
return iter;
/* Move iter to the top of the linked list */
iter->prev->next = iter->next;
if (iter->next)
iter->next->prev = iter->prev;
iter->next = ty->cast;
iter->prev = 0;
if (ty->cast) ty->cast->prev = iter;
ty->cast = iter;
return iter;
}
iter = iter->next;
}
}
return 0;
}
/*
Cast a pointer up an inheritance hierarchy
*/
SWIGRUNTIMEINLINE void *
SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
}
/*
Dynamic pointer casting. Down an inheritance hierarchy
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
swig_type_info *lastty = ty;
if (!ty || !ty->dcast) return ty;
while (ty && (ty->dcast)) {
ty = (*ty->dcast)(ptr);
if (ty) lastty = ty;
}
return lastty;
}
/*
Return the name associated with this type
*/
SWIGRUNTIMEINLINE const char *
SWIG_TypeName(const swig_type_info *ty) {
return ty->name;
}
/*
Return the pretty name associated with this type,
that is an unmangled type name in a form presentable to the user.
*/
SWIGRUNTIME const char *
SWIG_TypePrettyName(const swig_type_info *type) {
/* The "str" field contains the equivalent pretty names of the
type, separated by vertical-bar characters. We choose
to print the last name, as it is often (?) the most
specific. */
if (!type) return NULL;
if (type->str != NULL) {
const char *last_name = type->str;
const char *s;
for (s = type->str; *s; s++)
if (*s == '|') last_name = s+1;
return last_name;
}
else
return type->name;
}
/*
Set the clientdata field for a type
*/
SWIGRUNTIME void
SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
swig_cast_info *cast = ti->cast;
/* if (ti->clientdata == clientdata) return; */
ti->clientdata = clientdata;
while (cast) {
if (!cast->converter) {
swig_type_info *tc = cast->type;
if (!tc->clientdata) {
SWIG_TypeClientData(tc, clientdata);
}
}
cast = cast->next;
}
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
SWIG_TypeClientData(ti, clientdata);
ti->owndata = 1;
}
/*
Search for a swig_type_info structure only by mangled name
Search is a O(log #types)
We start searching at module start, and finish searching when start == end.
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_MangledTypeQueryModule(swig_module_info *start,
swig_module_info *end,
const char *name) {
swig_module_info *iter = start;
do {
if (iter->size) {
size_t l = 0;
size_t r = iter->size - 1;
do {
/* since l+r >= 0, we can (>> 1) instead (/ 2) */
size_t i = (l + r) >> 1;
const char *iname = iter->types[i]->name;
if (iname) {
int compare = strcmp(name, iname);
if (compare == 0) {
return iter->types[i];
} else if (compare < 0) {
if (i) {
r = i - 1;
} else {
break;
}
} else if (compare > 0) {
l = i + 1;
}
} else {
break; /* should never happen */
}
} while (l <= r);
}
iter = iter->next;
} while (iter != end);
return 0;
}
/*
Search for a swig_type_info structure for either a mangled name or a human readable name.
It first searches the mangled names of the types, which is a O(log #types)
If a type is not found it then searches the human readable names, which is O(#types).
We start searching at module start, and finish searching when start == end.
Note: if start == end at the beginning of the function, we go all the way around
the circular list.
*/
SWIGRUNTIME swig_type_info *
SWIG_TypeQueryModule(swig_module_info *start,
swig_module_info *end,
const char *name) {
/* STEP 1: Search the name field using binary search */
swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
if (ret) {
return ret;
} else {
/* STEP 2: If the type hasn't been found, do a complete search
of the str field (the human readable name) */
swig_module_info *iter = start;
do {
size_t i = 0;
for (; i < iter->size; ++i) {
if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
return iter->types[i];
}
iter = iter->next;
} while (iter != end);
}
/* neither found a match */
return 0;
}
/*
Pack binary data into a string
*/
SWIGRUNTIME char *
SWIG_PackData(char *c, void *ptr, size_t sz) {
static const char hex[17] = "0123456789abcdef";
const unsigned char *u = (unsigned char *) ptr;
const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
unsigned char uu = *u;
*(c++) = hex[(uu & 0xf0) >> 4];
*(c++) = hex[uu & 0xf];
}
return c;
}
/*
Unpack binary data from a string
*/
SWIGRUNTIME const char *
SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
unsigned char *u = (unsigned char *) ptr;
const unsigned char *eu = u + sz;
for (; u != eu; ++u) {
char d = *(c++);
unsigned char uu;
if ((d >= '0') && (d <= '9'))
uu = ((d - '0') << 4);
else if ((d >= 'a') && (d <= 'f'))
uu = ((d - ('a'-10)) << 4);
else
return (char *) 0;
d = *(c++);
if ((d >= '0') && (d <= '9'))
uu |= (d - '0');
else if ((d >= 'a') && (d <= 'f'))
uu |= (d - ('a'-10));
else
return (char *) 0;
*u = uu;
}
return c;
}
/*
Pack 'void *' into a string buffer.
*/
SWIGRUNTIME char *
SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
char *r = buff;
if ((2*sizeof(void *) + 2) > bsz) return 0;
*(r++) = '_';
r = SWIG_PackData(r,&ptr,sizeof(void *));
if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
strcpy(r,name);
return buff;
}
SWIGRUNTIME const char *
SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
if (*c != '_') {
if (strcmp(c,"NULL") == 0) {
*ptr = (void *) 0;
return name;
} else {
return 0;
}
}
return SWIG_UnpackData(++c,ptr,sizeof(void *));
}
SWIGRUNTIME char *
SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
char *r = buff;
size_t lname = (name ? strlen(name) : 0);
if ((2*sz + 2 + lname) > bsz) return 0;
*(r++) = '_';
r = SWIG_PackData(r,ptr,sz);
if (lname) {
strncpy(r,name,lname+1);
} else {
*r = 0;
}
return buff;
}
SWIGRUNTIME const char *
SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
if (*c != '_') {
if (strcmp(c,"NULL") == 0) {
memset(ptr,0,sz);
return name;
} else {
return 0;
}
}
return SWIG_UnpackData(++c,ptr,sz);
}
#ifdef __cplusplus
}
#endif
/* Errors in SWIG */
#define SWIG_UnknownError -1
#define SWIG_IOError -2
#define SWIG_RuntimeError -3
#define SWIG_IndexError -4
#define SWIG_TypeError -5
#define SWIG_DivisionByZero -6
#define SWIG_OverflowError -7
#define SWIG_SyntaxError -8
#define SWIG_ValueError -9
#define SWIG_SystemError -10
#define SWIG_AttributeError -11
#define SWIG_MemoryError -12
#define SWIG_NullReferenceError -13
/* Compatibility macros for Python 3 */
#if PY_VERSION_HEX >= 0x03000000
#define PyClass_Check(obj) PyObject_IsInstance(obj, (PyObject *)&PyType_Type)
#define PyInt_Check(x) PyLong_Check(x)
#define PyInt_AsLong(x) PyLong_AsLong(x)
#define PyInt_FromLong(x) PyLong_FromLong(x)
#define PyInt_FromSize_t(x) PyLong_FromSize_t(x)
#define PyString_Check(name) PyBytes_Check(name)
#define PyString_FromString(x) PyUnicode_FromString(x)
#define PyString_Format(fmt, args) PyUnicode_Format(fmt, args)
#define PyString_AsString(str) PyBytes_AsString(str)
#define PyString_Size(str) PyBytes_Size(str)
#define PyString_InternFromString(key) PyUnicode_InternFromString(key)
#define Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_BASETYPE
#define PyString_AS_STRING(x) PyUnicode_AS_STRING(x)
#define _PyLong_FromSsize_t(x) PyLong_FromSsize_t(x)
#endif
#ifndef Py_TYPE
# define Py_TYPE(op) ((op)->ob_type)
#endif
/* SWIG APIs for compatibility of both Python 2 & 3 */
#if PY_VERSION_HEX >= 0x03000000
# define SWIG_Python_str_FromFormat PyUnicode_FromFormat
#else
# define SWIG_Python_str_FromFormat PyString_FromFormat
#endif
/* Warning: This function will allocate a new string in Python 3,
* so please call SWIG_Python_str_DelForPy3(x) to free the space.
*/
SWIGINTERN char*
SWIG_Python_str_AsChar(PyObject *str)
{
#if PY_VERSION_HEX >= 0x03000000
char *cstr;
char *newstr;
Py_ssize_t len;
str = PyUnicode_AsUTF8String(str);
PyBytes_AsStringAndSize(str, &cstr, &len);
newstr = (char *) malloc(len+1);
memcpy(newstr, cstr, len+1);
Py_XDECREF(str);
return newstr;
#else
return PyString_AsString(str);
#endif
}
#if PY_VERSION_HEX >= 0x03000000
# define SWIG_Python_str_DelForPy3(x) free( (void*) (x) )
#else
# define SWIG_Python_str_DelForPy3(x)
#endif
SWIGINTERN PyObject*
SWIG_Python_str_FromChar(const char *c)
{
#if PY_VERSION_HEX >= 0x03000000
return PyUnicode_FromString(c);
#else
return PyString_FromString(c);
#endif
}
/* Add PyOS_snprintf for old Pythons */
#if PY_VERSION_HEX < 0x02020000
# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
# define PyOS_snprintf _snprintf
# else
# define PyOS_snprintf snprintf
# endif
#endif
/* A crude PyString_FromFormat implementation for old Pythons */
#if PY_VERSION_HEX < 0x02020000
#ifndef SWIG_PYBUFFER_SIZE
# define SWIG_PYBUFFER_SIZE 1024
#endif
static PyObject *
PyString_FromFormat(const char *fmt, ...) {
va_list ap;
char buf[SWIG_PYBUFFER_SIZE * 2];
int res;
va_start(ap, fmt);
res = vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
}
#endif
/* Add PyObject_Del for old Pythons */
#if PY_VERSION_HEX < 0x01060000
# define PyObject_Del(op) PyMem_DEL((op))
#endif
#ifndef PyObject_DEL
# define PyObject_DEL PyObject_Del
#endif
/* A crude PyExc_StopIteration exception for old Pythons */
#if PY_VERSION_HEX < 0x02020000
# ifndef PyExc_StopIteration
# define PyExc_StopIteration PyExc_RuntimeError
# endif
# ifndef PyObject_GenericGetAttr
# define PyObject_GenericGetAttr 0
# endif
#endif
/* Py_NotImplemented is defined in 2.1 and up. */
#if PY_VERSION_HEX < 0x02010000
# ifndef Py_NotImplemented
# define Py_NotImplemented PyExc_RuntimeError
# endif
#endif
/* A crude PyString_AsStringAndSize implementation for old Pythons */
#if PY_VERSION_HEX < 0x02010000
# ifndef PyString_AsStringAndSize
# define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
# endif
#endif
/* PySequence_Size for old Pythons */
#if PY_VERSION_HEX < 0x02000000
# ifndef PySequence_Size
# define PySequence_Size PySequence_Length
# endif
#endif
/* PyBool_FromLong for old Pythons */
#if PY_VERSION_HEX < 0x02030000
static
PyObject *PyBool_FromLong(long ok)
{
PyObject *result = ok ? Py_True : Py_False;
Py_INCREF(result);
return result;
}
#endif
/* Py_ssize_t for old Pythons */
/* This code is as recommended by: */
/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
typedef int Py_ssize_t;
# define PY_SSIZE_T_MAX INT_MAX
# define PY_SSIZE_T_MIN INT_MIN
typedef inquiry lenfunc;
typedef intargfunc ssizeargfunc;
typedef intintargfunc ssizessizeargfunc;
typedef intobjargproc ssizeobjargproc;
typedef intintobjargproc ssizessizeobjargproc;
typedef getreadbufferproc readbufferproc;
typedef getwritebufferproc writebufferproc;
typedef getsegcountproc segcountproc;
typedef getcharbufferproc charbufferproc;
static long PyNumber_AsSsize_t (PyObject *x, void *SWIGUNUSEDPARM(exc))
{
long result = 0;
PyObject *i = PyNumber_Int(x);
if (i) {
result = PyInt_AsLong(i);
Py_DECREF(i);
}
return result;
}
#endif
#if PY_VERSION_HEX < 0x02050000
#define PyInt_FromSize_t(x) PyInt_FromLong((long)x)
#endif
#if PY_VERSION_HEX < 0x02040000
#define Py_VISIT(op) \
do { \
if (op) { \
int vret = visit((op), arg); \
if (vret) \
return vret; \
} \
} while (0)
#endif
#if PY_VERSION_HEX < 0x02030000
typedef struct {
PyTypeObject type;
PyNumberMethods as_number;
PyMappingMethods as_mapping;
PySequenceMethods as_sequence;
PyBufferProcs as_buffer;
PyObject *name, *slots;
} PyHeapTypeObject;
#endif
#if PY_VERSION_HEX < 0x02030000
typedef destructor freefunc;
#endif
#if ((PY_MAJOR_VERSION == 2 && PY_MINOR_VERSION > 6) || \
(PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION > 0) || \
(PY_MAJOR_VERSION > 3))
# define SWIGPY_USE_CAPSULE
# define SWIGPY_CAPSULE_NAME ((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION ".type_pointer_capsule" SWIG_TYPE_TABLE_NAME)
#endif
#if PY_VERSION_HEX < 0x03020000
#define PyDescr_TYPE(x) (((PyDescrObject *)(x))->d_type)
#define PyDescr_NAME(x) (((PyDescrObject *)(x))->d_name)
#endif
/* -----------------------------------------------------------------------------
* error manipulation
* ----------------------------------------------------------------------------- */
SWIGRUNTIME PyObject*
SWIG_Python_ErrorType(int code) {
PyObject* type = 0;
switch(code) {
case SWIG_MemoryError:
type = PyExc_MemoryError;
break;
case SWIG_IOError:
type = PyExc_IOError;
break;
case SWIG_RuntimeError:
type = PyExc_RuntimeError;
break;
case SWIG_IndexError:
type = PyExc_IndexError;
break;
case SWIG_TypeError:
type = PyExc_TypeError;
break;
case SWIG_DivisionByZero:
type = PyExc_ZeroDivisionError;
break;
case SWIG_OverflowError:
type = PyExc_OverflowError;
break;
case SWIG_SyntaxError:
type = PyExc_SyntaxError;
break;
case SWIG_ValueError:
type = PyExc_ValueError;
break;
case SWIG_SystemError:
type = PyExc_SystemError;
break;
case SWIG_AttributeError:
type = PyExc_AttributeError;
break;
default:
type = PyExc_RuntimeError;
}
return type;
}
SWIGRUNTIME void
SWIG_Python_AddErrorMsg(const char* mesg)
{
PyObject *type = 0;
PyObject *value = 0;
PyObject *traceback = 0;
if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
if (value) {
char *tmp;
PyObject *old_str = PyObject_Str(value);
PyErr_Clear();
Py_XINCREF(type);
PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
SWIG_Python_str_DelForPy3(tmp);
Py_DECREF(old_str);
Py_DECREF(value);
} else {
PyErr_SetString(PyExc_RuntimeError, mesg);
}
}
#if defined(SWIG_PYTHON_NO_THREADS)
# if defined(SWIG_PYTHON_THREADS)
# undef SWIG_PYTHON_THREADS
# endif
#endif
#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
# if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
# if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
# define SWIG_PYTHON_USE_GIL
# endif
# endif
# if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
# ifndef SWIG_PYTHON_INITIALIZE_THREADS
# define SWIG_PYTHON_INITIALIZE_THREADS PyEval_InitThreads()
# endif
# ifdef __cplusplus /* C++ code */
class SWIG_Python_Thread_Block {
bool status;
PyGILState_STATE state;
public:
void end() { if (status) { PyGILState_Release(state); status = false;} }
SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
~SWIG_Python_Thread_Block() { end(); }
};
class SWIG_Python_Thread_Allow {
bool status;
PyThreadState *save;
public:
void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
~SWIG_Python_Thread_Allow() { end(); }
};
# define SWIG_PYTHON_THREAD_BEGIN_BLOCK SWIG_Python_Thread_Block _swig_thread_block
# define SWIG_PYTHON_THREAD_END_BLOCK _swig_thread_block.end()
# define SWIG_PYTHON_THREAD_BEGIN_ALLOW SWIG_Python_Thread_Allow _swig_thread_allow
# define SWIG_PYTHON_THREAD_END_ALLOW _swig_thread_allow.end()
# else /* C code */
# define SWIG_PYTHON_THREAD_BEGIN_BLOCK PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
# define SWIG_PYTHON_THREAD_END_BLOCK PyGILState_Release(_swig_thread_block)
# define SWIG_PYTHON_THREAD_BEGIN_ALLOW PyThreadState *_swig_thread_allow = PyEval_SaveThread()
# define SWIG_PYTHON_THREAD_END_ALLOW PyEval_RestoreThread(_swig_thread_allow)
# endif
# else /* Old thread way, not implemented, user must provide it */
# if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
# define SWIG_PYTHON_INITIALIZE_THREADS
# endif
# if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
# define SWIG_PYTHON_THREAD_BEGIN_BLOCK
# endif
# if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
# define SWIG_PYTHON_THREAD_END_BLOCK
# endif
# if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
# define SWIG_PYTHON_THREAD_BEGIN_ALLOW
# endif
# if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
# define SWIG_PYTHON_THREAD_END_ALLOW
# endif
# endif
#else /* No thread support */
# define SWIG_PYTHON_INITIALIZE_THREADS
# define SWIG_PYTHON_THREAD_BEGIN_BLOCK
# define SWIG_PYTHON_THREAD_END_BLOCK
# define SWIG_PYTHON_THREAD_BEGIN_ALLOW
# define SWIG_PYTHON_THREAD_END_ALLOW
#endif
/* -----------------------------------------------------------------------------
* Python API portion that goes into the runtime
* ----------------------------------------------------------------------------- */
#ifdef __cplusplus
extern "C" {
#endif
/* -----------------------------------------------------------------------------
* Constant declarations
* ----------------------------------------------------------------------------- */
/* Constant Types */
#define SWIG_PY_POINTER 4
#define SWIG_PY_BINARY 5
/* Constant information structure */
typedef struct swig_const_info {
int type;
char *name;
long lvalue;
double dvalue;
void *pvalue;
swig_type_info **ptype;
} swig_const_info;
/* -----------------------------------------------------------------------------
* Wrapper of PyInstanceMethod_New() used in Python 3
* It is exported to the generated module, used for -fastproxy
* ----------------------------------------------------------------------------- */
#if PY_VERSION_HEX >= 0x03000000
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *func)
{
return PyInstanceMethod_New(func);
}
#else
SWIGRUNTIME PyObject* SWIG_PyInstanceMethod_New(PyObject *SWIGUNUSEDPARM(self), PyObject *SWIGUNUSEDPARM(func))
{
return NULL;
}
#endif
#ifdef __cplusplus
}
#endif
/* -----------------------------------------------------------------------------
* pyrun.swg
*
* This file contains the runtime support for Python modules
* and includes code for managing global variables and pointer
* type checking.
*
* ----------------------------------------------------------------------------- */
/* Common SWIG API */
/* for raw pointers */
#define SWIG_Python_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
#define SWIG_ConvertPtr(obj, pptr, type, flags) SWIG_Python_ConvertPtr(obj, pptr, type, flags)
#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own) SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
#ifdef SWIGPYTHON_BUILTIN
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(self, ptr, type, flags)
#else
#define SWIG_NewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
#endif
#define SWIG_InternalNewPointerObj(ptr, type, flags) SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
#define SWIG_CheckImplicit(ty) SWIG_Python_CheckImplicit(ty)
#define SWIG_AcquirePtr(ptr, src) SWIG_Python_AcquirePtr(ptr, src)
#define swig_owntype int
/* for raw packed data */
#define SWIG_ConvertPacked(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewPackedObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
/* for class or struct pointers */
#define SWIG_ConvertInstance(obj, pptr, type, flags) SWIG_ConvertPtr(obj, pptr, type, flags)
#define SWIG_NewInstanceObj(ptr, type, flags) SWIG_NewPointerObj(ptr, type, flags)
/* for C or C++ function pointers */
#define SWIG_ConvertFunctionPtr(obj, pptr, type) SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
#define SWIG_NewFunctionPtrObj(ptr, type) SWIG_Python_NewPointerObj(NULL, ptr, type, 0)
/* for C++ member pointers, ie, member methods */
#define SWIG_ConvertMember(obj, ptr, sz, ty) SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
#define SWIG_NewMemberObj(ptr, sz, type) SWIG_Python_NewPackedObj(ptr, sz, type)
/* Runtime API */
#define SWIG_GetModule(clientdata) SWIG_Python_GetModule(clientdata)
#define SWIG_SetModule(clientdata, pointer) SWIG_Python_SetModule(pointer)
#define SWIG_NewClientData(obj) SwigPyClientData_New(obj)
#define SWIG_SetErrorObj SWIG_Python_SetErrorObj
#define SWIG_SetErrorMsg SWIG_Python_SetErrorMsg
#define SWIG_ErrorType(code) SWIG_Python_ErrorType(code)
#define SWIG_Error(code, msg) SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg)
#define SWIG_fail goto fail
/* Runtime API implementation */
/* Error manipulation */
SWIGINTERN void
SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
PyErr_SetObject(errtype, obj);
Py_DECREF(obj);
SWIG_PYTHON_THREAD_END_BLOCK;
}
SWIGINTERN void
SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
PyErr_SetString(errtype, msg);
SWIG_PYTHON_THREAD_END_BLOCK;
}
#define SWIG_Python_Raise(obj, type, desc) SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
/* Set a constant value */
#if defined(SWIGPYTHON_BUILTIN)
SWIGINTERN void
SwigPyBuiltin_AddPublicSymbol(PyObject *seq, const char *key) {
PyObject *s = PyString_InternFromString(key);
PyList_Append(seq, s);
Py_DECREF(s);
}
SWIGINTERN void
SWIG_Python_SetConstant(PyObject *d, PyObject *public_interface, const char *name, PyObject *obj) {
#if PY_VERSION_HEX < 0x02030000
PyDict_SetItemString(d, (char *)name, obj);
#else
PyDict_SetItemString(d, name, obj);
#endif
Py_DECREF(obj);
if (public_interface)
SwigPyBuiltin_AddPublicSymbol(public_interface, name);
}
#else
SWIGINTERN void
SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {
#if PY_VERSION_HEX < 0x02030000
PyDict_SetItemString(d, (char *)name, obj);
#else
PyDict_SetItemString(d, name, obj);
#endif
Py_DECREF(obj);
}
#endif
/* Append a value to the result obj */
SWIGINTERN PyObject*
SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
if (!result) {
result = obj;
} else if (result == Py_None) {
Py_DECREF(result);
result = obj;
} else {
if (!PyList_Check(result)) {
PyObject *o2 = result;
result = PyList_New(1);
PyList_SetItem(result, 0, o2);
}
PyList_Append(result,obj);
Py_DECREF(obj);
}
return result;
#else
PyObject* o2;
PyObject* o3;
if (!result) {
result = obj;
} else if (result == Py_None) {
Py_DECREF(result);
result = obj;
} else {
if (!PyTuple_Check(result)) {
o2 = result;
result = PyTuple_New(1);
PyTuple_SET_ITEM(result, 0, o2);
}
o3 = PyTuple_New(1);
PyTuple_SET_ITEM(o3, 0, obj);
o2 = result;
result = PySequence_Concat(o2, o3);
Py_DECREF(o2);
Py_DECREF(o3);
}
return result;
#endif
}
/* Unpack the argument tuple */
SWIGINTERN Py_ssize_t
SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
{
if (!args) {
if (!min && !max) {
return 1;
} else {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none",
name, (min == max ? "" : "at least "), (int)min);
return 0;
}
}
if (!PyTuple_Check(args)) {
if (min <= 1 && max >= 1) {
Py_ssize_t i;
objs[0] = args;
for (i = 1; i < max; ++i) {
objs[i] = 0;
}
return 2;
}
PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
return 0;
} else {
Py_ssize_t l = PyTuple_GET_SIZE(args);
if (l < min) {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
name, (min == max ? "" : "at least "), (int)min, (int)l);
return 0;
} else if (l > max) {
PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d",
name, (min == max ? "" : "at most "), (int)max, (int)l);
return 0;
} else {
Py_ssize_t i;
for (i = 0; i < l; ++i) {
objs[i] = PyTuple_GET_ITEM(args, i);
}
for (; l < max; ++l) {
objs[l] = 0;
}
return i + 1;
}
}
}
/* A functor is a function object with one single object argument */
#if PY_VERSION_HEX >= 0x02020000
#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunctionObjArgs(functor, obj, NULL);
#else
#define SWIG_Python_CallFunctor(functor, obj) PyObject_CallFunction(functor, "O", obj);
#endif
/*
Helper for static pointer initialization for both C and C++ code, for example
static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
*/
#ifdef __cplusplus
#define SWIG_STATIC_POINTER(var) var
#else
#define SWIG_STATIC_POINTER(var) var = 0; if (!var) var
#endif
/* -----------------------------------------------------------------------------
* Pointer declarations
* ----------------------------------------------------------------------------- */
/* Flags for new pointer objects */
#define SWIG_POINTER_NOSHADOW (SWIG_POINTER_OWN << 1)
#define SWIG_POINTER_NEW (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
#define SWIG_POINTER_IMPLICIT_CONV (SWIG_POINTER_DISOWN << 1)
#define SWIG_BUILTIN_TP_INIT (SWIG_POINTER_OWN << 2)
#define SWIG_BUILTIN_INIT (SWIG_BUILTIN_TP_INIT | SWIG_POINTER_OWN)
#ifdef __cplusplus
extern "C" {
#endif
/* How to access Py_None */
#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
# ifndef SWIG_PYTHON_NO_BUILD_NONE
# ifndef SWIG_PYTHON_BUILD_NONE
# define SWIG_PYTHON_BUILD_NONE
# endif
# endif
#endif
#ifdef SWIG_PYTHON_BUILD_NONE
# ifdef Py_None
# undef Py_None
# define Py_None SWIG_Py_None()
# endif
SWIGRUNTIMEINLINE PyObject *
_SWIG_Py_None(void)
{
PyObject *none = Py_BuildValue((char*)"");
Py_DECREF(none);
return none;
}
SWIGRUNTIME PyObject *
SWIG_Py_None(void)
{
static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
return none;
}
#endif
/* The python void return value */
SWIGRUNTIMEINLINE PyObject *
SWIG_Py_Void(void)
{
PyObject *none = Py_None;
Py_INCREF(none);
return none;
}
/* SwigPyClientData */
typedef struct {
PyObject *klass;
PyObject *newraw;
PyObject *newargs;
PyObject *destroy;
int delargs;
int implicitconv;
PyTypeObject *pytype;
} SwigPyClientData;
SWIGRUNTIMEINLINE int
SWIG_Python_CheckImplicit(swig_type_info *ty)
{
SwigPyClientData *data = (SwigPyClientData *)ty->clientdata;
return data ? data->implicitconv : 0;
}
SWIGRUNTIMEINLINE PyObject *
SWIG_Python_ExceptionType(swig_type_info *desc) {
SwigPyClientData *data = desc ? (SwigPyClientData *) desc->clientdata : 0;
PyObject *klass = data ? data->klass : 0;
return (klass ? klass : PyExc_RuntimeError);
}
SWIGRUNTIME SwigPyClientData *
SwigPyClientData_New(PyObject* obj)
{
if (!obj) {
return 0;
} else {
SwigPyClientData *data = (SwigPyClientData *)malloc(sizeof(SwigPyClientData));
/* the klass element */
data->klass = obj;
Py_INCREF(data->klass);
/* the newraw method and newargs arguments used to create a new raw instance */
if (PyClass_Check(obj)) {
data->newraw = 0;
data->newargs = obj;
Py_INCREF(obj);
} else {
#if (PY_VERSION_HEX < 0x02020000)
data->newraw = 0;
#else
data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
#endif
if (data->newraw) {
Py_INCREF(data->newraw);
data->newargs = PyTuple_New(1);
PyTuple_SetItem(data->newargs, 0, obj);
} else {
data->newargs = obj;
}
Py_INCREF(data->newargs);
}
/* the destroy method, aka as the C++ delete method */
data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
if (PyErr_Occurred()) {
PyErr_Clear();
data->destroy = 0;
}
if (data->destroy) {
int flags;
Py_INCREF(data->destroy);
flags = PyCFunction_GET_FLAGS(data->destroy);
#ifdef METH_O
data->delargs = !(flags & (METH_O));
#else
data->delargs = 0;
#endif
} else {
data->delargs = 0;
}
data->implicitconv = 0;
data->pytype = 0;
return data;
}
}
SWIGRUNTIME void
SwigPyClientData_Del(SwigPyClientData *data) {
Py_XDECREF(data->newraw);
Py_XDECREF(data->newargs);
Py_XDECREF(data->destroy);
}
/* =============== SwigPyObject =====================*/
typedef struct {
PyObject_HEAD
void *ptr;
swig_type_info *ty;
int own;
PyObject *next;
#ifdef SWIGPYTHON_BUILTIN
PyObject *dict;
#endif
} SwigPyObject;
#ifdef SWIGPYTHON_BUILTIN
SWIGRUNTIME PyObject *
SwigPyObject_get___dict__(PyObject *v, PyObject *SWIGUNUSEDPARM(args))
{
SwigPyObject *sobj = (SwigPyObject *)v;
if (!sobj->dict)
sobj->dict = PyDict_New();
Py_INCREF(sobj->dict);
return sobj->dict;
}
#endif
SWIGRUNTIME PyObject *
SwigPyObject_long(SwigPyObject *v)
{
return PyLong_FromVoidPtr(v->ptr);
}
SWIGRUNTIME PyObject *
SwigPyObject_format(const char* fmt, SwigPyObject *v)
{
PyObject *res = NULL;
PyObject *args = PyTuple_New(1);
if (args) {
if (PyTuple_SetItem(args, 0, SwigPyObject_long(v)) == 0) {
PyObject *ofmt = SWIG_Python_str_FromChar(fmt);
if (ofmt) {
#if PY_VERSION_HEX >= 0x03000000
res = PyUnicode_Format(ofmt,args);
#else
res = PyString_Format(ofmt,args);
#endif
Py_DECREF(ofmt);
}
Py_DECREF(args);
}
}
return res;
}
SWIGRUNTIME PyObject *
SwigPyObject_oct(SwigPyObject *v)
{
return SwigPyObject_format("%o",v);
}
SWIGRUNTIME PyObject *
SwigPyObject_hex(SwigPyObject *v)
{
return SwigPyObject_format("%x",v);
}
SWIGRUNTIME PyObject *
#ifdef METH_NOARGS
SwigPyObject_repr(SwigPyObject *v)
#else
SwigPyObject_repr(SwigPyObject *v, PyObject *args)
#endif
{
const char *name = SWIG_TypePrettyName(v->ty);
PyObject *repr = SWIG_Python_str_FromFormat("", (name ? name : "unknown"), (void *)v);
if (v->next) {
# ifdef METH_NOARGS
PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next);
# else
PyObject *nrep = SwigPyObject_repr((SwigPyObject *)v->next, args);
# endif
# if PY_VERSION_HEX >= 0x03000000
PyObject *joined = PyUnicode_Concat(repr, nrep);
Py_DecRef(repr);
Py_DecRef(nrep);
repr = joined;
# else
PyString_ConcatAndDel(&repr,nrep);
# endif
}
return repr;
}
SWIGRUNTIME int
SwigPyObject_compare(SwigPyObject *v, SwigPyObject *w)
{
void *i = v->ptr;
void *j = w->ptr;
return (i < j) ? -1 : ((i > j) ? 1 : 0);
}
/* Added for Python 3.x, would it also be useful for Python 2.x? */
SWIGRUNTIME PyObject*
SwigPyObject_richcompare(SwigPyObject *v, SwigPyObject *w, int op)
{
PyObject* res;
if( op != Py_EQ && op != Py_NE ) {
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
res = PyBool_FromLong( (SwigPyObject_compare(v, w)==0) == (op == Py_EQ) ? 1 : 0);
return res;
}
SWIGRUNTIME PyTypeObject* SwigPyObject_TypeOnce(void);
#ifdef SWIGPYTHON_BUILTIN
static swig_type_info *SwigPyObject_stype = 0;
SWIGRUNTIME PyTypeObject*
SwigPyObject_type(void) {
SwigPyClientData *cd;
assert(SwigPyObject_stype);
cd = (SwigPyClientData*) SwigPyObject_stype->clientdata;
assert(cd);
assert(cd->pytype);
return cd->pytype;
}
#else
SWIGRUNTIME PyTypeObject*
SwigPyObject_type(void) {
static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyObject_TypeOnce();
return type;
}
#endif
SWIGRUNTIMEINLINE int
SwigPyObject_Check(PyObject *op) {
#ifdef SWIGPYTHON_BUILTIN
PyTypeObject *target_tp = SwigPyObject_type();
if (PyType_IsSubtype(op->ob_type, target_tp))
return 1;
return (strcmp(op->ob_type->tp_name, "SwigPyObject") == 0);
#else
return (Py_TYPE(op) == SwigPyObject_type())
|| (strcmp(Py_TYPE(op)->tp_name,"SwigPyObject") == 0);
#endif
}
SWIGRUNTIME PyObject *
SwigPyObject_New(void *ptr, swig_type_info *ty, int own);
SWIGRUNTIME void
SwigPyObject_dealloc(PyObject *v)
{
SwigPyObject *sobj = (SwigPyObject *) v;
PyObject *next = sobj->next;
if (sobj->own == SWIG_POINTER_OWN) {
swig_type_info *ty = sobj->ty;
SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
PyObject *destroy = data ? data->destroy : 0;
if (destroy) {
/* destroy is always a VARARGS method */
PyObject *res;
/* PyObject_CallFunction() has the potential to silently drop
the active active exception. In cases of unnamed temporary
variable or where we just finished iterating over a generator
StopIteration will be active right now, and this needs to
remain true upon return from SwigPyObject_dealloc. So save
and restore. */
PyObject *val = NULL, *type = NULL, *tb = NULL;
PyErr_Fetch(&val, &type, &tb);
if (data->delargs) {
/* we need to create a temporary object to carry the destroy operation */
PyObject *tmp = SwigPyObject_New(sobj->ptr, ty, 0);
res = SWIG_Python_CallFunctor(destroy, tmp);
Py_DECREF(tmp);
} else {
PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
PyObject *mself = PyCFunction_GET_SELF(destroy);
res = ((*meth)(mself, v));
}
if (!res)
PyErr_WriteUnraisable(destroy);
PyErr_Restore(val, type, tb);
Py_XDECREF(res);
}
#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
else {
const char *name = SWIG_TypePrettyName(ty);
printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
}
#endif
}
Py_XDECREF(next);
PyObject_DEL(v);
}
SWIGRUNTIME PyObject*
SwigPyObject_append(PyObject* v, PyObject* next)
{
SwigPyObject *sobj = (SwigPyObject *) v;
#ifndef METH_O
PyObject *tmp = 0;
if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
next = tmp;
#endif
if (!SwigPyObject_Check(next)) {
PyErr_SetString(PyExc_TypeError, "Attempt to append a non SwigPyObject");
return NULL;
}
sobj->next = next;
Py_INCREF(next);
return SWIG_Py_Void();
}
SWIGRUNTIME PyObject*
#ifdef METH_NOARGS
SwigPyObject_next(PyObject* v)
#else
SwigPyObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
#endif
{
SwigPyObject *sobj = (SwigPyObject *) v;
if (sobj->next) {
Py_INCREF(sobj->next);
return sobj->next;
} else {
return SWIG_Py_Void();
}
}
SWIGINTERN PyObject*
#ifdef METH_NOARGS
SwigPyObject_disown(PyObject *v)
#else
SwigPyObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
#endif
{
SwigPyObject *sobj = (SwigPyObject *)v;
sobj->own = 0;
return SWIG_Py_Void();
}
SWIGINTERN PyObject*
#ifdef METH_NOARGS
SwigPyObject_acquire(PyObject *v)
#else
SwigPyObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
#endif
{
SwigPyObject *sobj = (SwigPyObject *)v;
sobj->own = SWIG_POINTER_OWN;
return SWIG_Py_Void();
}
SWIGINTERN PyObject*
SwigPyObject_own(PyObject *v, PyObject *args)
{
PyObject *val = 0;
#if (PY_VERSION_HEX < 0x02020000)
if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
#elif (PY_VERSION_HEX < 0x02050000)
if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val))
#else
if (!PyArg_UnpackTuple(args, "own", 0, 1, &val))
#endif
{
return NULL;
}
else
{
SwigPyObject *sobj = (SwigPyObject *)v;
PyObject *obj = PyBool_FromLong(sobj->own);
if (val) {
#ifdef METH_NOARGS
if (PyObject_IsTrue(val)) {
SwigPyObject_acquire(v);
} else {
SwigPyObject_disown(v);
}
#else
if (PyObject_IsTrue(val)) {
SwigPyObject_acquire(v,args);
} else {
SwigPyObject_disown(v,args);
}
#endif
}
return obj;
}
}
#ifdef METH_O
static PyMethodDef
swigobject_methods[] = {
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_NOARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_NOARGS, (char *)"acquires ownership of the pointer"},
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_O, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_NOARGS, (char *)"returns the next 'this' object"},
{(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_NOARGS, (char *)"returns object representation"},
{0, 0, 0, 0}
};
#else
static PyMethodDef
swigobject_methods[] = {
{(char *)"disown", (PyCFunction)SwigPyObject_disown, METH_VARARGS, (char *)"releases ownership of the pointer"},
{(char *)"acquire", (PyCFunction)SwigPyObject_acquire, METH_VARARGS, (char *)"acquires ownership of the pointer"},
{(char *)"own", (PyCFunction)SwigPyObject_own, METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
{(char *)"append", (PyCFunction)SwigPyObject_append, METH_VARARGS, (char *)"appends another 'this' object"},
{(char *)"next", (PyCFunction)SwigPyObject_next, METH_VARARGS, (char *)"returns the next 'this' object"},
{(char *)"__repr__",(PyCFunction)SwigPyObject_repr, METH_VARARGS, (char *)"returns object representation"},
{0, 0, 0, 0}
};
#endif
#if PY_VERSION_HEX < 0x02020000
SWIGINTERN PyObject *
SwigPyObject_getattr(SwigPyObject *sobj,char *name)
{
return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
}
#endif
SWIGRUNTIME PyTypeObject*
SwigPyObject_TypeOnce(void) {
static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
static PyNumberMethods SwigPyObject_as_number = {
(binaryfunc)0, /*nb_add*/
(binaryfunc)0, /*nb_subtract*/
(binaryfunc)0, /*nb_multiply*/
/* nb_divide removed in Python 3 */
#if PY_VERSION_HEX < 0x03000000
(binaryfunc)0, /*nb_divide*/
#endif
(binaryfunc)0, /*nb_remainder*/
(binaryfunc)0, /*nb_divmod*/
(ternaryfunc)0,/*nb_power*/
(unaryfunc)0, /*nb_negative*/
(unaryfunc)0, /*nb_positive*/
(unaryfunc)0, /*nb_absolute*/
(inquiry)0, /*nb_nonzero*/
0, /*nb_invert*/
0, /*nb_lshift*/
0, /*nb_rshift*/
0, /*nb_and*/
0, /*nb_xor*/
0, /*nb_or*/
#if PY_VERSION_HEX < 0x03000000
0, /*nb_coerce*/
#endif
(unaryfunc)SwigPyObject_long, /*nb_int*/
#if PY_VERSION_HEX < 0x03000000
(unaryfunc)SwigPyObject_long, /*nb_long*/
#else
0, /*nb_reserved*/
#endif
(unaryfunc)0, /*nb_float*/
#if PY_VERSION_HEX < 0x03000000
(unaryfunc)SwigPyObject_oct, /*nb_oct*/
(unaryfunc)SwigPyObject_hex, /*nb_hex*/
#endif
#if PY_VERSION_HEX >= 0x03050000 /* 3.5 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_matrix_multiply */
#elif PY_VERSION_HEX >= 0x03000000 /* 3.0 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index, nb_inplace_divide removed */
#elif PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
#endif
};
static PyTypeObject swigpyobject_type;
static int type_init = 0;
if (!type_init) {
const PyTypeObject tmp = {
/* PyObject header changed in Python 3 */
#if PY_VERSION_HEX >= 0x03000000
PyVarObject_HEAD_INIT(NULL, 0)
#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
#endif
(char *)"SwigPyObject", /* tp_name */
sizeof(SwigPyObject), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)SwigPyObject_dealloc, /* tp_dealloc */
0, /* tp_print */
#if PY_VERSION_HEX < 0x02020000
(getattrfunc)SwigPyObject_getattr, /* tp_getattr */
#else
(getattrfunc)0, /* tp_getattr */
#endif
(setattrfunc)0, /* tp_setattr */
#if PY_VERSION_HEX >= 0x03000000
0, /* tp_reserved in 3.0.1, tp_compare in 3.0.0 but not used */
#else
(cmpfunc)SwigPyObject_compare, /* tp_compare */
#endif
(reprfunc)SwigPyObject_repr, /* tp_repr */
&SwigPyObject_as_number, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
(hashfunc)0, /* tp_hash */
(ternaryfunc)0, /* tp_call */
0, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
swigobject_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
(richcmpfunc)SwigPyObject_richcompare,/* tp_richcompare */
0, /* tp_weaklistoffset */
#if PY_VERSION_HEX >= 0x02020000
0, /* tp_iter */
0, /* tp_iternext */
swigobject_methods, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
0, /* tp_free */
0, /* tp_is_gc */
0, /* tp_bases */
0, /* tp_mro */
0, /* tp_cache */
0, /* tp_subclasses */
0, /* tp_weaklist */
#endif
#if PY_VERSION_HEX >= 0x02030000
0, /* tp_del */
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /* tp_version_tag */
#endif
#if PY_VERSION_HEX >= 0x03040000
0, /* tp_finalize */
#endif
#ifdef COUNT_ALLOCS
0, /* tp_allocs */
0, /* tp_frees */
0, /* tp_maxalloc */
#if PY_VERSION_HEX >= 0x02050000
0, /* tp_prev */
#endif
0 /* tp_next */
#endif
};
swigpyobject_type = tmp;
type_init = 1;
#if PY_VERSION_HEX < 0x02020000
swigpyobject_type.ob_type = &PyType_Type;
#else
if (PyType_Ready(&swigpyobject_type) < 0)
return NULL;
#endif
}
return &swigpyobject_type;
}
SWIGRUNTIME PyObject *
SwigPyObject_New(void *ptr, swig_type_info *ty, int own)
{
SwigPyObject *sobj = PyObject_NEW(SwigPyObject, SwigPyObject_type());
if (sobj) {
sobj->ptr = ptr;
sobj->ty = ty;
sobj->own = own;
sobj->next = 0;
}
return (PyObject *)sobj;
}
/* -----------------------------------------------------------------------------
* Implements a simple Swig Packed type, and use it instead of string
* ----------------------------------------------------------------------------- */
typedef struct {
PyObject_HEAD
void *pack;
swig_type_info *ty;
size_t size;
} SwigPyPacked;
SWIGRUNTIME int
SwigPyPacked_print(SwigPyPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
{
char result[SWIG_BUFFER_SIZE];
fputs("pack, v->size, 0, sizeof(result))) {
fputs("at ", fp);
fputs(result, fp);
}
fputs(v->ty->name,fp);
fputs(">", fp);
return 0;
}
SWIGRUNTIME PyObject *
SwigPyPacked_repr(SwigPyPacked *v)
{
char result[SWIG_BUFFER_SIZE];
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
return SWIG_Python_str_FromFormat("", result, v->ty->name);
} else {
return SWIG_Python_str_FromFormat("", v->ty->name);
}
}
SWIGRUNTIME PyObject *
SwigPyPacked_str(SwigPyPacked *v)
{
char result[SWIG_BUFFER_SIZE];
if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
return SWIG_Python_str_FromFormat("%s%s", result, v->ty->name);
} else {
return SWIG_Python_str_FromChar(v->ty->name);
}
}
SWIGRUNTIME int
SwigPyPacked_compare(SwigPyPacked *v, SwigPyPacked *w)
{
size_t i = v->size;
size_t j = w->size;
int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
}
SWIGRUNTIME PyTypeObject* SwigPyPacked_TypeOnce(void);
SWIGRUNTIME PyTypeObject*
SwigPyPacked_type(void) {
static PyTypeObject *SWIG_STATIC_POINTER(type) = SwigPyPacked_TypeOnce();
return type;
}
SWIGRUNTIMEINLINE int
SwigPyPacked_Check(PyObject *op) {
return ((op)->ob_type == SwigPyPacked_TypeOnce())
|| (strcmp((op)->ob_type->tp_name,"SwigPyPacked") == 0);
}
SWIGRUNTIME void
SwigPyPacked_dealloc(PyObject *v)
{
if (SwigPyPacked_Check(v)) {
SwigPyPacked *sobj = (SwigPyPacked *) v;
free(sobj->pack);
}
PyObject_DEL(v);
}
SWIGRUNTIME PyTypeObject*
SwigPyPacked_TypeOnce(void) {
static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
static PyTypeObject swigpypacked_type;
static int type_init = 0;
if (!type_init) {
const PyTypeObject tmp = {
/* PyObject header changed in Python 3 */
#if PY_VERSION_HEX>=0x03000000
PyVarObject_HEAD_INIT(NULL, 0)
#else
PyObject_HEAD_INIT(NULL)
0, /* ob_size */
#endif
(char *)"SwigPyPacked", /* tp_name */
sizeof(SwigPyPacked), /* tp_basicsize */
0, /* tp_itemsize */
(destructor)SwigPyPacked_dealloc, /* tp_dealloc */
(printfunc)SwigPyPacked_print, /* tp_print */
(getattrfunc)0, /* tp_getattr */
(setattrfunc)0, /* tp_setattr */
#if PY_VERSION_HEX>=0x03000000
0, /* tp_reserved in 3.0.1 */
#else
(cmpfunc)SwigPyPacked_compare, /* tp_compare */
#endif
(reprfunc)SwigPyPacked_repr, /* tp_repr */
0, /* tp_as_number */
0, /* tp_as_sequence */
0, /* tp_as_mapping */
(hashfunc)0, /* tp_hash */
(ternaryfunc)0, /* tp_call */
(reprfunc)SwigPyPacked_str, /* tp_str */
PyObject_GenericGetAttr, /* tp_getattro */
0, /* tp_setattro */
0, /* tp_as_buffer */
Py_TPFLAGS_DEFAULT, /* tp_flags */
swigpacked_doc, /* tp_doc */
0, /* tp_traverse */
0, /* tp_clear */
0, /* tp_richcompare */
0, /* tp_weaklistoffset */
#if PY_VERSION_HEX >= 0x02020000
0, /* tp_iter */
0, /* tp_iternext */
0, /* tp_methods */
0, /* tp_members */
0, /* tp_getset */
0, /* tp_base */
0, /* tp_dict */
0, /* tp_descr_get */
0, /* tp_descr_set */
0, /* tp_dictoffset */
0, /* tp_init */
0, /* tp_alloc */
0, /* tp_new */
0, /* tp_free */
0, /* tp_is_gc */
0, /* tp_bases */
0, /* tp_mro */
0, /* tp_cache */
0, /* tp_subclasses */
0, /* tp_weaklist */
#endif
#if PY_VERSION_HEX >= 0x02030000
0, /* tp_del */
#endif
#if PY_VERSION_HEX >= 0x02060000
0, /* tp_version_tag */
#endif
#if PY_VERSION_HEX >= 0x03040000
0, /* tp_finalize */
#endif
#ifdef COUNT_ALLOCS
0, /* tp_allocs */
0, /* tp_frees */
0, /* tp_maxalloc */
#if PY_VERSION_HEX >= 0x02050000
0, /* tp_prev */
#endif
0 /* tp_next */
#endif
};
swigpypacked_type = tmp;
type_init = 1;
#if PY_VERSION_HEX < 0x02020000
swigpypacked_type.ob_type = &PyType_Type;
#else
if (PyType_Ready(&swigpypacked_type) < 0)
return NULL;
#endif
}
return &swigpypacked_type;
}
SWIGRUNTIME PyObject *
SwigPyPacked_New(void *ptr, size_t size, swig_type_info *ty)
{
SwigPyPacked *sobj = PyObject_NEW(SwigPyPacked, SwigPyPacked_type());
if (sobj) {
void *pack = malloc(size);
if (pack) {
memcpy(pack, ptr, size);
sobj->pack = pack;
sobj->ty = ty;
sobj->size = size;
} else {
PyObject_DEL((PyObject *) sobj);
sobj = 0;
}
}
return (PyObject *) sobj;
}
SWIGRUNTIME swig_type_info *
SwigPyPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
{
if (SwigPyPacked_Check(obj)) {
SwigPyPacked *sobj = (SwigPyPacked *)obj;
if (sobj->size != size) return 0;
memcpy(ptr, sobj->pack, size);
return sobj->ty;
} else {
return 0;
}
}
/* -----------------------------------------------------------------------------
* pointers/data manipulation
* ----------------------------------------------------------------------------- */
SWIGRUNTIMEINLINE PyObject *
_SWIG_This(void)
{
return SWIG_Python_str_FromChar("this");
}
static PyObject *swig_this = NULL;
SWIGRUNTIME PyObject *
SWIG_This(void)
{
if (swig_this == NULL)
swig_this = _SWIG_This();
return swig_this;
}
/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
/* TODO: I don't know how to implement the fast getset in Python 3 right now */
#if PY_VERSION_HEX>=0x03000000
#define SWIG_PYTHON_SLOW_GETSET_THIS
#endif
SWIGRUNTIME SwigPyObject *
SWIG_Python_GetSwigThis(PyObject *pyobj)
{
PyObject *obj;
if (SwigPyObject_Check(pyobj))
return (SwigPyObject *) pyobj;
#ifdef SWIGPYTHON_BUILTIN
(void)obj;
# ifdef PyWeakref_CheckProxy
if (PyWeakref_CheckProxy(pyobj)) {
pyobj = PyWeakref_GET_OBJECT(pyobj);
if (pyobj && SwigPyObject_Check(pyobj))
return (SwigPyObject*) pyobj;
}
# endif
return NULL;
#else
obj = 0;
#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
if (PyInstance_Check(pyobj)) {
obj = _PyInstance_Lookup(pyobj, SWIG_This());
} else {
PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
if (dictptr != NULL) {
PyObject *dict = *dictptr;
obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
} else {
#ifdef PyWeakref_CheckProxy
if (PyWeakref_CheckProxy(pyobj)) {
PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
}
#endif
obj = PyObject_GetAttr(pyobj,SWIG_This());
if (obj) {
Py_DECREF(obj);
} else {
if (PyErr_Occurred()) PyErr_Clear();
return 0;
}
}
}
#else
obj = PyObject_GetAttr(pyobj,SWIG_This());
if (obj) {
Py_DECREF(obj);
} else {
if (PyErr_Occurred()) PyErr_Clear();
return 0;
}
#endif
if (obj && !SwigPyObject_Check(obj)) {
/* a PyObject is called 'this', try to get the 'real this'
SwigPyObject from it */
return SWIG_Python_GetSwigThis(obj);
}
return (SwigPyObject *)obj;
#endif
}
/* Acquire a pointer value */
SWIGRUNTIME int
SWIG_Python_AcquirePtr(PyObject *obj, int own) {
if (own == SWIG_POINTER_OWN) {
SwigPyObject *sobj = SWIG_Python_GetSwigThis(obj);
if (sobj) {
int oldown = sobj->own;
sobj->own = own;
return oldown;
}
}
return 0;
}
/* Convert a pointer value */
SWIGRUNTIME int
SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
int res;
SwigPyObject *sobj;
int implicit_conv = (flags & SWIG_POINTER_IMPLICIT_CONV) != 0;
if (!obj)
return SWIG_ERROR;
if (obj == Py_None && !implicit_conv) {
if (ptr)
*ptr = 0;
return SWIG_OK;
}
res = SWIG_ERROR;
sobj = SWIG_Python_GetSwigThis(obj);
if (own)
*own = 0;
while (sobj) {
void *vptr = sobj->ptr;
if (ty) {
swig_type_info *to = sobj->ty;
if (to == ty) {
/* no type cast needed */
if (ptr) *ptr = vptr;
break;
} else {
swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
if (!tc) {
sobj = (SwigPyObject *)sobj->next;
} else {
if (ptr) {
int newmemory = 0;
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
if (newmemory == SWIG_CAST_NEW_MEMORY) {
assert(own); /* badly formed typemap which will lead to a memory leak - it must set and use own to delete *ptr */
if (own)
*own = *own | SWIG_CAST_NEW_MEMORY;
}
}
break;
}
}
} else {
if (ptr) *ptr = vptr;
break;
}
}
if (sobj) {
if (own)
*own = *own | sobj->own;
if (flags & SWIG_POINTER_DISOWN) {
sobj->own = 0;
}
res = SWIG_OK;
} else {
if (implicit_conv) {
SwigPyClientData *data = ty ? (SwigPyClientData *) ty->clientdata : 0;
if (data && !data->implicitconv) {
PyObject *klass = data->klass;
if (klass) {
PyObject *impconv;
data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
impconv = SWIG_Python_CallFunctor(klass, obj);
data->implicitconv = 0;
if (PyErr_Occurred()) {
PyErr_Clear();
impconv = 0;
}
if (impconv) {
SwigPyObject *iobj = SWIG_Python_GetSwigThis(impconv);
if (iobj) {
void *vptr;
res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
if (SWIG_IsOK(res)) {
if (ptr) {
*ptr = vptr;
/* transfer the ownership to 'ptr' */
iobj->own = 0;
res = SWIG_AddCast(res);
res = SWIG_AddNewMask(res);
} else {
res = SWIG_AddCast(res);
}
}
}
Py_DECREF(impconv);
}
}
}
}
if (!SWIG_IsOK(res) && obj == Py_None) {
if (ptr)
*ptr = 0;
if (PyErr_Occurred())
PyErr_Clear();
res = SWIG_OK;
}
}
return res;
}
/* Convert a function ptr value */
SWIGRUNTIME int
SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
if (!PyCFunction_Check(obj)) {
return SWIG_ConvertPtr(obj, ptr, ty, 0);
} else {
void *vptr = 0;
/* here we get the method pointer for callbacks */
const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
if (desc)
desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
if (!desc)
return SWIG_ERROR;
if (ty) {
swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
if (tc) {
int newmemory = 0;
*ptr = SWIG_TypeCast(tc,vptr,&newmemory);
assert(!newmemory); /* newmemory handling not yet implemented */
} else {
return SWIG_ERROR;
}
} else {
*ptr = vptr;
}
return SWIG_OK;
}
}
/* Convert a packed value value */
SWIGRUNTIME int
SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
swig_type_info *to = SwigPyPacked_UnpackData(obj, ptr, sz);
if (!to) return SWIG_ERROR;
if (ty) {
if (to != ty) {
/* check type cast? */
swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
if (!tc) return SWIG_ERROR;
}
}
return SWIG_OK;
}
/* -----------------------------------------------------------------------------
* Create a new pointer object
* ----------------------------------------------------------------------------- */
/*
Create a new instance object, without calling __init__, and set the
'this' attribute.
*/
SWIGRUNTIME PyObject*
SWIG_Python_NewShadowInstance(SwigPyClientData *data, PyObject *swig_this)
{
#if (PY_VERSION_HEX >= 0x02020000)
PyObject *inst = 0;
PyObject *newraw = data->newraw;
if (newraw) {
inst = PyObject_Call(newraw, data->newargs, NULL);
if (inst) {
#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
PyObject **dictptr = _PyObject_GetDictPtr(inst);
if (dictptr != NULL) {
PyObject *dict = *dictptr;
if (dict == NULL) {
dict = PyDict_New();
*dictptr = dict;
PyDict_SetItem(dict, SWIG_This(), swig_this);
}
}
#else
PyObject *key = SWIG_This();
PyObject_SetAttr(inst, key, swig_this);
#endif
}
} else {
#if PY_VERSION_HEX >= 0x03000000
inst = ((PyTypeObject*) data->newargs)->tp_new((PyTypeObject*) data->newargs, Py_None, Py_None);
if (inst) {
PyObject_SetAttr(inst, SWIG_This(), swig_this);
Py_TYPE(inst)->tp_flags &= ~Py_TPFLAGS_VALID_VERSION_TAG;
}
#else
PyObject *dict = PyDict_New();
if (dict) {
PyDict_SetItem(dict, SWIG_This(), swig_this);
inst = PyInstance_NewRaw(data->newargs, dict);
Py_DECREF(dict);
}
#endif
}
return inst;
#else
#if (PY_VERSION_HEX >= 0x02010000)
PyObject *inst = 0;
PyObject *dict = PyDict_New();
if (dict) {
PyDict_SetItem(dict, SWIG_This(), swig_this);
inst = PyInstance_NewRaw(data->newargs, dict);
Py_DECREF(dict);
}
return (PyObject *) inst;
#else
PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
if (inst == NULL) {
return NULL;
}
inst->in_class = (PyClassObject *)data->newargs;
Py_INCREF(inst->in_class);
inst->in_dict = PyDict_New();
if (inst->in_dict == NULL) {
Py_DECREF(inst);
return NULL;
}
#ifdef Py_TPFLAGS_HAVE_WEAKREFS
inst->in_weakreflist = NULL;
#endif
#ifdef Py_TPFLAGS_GC
PyObject_GC_Init(inst);
#endif
PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
return (PyObject *) inst;
#endif
#endif
}
SWIGRUNTIME void
SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
{
PyObject *dict;
#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
PyObject **dictptr = _PyObject_GetDictPtr(inst);
if (dictptr != NULL) {
dict = *dictptr;
if (dict == NULL) {
dict = PyDict_New();
*dictptr = dict;
}
PyDict_SetItem(dict, SWIG_This(), swig_this);
return;
}
#endif
dict = PyObject_GetAttrString(inst, (char*)"__dict__");
PyDict_SetItem(dict, SWIG_This(), swig_this);
Py_DECREF(dict);
}
SWIGINTERN PyObject *
SWIG_Python_InitShadowInstance(PyObject *args) {
PyObject *obj[2];
if (!SWIG_Python_UnpackTuple(args, "swiginit", 2, 2, obj)) {
return NULL;
} else {
SwigPyObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
if (sthis) {
SwigPyObject_append((PyObject*) sthis, obj[1]);
} else {
SWIG_Python_SetSwigThis(obj[0], obj[1]);
}
return SWIG_Py_Void();
}
}
/* Create a new pointer object */
SWIGRUNTIME PyObject *
SWIG_Python_NewPointerObj(PyObject *self, void *ptr, swig_type_info *type, int flags) {
SwigPyClientData *clientdata;
PyObject * robj;
int own;
if (!ptr)
return SWIG_Py_Void();
clientdata = type ? (SwigPyClientData *)(type->clientdata) : 0;
own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
if (clientdata && clientdata->pytype) {
SwigPyObject *newobj;
if (flags & SWIG_BUILTIN_TP_INIT) {
newobj = (SwigPyObject*) self;
if (newobj->ptr) {
PyObject *next_self = clientdata->pytype->tp_alloc(clientdata->pytype, 0);
while (newobj->next)
newobj = (SwigPyObject *) newobj->next;
newobj->next = next_self;
newobj = (SwigPyObject *)next_self;
#ifdef SWIGPYTHON_BUILTIN
newobj->dict = 0;
#endif
}
} else {
newobj = PyObject_New(SwigPyObject, clientdata->pytype);
#ifdef SWIGPYTHON_BUILTIN
newobj->dict = 0;
#endif
}
if (newobj) {
newobj->ptr = ptr;
newobj->ty = type;
newobj->own = own;
newobj->next = 0;
return (PyObject*) newobj;
}
return SWIG_Py_Void();
}
assert(!(flags & SWIG_BUILTIN_TP_INIT));
robj = SwigPyObject_New(ptr, type, own);
if (robj && clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
Py_DECREF(robj);
robj = inst;
}
return robj;
}
/* Create a new packed object */
SWIGRUNTIMEINLINE PyObject *
SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
return ptr ? SwigPyPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
}
/* -----------------------------------------------------------------------------*
* Get type list
* -----------------------------------------------------------------------------*/
#ifdef SWIG_LINK_RUNTIME
void *SWIG_ReturnGlobalTypeList(void *);
#endif
SWIGRUNTIME swig_module_info *
SWIG_Python_GetModule(void *SWIGUNUSEDPARM(clientdata)) {
static void *type_pointer = (void *)0;
/* first check if module already created */
if (!type_pointer) {
#ifdef SWIG_LINK_RUNTIME
type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
#else
# ifdef SWIGPY_USE_CAPSULE
type_pointer = PyCapsule_Import(SWIGPY_CAPSULE_NAME, 0);
# else
type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
(char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
# endif
if (PyErr_Occurred()) {
PyErr_Clear();
type_pointer = (void *)0;
}
#endif
}
return (swig_module_info *) type_pointer;
}
#if PY_MAJOR_VERSION < 2
/* PyModule_AddObject function was introduced in Python 2.0. The following function
is copied out of Python/modsupport.c in python version 2.3.4 */
SWIGINTERN int
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
{
PyObject *dict;
if (!PyModule_Check(m)) {
PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs module as first arg");
return SWIG_ERROR;
}
if (!o) {
PyErr_SetString(PyExc_TypeError, "PyModule_AddObject() needs non-NULL value");
return SWIG_ERROR;
}
dict = PyModule_GetDict(m);
if (dict == NULL) {
/* Internal error -- modules must have a dict! */
PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
PyModule_GetName(m));
return SWIG_ERROR;
}
if (PyDict_SetItemString(dict, name, o))
return SWIG_ERROR;
Py_DECREF(o);
return SWIG_OK;
}
#endif
SWIGRUNTIME void
#ifdef SWIGPY_USE_CAPSULE
SWIG_Python_DestroyModule(PyObject *obj)
#else
SWIG_Python_DestroyModule(void *vptr)
#endif
{
#ifdef SWIGPY_USE_CAPSULE
swig_module_info *swig_module = (swig_module_info *) PyCapsule_GetPointer(obj, SWIGPY_CAPSULE_NAME);
#else
swig_module_info *swig_module = (swig_module_info *) vptr;
#endif
swig_type_info **types = swig_module->types;
size_t i;
for (i =0; i < swig_module->size; ++i) {
swig_type_info *ty = types[i];
if (ty->owndata) {
SwigPyClientData *data = (SwigPyClientData *) ty->clientdata;
if (data) SwigPyClientData_Del(data);
}
}
Py_DECREF(SWIG_This());
swig_this = NULL;
}
SWIGRUNTIME void
SWIG_Python_SetModule(swig_module_info *swig_module) {
#if PY_VERSION_HEX >= 0x03000000
/* Add a dummy module object into sys.modules */
PyObject *module = PyImport_AddModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION);
#else
static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} }; /* Sentinel */
PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION, swig_empty_runtime_method_table);
#endif
#ifdef SWIGPY_USE_CAPSULE
PyObject *pointer = PyCapsule_New((void *) swig_module, SWIGPY_CAPSULE_NAME, SWIG_Python_DestroyModule);
if (pointer && module) {
PyModule_AddObject(module, (char*)"type_pointer_capsule" SWIG_TYPE_TABLE_NAME, pointer);
} else {
Py_XDECREF(pointer);
}
#else
PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
if (pointer && module) {
PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
} else {
Py_XDECREF(pointer);
}
#endif
}
/* The python cached type query */
SWIGRUNTIME PyObject *
SWIG_Python_TypeCache(void) {
static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
return cache;
}
SWIGRUNTIME swig_type_info *
SWIG_Python_TypeQuery(const char *type)
{
PyObject *cache = SWIG_Python_TypeCache();
PyObject *key = SWIG_Python_str_FromChar(type);
PyObject *obj = PyDict_GetItem(cache, key);
swig_type_info *descriptor;
if (obj) {
#ifdef SWIGPY_USE_CAPSULE
descriptor = (swig_type_info *) PyCapsule_GetPointer(obj, NULL);
#else
descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
#endif
} else {
swig_module_info *swig_module = SWIG_GetModule(0);
descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
if (descriptor) {
#ifdef SWIGPY_USE_CAPSULE
obj = PyCapsule_New((void*) descriptor, NULL, NULL);
#else
obj = PyCObject_FromVoidPtr(descriptor, NULL);
#endif
PyDict_SetItem(cache, key, obj);
Py_DECREF(obj);
}
}
Py_DECREF(key);
return descriptor;
}
/*
For backward compatibility only
*/
#define SWIG_POINTER_EXCEPTION 0
#define SWIG_arg_fail(arg) SWIG_Python_ArgFail(arg)
#define SWIG_MustGetPtr(p, type, argnum, flags) SWIG_Python_MustGetPtr(p, type, argnum, flags)
SWIGRUNTIME int
SWIG_Python_AddErrMesg(const char* mesg, int infront)
{
if (PyErr_Occurred()) {
PyObject *type = 0;
PyObject *value = 0;
PyObject *traceback = 0;
PyErr_Fetch(&type, &value, &traceback);
if (value) {
char *tmp;
PyObject *old_str = PyObject_Str(value);
Py_XINCREF(type);
PyErr_Clear();
if (infront) {
PyErr_Format(type, "%s %s", mesg, tmp = SWIG_Python_str_AsChar(old_str));
} else {
PyErr_Format(type, "%s %s", tmp = SWIG_Python_str_AsChar(old_str), mesg);
}
SWIG_Python_str_DelForPy3(tmp);
Py_DECREF(old_str);
}
return 1;
} else {
return 0;
}
}
SWIGRUNTIME int
SWIG_Python_ArgFail(int argnum)
{
if (PyErr_Occurred()) {
/* add information about failing argument */
char mesg[256];
PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
return SWIG_Python_AddErrMesg(mesg, 1);
} else {
return 0;
}
}
SWIGRUNTIMEINLINE const char *
SwigPyObject_GetDesc(PyObject *self)
{
SwigPyObject *v = (SwigPyObject *)self;
swig_type_info *ty = v ? v->ty : 0;
return ty ? ty->str : "";
}
SWIGRUNTIME void
SWIG_Python_TypeError(const char *type, PyObject *obj)
{
if (type) {
#if defined(SWIG_COBJECT_TYPES)
if (obj && SwigPyObject_Check(obj)) {
const char *otype = (const char *) SwigPyObject_GetDesc(obj);
if (otype) {
PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'SwigPyObject(%s)' is received",
type, otype);
return;
}
} else
#endif
{
const char *otype = (obj ? obj->ob_type->tp_name : 0);
if (otype) {
PyObject *str = PyObject_Str(obj);
const char *cstr = str ? SWIG_Python_str_AsChar(str) : 0;
if (cstr) {
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
type, otype, cstr);
SWIG_Python_str_DelForPy3(cstr);
} else {
PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
type, otype);
}
Py_XDECREF(str);
return;
}
}
PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
} else {
PyErr_Format(PyExc_TypeError, "unexpected type is received");
}
}
/* Convert a pointer value, signal an exception on a type mismatch */
SWIGRUNTIME void *
SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int SWIGUNUSEDPARM(argnum), int flags) {
void *result;
if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
PyErr_Clear();
#if SWIG_POINTER_EXCEPTION
if (flags) {
SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
SWIG_Python_ArgFail(argnum);
}
#endif
}
return result;
}
#ifdef SWIGPYTHON_BUILTIN
SWIGRUNTIME int
SWIG_Python_NonDynamicSetAttr(PyObject *obj, PyObject *name, PyObject *value) {
PyTypeObject *tp = obj->ob_type;
PyObject *descr;
PyObject *encoded_name;
descrsetfunc f;
int res = -1;
# ifdef Py_USING_UNICODE
if (PyString_Check(name)) {
name = PyUnicode_Decode(PyString_AsString(name), PyString_Size(name), NULL, NULL);
if (!name)
return -1;
} else if (!PyUnicode_Check(name))
# else
if (!PyString_Check(name))
# endif
{
PyErr_Format(PyExc_TypeError, "attribute name must be string, not '%.200s'", name->ob_type->tp_name);
return -1;
} else {
Py_INCREF(name);
}
if (!tp->tp_dict) {
if (PyType_Ready(tp) < 0)
goto done;
}
descr = _PyType_Lookup(tp, name);
f = NULL;
if (descr != NULL)
f = descr->ob_type->tp_descr_set;
if (!f) {
if (PyString_Check(name)) {
encoded_name = name;
Py_INCREF(name);
} else {
encoded_name = PyUnicode_AsUTF8String(name);
}
PyErr_Format(PyExc_AttributeError, "'%.100s' object has no attribute '%.200s'", tp->tp_name, PyString_AsString(encoded_name));
Py_DECREF(encoded_name);
} else {
res = f(descr, obj, value);
}
done:
Py_DECREF(name);
return res;
}
#endif
#ifdef __cplusplus
}
#endif
#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0)
#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else
#define SWIG_exception(code, msg) do { SWIG_Error(code, msg); SWIG_fail;; } while(0)
/* -------- TYPES TABLE (BEGIN) -------- */
#define SWIGTYPE_p_allocator_type swig_types[0]
#define SWIGTYPE_p_char swig_types[1]
#define SWIGTYPE_p_difference_type swig_types[2]
#define SWIGTYPE_p_p_PyObject swig_types[3]
#define SWIGTYPE_p_size_type swig_types[4]
#define SWIGTYPE_p_std__allocatorT_double_t swig_types[5]
#define SWIGTYPE_p_std__invalid_argument swig_types[6]
#define SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t swig_types[7]
#define SWIGTYPE_p_swig__SwigPyIterator swig_types[8]
#define SWIGTYPE_p_value_type swig_types[9]
static swig_type_info *swig_types[11];
static swig_module_info swig_module = {swig_types, 10, 0, 0, 0, 0};
#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
/* -------- TYPES TABLE (END) -------- */
#if (PY_VERSION_HEX <= 0x02000000)
# if !defined(SWIG_PYTHON_CLASSIC)
# error "This python version requires swig to be run with the '-classic' option"
# endif
#endif
/*-----------------------------------------------
@(target):= _polyiou.so
------------------------------------------------*/
#if PY_VERSION_HEX >= 0x03000000
# define SWIG_init PyInit__polyiou
#else
# define SWIG_init init_polyiou
#endif
#define SWIG_name "_polyiou"
#define SWIGVERSION 0x030008
#define SWIG_VERSION SWIGVERSION
#define SWIG_as_voidptr(a) const_cast< void * >(static_cast< const void * >(a))
#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),reinterpret_cast< void** >(a))
#include
namespace swig {
class SwigPtr_PyObject {
protected:
PyObject *_obj;
public:
SwigPtr_PyObject() :_obj(0)
{
}
SwigPtr_PyObject(const SwigPtr_PyObject& item) : _obj(item._obj)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_XINCREF(_obj);
SWIG_PYTHON_THREAD_END_BLOCK;
}
SwigPtr_PyObject(PyObject *obj, bool initial_ref = true) :_obj(obj)
{
if (initial_ref) {
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_XINCREF(_obj);
SWIG_PYTHON_THREAD_END_BLOCK;
}
}
SwigPtr_PyObject & operator=(const SwigPtr_PyObject& item)
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_XINCREF(item._obj);
Py_XDECREF(_obj);
_obj = item._obj;
SWIG_PYTHON_THREAD_END_BLOCK;
return *this;
}
~SwigPtr_PyObject()
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
Py_XDECREF(_obj);
SWIG_PYTHON_THREAD_END_BLOCK;
}
operator PyObject *() const
{
return _obj;
}
PyObject *operator->() const
{
return _obj;
}
};
}
namespace swig {
struct SwigVar_PyObject : SwigPtr_PyObject {
SwigVar_PyObject(PyObject* obj = 0) : SwigPtr_PyObject(obj, false) { }
SwigVar_PyObject & operator = (PyObject* obj)
{
Py_XDECREF(_obj);
_obj = obj;
return *this;
}
};
}
#include
#if PY_VERSION_HEX >= 0x03020000
# define SWIGPY_SLICE_ARG(obj) ((PyObject*) (obj))
#else
# define SWIGPY_SLICE_ARG(obj) ((PySliceObject*) (obj))
#endif
#include
#if defined(__GNUC__)
# if __GNUC__ == 2 && __GNUC_MINOR <= 96
# define SWIG_STD_NOMODERN_STL
# endif
#endif
#include
#include
namespace swig {
struct stop_iteration {
};
struct SwigPyIterator {
private:
SwigPtr_PyObject _seq;
protected:
SwigPyIterator(PyObject *seq) : _seq(seq)
{
}
public:
virtual ~SwigPyIterator() {}
// Access iterator method, required by Python
virtual PyObject *value() const = 0;
// Forward iterator method, required by Python
virtual SwigPyIterator *incr(size_t n = 1) = 0;
// Backward iterator method, very common in C++, but not required in Python
virtual SwigPyIterator *decr(size_t /*n*/ = 1)
{
throw stop_iteration();
}
// Random access iterator methods, but not required in Python
virtual ptrdiff_t distance(const SwigPyIterator &/*x*/) const
{
throw std::invalid_argument("operation not supported");
}
virtual bool equal (const SwigPyIterator &/*x*/) const
{
throw std::invalid_argument("operation not supported");
}
// C++ common/needed methods
virtual SwigPyIterator *copy() const = 0;
PyObject *next()
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads
PyObject *obj = value();
incr();
SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads
return obj;
}
/* Make an alias for Python 3.x */
PyObject *__next__()
{
return next();
}
PyObject *previous()
{
SWIG_PYTHON_THREAD_BEGIN_BLOCK; // disable threads
decr();
PyObject *obj = value();
SWIG_PYTHON_THREAD_END_BLOCK; // re-enable threads
return obj;
}
SwigPyIterator *advance(ptrdiff_t n)
{
return (n > 0) ? incr(n) : decr(-n);
}
bool operator == (const SwigPyIterator& x) const
{
return equal(x);
}
bool operator != (const SwigPyIterator& x) const
{
return ! operator==(x);
}
SwigPyIterator& operator += (ptrdiff_t n)
{
return *advance(n);
}
SwigPyIterator& operator -= (ptrdiff_t n)
{
return *advance(-n);
}
SwigPyIterator* operator + (ptrdiff_t n) const
{
return copy()->advance(n);
}
SwigPyIterator* operator - (ptrdiff_t n) const
{
return copy()->advance(-n);
}
ptrdiff_t operator - (const SwigPyIterator& x) const
{
return x.distance(*this);
}
static swig_type_info* descriptor() {
static int init = 0;
static swig_type_info* desc = 0;
if (!init) {
desc = SWIG_TypeQuery("swig::SwigPyIterator *");
init = 1;
}
return desc;
}
};
#if defined(SWIGPYTHON_BUILTIN)
inline PyObject* make_output_iterator_builtin (PyObject *pyself)
{
Py_INCREF(pyself);
return pyself;
}
#endif
}
SWIGINTERN int
SWIG_AsVal_double (PyObject *obj, double *val)
{
int res = SWIG_TypeError;
if (PyFloat_Check(obj)) {
if (val) *val = PyFloat_AsDouble(obj);
return SWIG_OK;
#if PY_VERSION_HEX < 0x03000000
} else if (PyInt_Check(obj)) {
if (val) *val = PyInt_AsLong(obj);
return SWIG_OK;
#endif
} else if (PyLong_Check(obj)) {
double v = PyLong_AsDouble(obj);
if (!PyErr_Occurred()) {
if (val) *val = v;
return SWIG_OK;
} else {
PyErr_Clear();
}
}
#ifdef SWIG_PYTHON_CAST_MODE
{
int dispatch = 0;
double d = PyFloat_AsDouble(obj);
if (!PyErr_Occurred()) {
if (val) *val = d;
return SWIG_AddCast(SWIG_OK);
} else {
PyErr_Clear();
}
if (!dispatch) {
long v = PyLong_AsLong(obj);
if (!PyErr_Occurred()) {
if (val) *val = v;
return SWIG_AddCast(SWIG_AddCast(SWIG_OK));
} else {
PyErr_Clear();
}
}
}
#endif
return res;
}
#include
#include
SWIGINTERNINLINE int
SWIG_CanCastAsInteger(double *d, double min, double max) {
double x = *d;
if ((min <= x && x <= max)) {
double fx = floor(x);
double cx = ceil(x);
double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */
if ((errno == EDOM) || (errno == ERANGE)) {
errno = 0;
} else {
double summ, reps, diff;
if (rd < x) {
diff = x - rd;
} else if (rd > x) {
diff = rd - x;
} else {
return 1;
}
summ = rd + x;
reps = diff/summ;
if (reps < 8*DBL_EPSILON) {
*d = rd;
return 1;
}
}
}
return 0;
}
SWIGINTERN int
SWIG_AsVal_unsigned_SS_long (PyObject *obj, unsigned long *val)
{
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check(obj)) {
long v = PyInt_AsLong(obj);
if (v >= 0) {
if (val) *val = v;
return SWIG_OK;
} else {
return SWIG_OverflowError;
}
} else
#endif
if (PyLong_Check(obj)) {
unsigned long v = PyLong_AsUnsignedLong(obj);
if (!PyErr_Occurred()) {
if (val) *val = v;
return SWIG_OK;
} else {
PyErr_Clear();
return SWIG_OverflowError;
}
}
#ifdef SWIG_PYTHON_CAST_MODE
{
int dispatch = 0;
unsigned long v = PyLong_AsUnsignedLong(obj);
if (!PyErr_Occurred()) {
if (val) *val = v;
return SWIG_AddCast(SWIG_OK);
} else {
PyErr_Clear();
}
if (!dispatch) {
double d;
int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, 0, ULONG_MAX)) {
if (val) *val = (unsigned long)(d);
return res;
}
}
}
#endif
return SWIG_TypeError;
}
SWIGINTERNINLINE int
SWIG_AsVal_size_t (PyObject * obj, size_t *val)
{
unsigned long v;
int res = SWIG_AsVal_unsigned_SS_long (obj, val ? &v : 0);
if (SWIG_IsOK(res) && val) *val = static_cast< size_t >(v);
return res;
}
#define SWIG_From_long PyLong_FromLong
SWIGINTERNINLINE PyObject *
SWIG_From_ptrdiff_t (ptrdiff_t value)
{
return SWIG_From_long (static_cast< long >(value));
}
SWIGINTERNINLINE PyObject*
SWIG_From_bool (bool value)
{
return PyBool_FromLong(value ? 1 : 0);
}
SWIGINTERN int
SWIG_AsVal_long (PyObject *obj, long* val)
{
#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check(obj)) {
if (val) *val = PyInt_AsLong(obj);
return SWIG_OK;
} else
#endif
if (PyLong_Check(obj)) {
long v = PyLong_AsLong(obj);
if (!PyErr_Occurred()) {
if (val) *val = v;
return SWIG_OK;
} else {
PyErr_Clear();
return SWIG_OverflowError;
}
}
#ifdef SWIG_PYTHON_CAST_MODE
{
int dispatch = 0;
long v = PyInt_AsLong(obj);
if (!PyErr_Occurred()) {
if (val) *val = v;
return SWIG_AddCast(SWIG_OK);
} else {
PyErr_Clear();
}
if (!dispatch) {
double d;
int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d));
if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) {
if (val) *val = (long)(d);
return res;
}
}
}
#endif
return SWIG_TypeError;
}
SWIGINTERNINLINE int
SWIG_AsVal_ptrdiff_t (PyObject * obj, ptrdiff_t *val)
{
long v;
int res = SWIG_AsVal_long (obj, val ? &v : 0);
if (SWIG_IsOK(res) && val) *val = static_cast< ptrdiff_t >(v);
return res;
}
#include
#include
namespace swig {
template
struct noconst_traits {
typedef Type noconst_type;
};
template
struct noconst_traits {
typedef Type noconst_type;
};
/*
type categories
*/
struct pointer_category { };
struct value_category { };
/*
General traits that provides type_name and type_info
*/
template struct traits { };
template
inline const char* type_name() {
return traits::noconst_type >::type_name();
}
template
struct traits_info {
static swig_type_info *type_query(std::string name) {
name += " *";
return SWIG_TypeQuery(name.c_str());
}
static swig_type_info *type_info() {
static swig_type_info *info = type_query(type_name());
return info;
}
};
template
inline swig_type_info *type_info() {
return traits_info::type_info();
}
/*
Partial specialization for pointers
*/
template struct traits {
typedef pointer_category category;
static std::string make_ptr_name(const char* name) {
std::string ptrname = name;
ptrname += " *";
return ptrname;
}
static const char* type_name() {
static std::string name = make_ptr_name(swig::type_name());
return name.c_str();
}
};
template
struct traits_as { };
template
struct traits_check { };
}
namespace swig {
/*
Traits that provides the from method
*/
template struct traits_from_ptr {
static PyObject *from(Type *val, int owner = 0) {
return SWIG_InternalNewPointerObj(val, type_info(), owner);
}
};
template struct traits_from {
static PyObject *from(const Type& val) {
return traits_from_ptr::from(new Type(val), 1);
}
};
template struct traits_from {
static PyObject *from(Type* val) {
return traits_from_ptr::from(val, 0);
}
};
template struct traits_from {
static PyObject *from(const Type* val) {
return traits_from_ptr::from(const_cast(val), 0);
}
};
template
inline PyObject *from(const Type& val) {
return traits_from::from(val);
}
template
inline PyObject *from_ptr(Type* val, int owner) {
return traits_from_ptr::from(val, owner);
}
/*
Traits that provides the asval/as/check method
*/
template
struct traits_asptr {
static int asptr(PyObject *obj, Type **val) {
Type *p;
int res = SWIG_ConvertPtr(obj, (void**)&p, type_info(), 0);
if (SWIG_IsOK(res)) {
if (val) *val = p;
}
return res;
}
};
template
inline int asptr(PyObject *obj, Type **vptr) {
return traits_asptr::asptr(obj, vptr);
}
template
struct traits_asval {
static int asval(PyObject *obj, Type *val) {
if (val) {
Type *p = 0;
int res = traits_asptr::asptr(obj, &p);
if (!SWIG_IsOK(res)) return res;
if (p) {
typedef typename noconst_traits::noconst_type noconst_type;
*(const_cast(val)) = *p;
if (SWIG_IsNewObj(res)){
delete p;
res = SWIG_DelNewMask(res);
}
return res;
} else {
return SWIG_ERROR;
}
} else {
return traits_asptr::asptr(obj, (Type **)(0));
}
}
};
template struct traits_asval {
static int asval(PyObject *obj, Type **val) {
if (val) {
typedef typename noconst_traits::noconst_type noconst_type;
noconst_type *p = 0;
int res = traits_asptr::asptr(obj, &p);
if (SWIG_IsOK(res)) {
*(const_cast(val)) = p;
}
return res;
} else {
return traits_asptr::asptr(obj, (Type **)(0));
}
}
};
template
inline int asval(PyObject *obj, Type *val) {
return traits_asval::asval(obj, val);
}
template
struct traits_as {
static Type as(PyObject *obj, bool throw_error) {
Type v;
int res = asval(obj, &v);
if (!obj || !SWIG_IsOK(res)) {
if (!PyErr_Occurred()) {
::SWIG_Error(SWIG_TypeError, swig::type_name());
}
if (throw_error) throw std::invalid_argument("bad type");
}
return v;
}
};
template
struct traits_as {
static Type as(PyObject *obj, bool throw_error) {
Type *v = 0;
int res = (obj ? traits_asptr::asptr(obj, &v) : SWIG_ERROR);
if (SWIG_IsOK(res) && v) {
if (SWIG_IsNewObj(res)) {
Type r(*v);
delete v;
return r;
} else {
return *v;
}
} else {
// Uninitialized return value, no Type() constructor required.
static Type *v_def = (Type*) malloc(sizeof(Type));
if (!PyErr_Occurred()) {
SWIG_Error(SWIG_TypeError, swig::type_name());
}
if (throw_error) throw std::invalid_argument("bad type");
memset(v_def,0,sizeof(Type));
return *v_def;
}
}
};
template
struct traits_as {
static Type* as(PyObject *obj, bool throw_error) {
Type *v = 0;
int res = (obj ? traits_asptr::asptr(obj, &v) : SWIG_ERROR);
if (SWIG_IsOK(res)) {
return v;
} else {
if (!PyErr_Occurred()) {
SWIG_Error(SWIG_TypeError, swig::type_name());
}
if (throw_error) throw std::invalid_argument("bad type");
return 0;
}
}
};
template
inline Type as(PyObject *obj, bool te = false) {
return traits_as::category>::as(obj, te);
}
template
struct traits_check {
static bool check(PyObject *obj) {
int res = obj ? asval(obj, (Type *)(0)) : SWIG_ERROR;
return SWIG_IsOK(res) ? true : false;
}
};
template
struct traits_check {
static bool check(PyObject *obj) {
int res = obj ? asptr(obj, (Type **)(0)) : SWIG_ERROR;
return SWIG_IsOK(res) ? true : false;
}
};
template
inline bool check(PyObject *obj) {
return traits_check::category>::check(obj);
}
}
#include
namespace std {
template <>
struct less : public binary_function
{
bool
operator()(PyObject * v, PyObject *w) const
{
bool res;
SWIG_PYTHON_THREAD_BEGIN_BLOCK;
res = PyObject_RichCompareBool(v, w, Py_LT) ? true : false;
/* This may fall into a case of inconsistent
eg. ObjA > ObjX > ObjB
but ObjA < ObjB
*/
if( PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_TypeError) )
{
/* Objects can't be compared, this mostly occurred in Python 3.0 */
/* Compare their ptr directly for a workaround */
res = (v < w);
PyErr_Clear();
}
SWIG_PYTHON_THREAD_END_BLOCK;
return res;
}
};
template <>
struct less : public binary_function
{
bool
operator()(const swig::SwigPtr_PyObject& v, const swig::SwigPtr_PyObject& w) const
{
return std::less()(v, w);
}
};
template <>
struct less : public binary_function
{
bool
operator()(const swig::SwigVar_PyObject& v, const swig::SwigVar_PyObject& w) const
{
return std::less()(v, w);
}
};
}
namespace swig {
template <> struct traits {
typedef value_category category;
static const char* type_name() { return "PyObject *"; }
};
template <> struct traits_asval {
typedef PyObject * value_type;
static int asval(PyObject *obj, value_type *val) {
if (val) *val = obj;
return SWIG_OK;
}
};
template <>
struct traits_check {
static bool check(PyObject *) {
return true;
}
};
template <> struct traits_from {
typedef PyObject * value_type;
static PyObject *from(const value_type& val) {
Py_XINCREF(val);
return val;
}
};
}
namespace swig {
template
inline size_t
check_index(Difference i, size_t size, bool insert = false) {
if ( i < 0 ) {
if ((size_t) (-i) <= size)
return (size_t) (i + size);
} else if ( (size_t) i < size ) {
return (size_t) i;
} else if (insert && ((size_t) i == size)) {
return size;
}
throw std::out_of_range("index out of range");
}
template
void
slice_adjust(Difference i, Difference j, Py_ssize_t step, size_t size, Difference &ii, Difference &jj, bool insert = false) {
if (step == 0) {
throw std::invalid_argument("slice step cannot be zero");
} else if (step > 0) {
// Required range: 0 <= i < size, 0 <= j < size
if (i < 0) {
ii = 0;
} else if (i < (Difference)size) {
ii = i;
} else if (insert && (i >= (Difference)size)) {
ii = (Difference)size;
}
if ( j < 0 ) {
jj = 0;
} else {
jj = (j < (Difference)size) ? j : (Difference)size;
}
} else {
// Required range: -1 <= i < size-1, -1 <= j < size-1
if (i < -1) {
ii = -1;
} else if (i < (Difference) size) {
ii = i;
} else if (i >= (Difference)(size-1)) {
ii = (Difference)(size-1);
}
if (j < -1) {
jj = -1;
} else {
jj = (j < (Difference)size ) ? j : (Difference)(size-1);
}
}
}
template
inline typename Sequence::iterator
getpos(Sequence* self, Difference i) {
typename Sequence::iterator pos = self->begin();
std::advance(pos, check_index(i,self->size()));
return pos;
}
template
inline typename Sequence::const_iterator
cgetpos(const Sequence* self, Difference i) {
typename Sequence::const_iterator pos = self->begin();
std::advance(pos, check_index(i,self->size()));
return pos;
}
template
inline void
erase(Sequence* seq, const typename Sequence::iterator& position) {
seq->erase(position);
}
template
inline Sequence*
getslice(const Sequence* self, Difference i, Difference j, Py_ssize_t step) {
typename Sequence::size_type size = self->size();
Difference ii = 0;
Difference jj = 0;
swig::slice_adjust(i, j, step, size, ii, jj);
if (step > 0) {
typename Sequence::const_iterator sb = self->begin();
typename Sequence::const_iterator se = self->begin();
std::advance(sb,ii);
std::advance(se,jj);
if (step == 1) {
return new Sequence(sb, se);
} else {
Sequence *sequence = new Sequence();
typename Sequence::const_iterator it = sb;
while (it!=se) {
sequence->push_back(*it);
for (Py_ssize_t c=0; c jj) {
typename Sequence::const_reverse_iterator sb = self->rbegin();
typename Sequence::const_reverse_iterator se = self->rbegin();
std::advance(sb,size-ii-1);
std::advance(se,size-jj-1);
typename Sequence::const_reverse_iterator it = sb;
while (it!=se) {
sequence->push_back(*it);
for (Py_ssize_t c=0; c<-step && it!=se; ++c)
it++;
}
}
return sequence;
}
}
template
inline void
setslice(Sequence* self, Difference i, Difference j, Py_ssize_t step, const InputSeq& is = InputSeq()) {
typename Sequence::size_type size = self->size();
Difference ii = 0;
Difference jj = 0;
swig::slice_adjust(i, j, step, size, ii, jj, true);
if (step > 0) {
if (jj < ii)
jj = ii;
if (step == 1) {
size_t ssize = jj - ii;
if (ssize <= is.size()) {
// expanding/staying the same size
typename Sequence::iterator sb = self->begin();
typename InputSeq::const_iterator isit = is.begin();
std::advance(sb,ii);
std::advance(isit, jj - ii);
self->insert(std::copy(is.begin(), isit, sb), isit, is.end());
} else {
// shrinking
typename Sequence::iterator sb = self->begin();
typename Sequence::iterator se = self->begin();
std::advance(sb,ii);
std::advance(se,jj);
self->erase(sb,se);
sb = self->begin();
std::advance(sb,ii);
self->insert(sb, is.begin(), is.end());
}
} else {
size_t replacecount = (jj - ii + step - 1) / step;
if (is.size() != replacecount) {
char msg[1024];
sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount);
throw std::invalid_argument(msg);
}
typename Sequence::const_iterator isit = is.begin();
typename Sequence::iterator it = self->begin();
std::advance(it,ii);
for (size_t rc=0; rcend(); ++c)
it++;
}
}
} else {
if (jj > ii)
jj = ii;
size_t replacecount = (ii - jj - step - 1) / -step;
if (is.size() != replacecount) {
char msg[1024];
sprintf(msg, "attempt to assign sequence of size %lu to extended slice of size %lu", (unsigned long)is.size(), (unsigned long)replacecount);
throw std::invalid_argument(msg);
}
typename Sequence::const_iterator isit = is.begin();
typename Sequence::reverse_iterator it = self->rbegin();
std::advance(it,size-ii-1);
for (size_t rc=0; rcrend(); ++c)
it++;
}
}
}
template
inline void
delslice(Sequence* self, Difference i, Difference j, Py_ssize_t step) {
typename Sequence::size_type size = self->size();
Difference ii = 0;
Difference jj = 0;
swig::slice_adjust(i, j, step, size, ii, jj, true);
if (step > 0) {
if (jj > ii) {
typename Sequence::iterator sb = self->begin();
std::advance(sb,ii);
if (step == 1) {
typename Sequence::iterator se = self->begin();
std::advance(se,jj);
self->erase(sb,se);
} else {
typename Sequence::iterator it = sb;
size_t delcount = (jj - ii + step - 1) / step;
while (delcount) {
it = self->erase(it);
for (Py_ssize_t c=0; c<(step-1) && it != self->end(); ++c)
it++;
delcount--;
}
}
}
} else {
if (ii > jj) {
typename Sequence::reverse_iterator sb = self->rbegin();
std::advance(sb,size-ii-1);
typename Sequence::reverse_iterator it = sb;
size_t delcount = (ii - jj - step - 1) / -step;
while (delcount) {
it = typename Sequence::reverse_iterator(self->erase((++it).base()));
for (Py_ssize_t c=0; c<(-step-1) && it != self->rend(); ++c)
it++;
delcount--;
}
}
}
}
}
#if defined(__SUNPRO_CC) && defined(_RWSTD_VER)
# if !defined(SWIG_NO_STD_NOITERATOR_TRAITS_STL)
# define SWIG_STD_NOITERATOR_TRAITS_STL
# endif
#endif
#if !defined(SWIG_STD_NOITERATOR_TRAITS_STL)
#include
#else
namespace std {
template
struct iterator_traits {
typedef ptrdiff_t difference_type;
typedef typename Iterator::value_type value_type;
};
template
struct iterator_traits<__reverse_bi_iterator > {
typedef Distance difference_type;
typedef T value_type;
};
template
struct iterator_traits {
typedef T value_type;
typedef ptrdiff_t difference_type;
};
template
inline typename iterator_traits<_InputIterator>::difference_type
distance(_InputIterator __first, _InputIterator __last)
{
typename iterator_traits<_InputIterator>::difference_type __n = 0;
while (__first != __last) {
++__first; ++__n;
}
return __n;
}
}
#endif
namespace swig {
template
class SwigPyIterator_T : public SwigPyIterator
{
public:
typedef OutIterator out_iterator;
typedef typename std::iterator_traits::value_type value_type;
typedef SwigPyIterator_T self_type;
SwigPyIterator_T(out_iterator curr, PyObject *seq)
: SwigPyIterator(seq), current(curr)
{
}
const out_iterator& get_current() const
{
return current;
}
bool equal (const SwigPyIterator &iter) const
{
const self_type *iters = dynamic_cast(&iter);
if (iters) {
return (current == iters->get_current());
} else {
throw std::invalid_argument("bad iterator type");
}
}
ptrdiff_t distance(const SwigPyIterator &iter) const
{
const self_type *iters = dynamic_cast(&iter);
if (iters) {
return std::distance(current, iters->get_current());
} else {
throw std::invalid_argument("bad iterator type");
}
}
protected:
out_iterator current;
};
template
struct from_oper
{
typedef const ValueType& argument_type;
typedef PyObject *result_type;
result_type operator()(argument_type v) const
{
return swig::from(v);
}
};
template::value_type,
typename FromOper = from_oper >
class SwigPyIteratorOpen_T : public SwigPyIterator_T
{
public:
FromOper from;
typedef OutIterator out_iterator;
typedef ValueType value_type;
typedef SwigPyIterator_T base;
typedef SwigPyIteratorOpen_T self_type;
SwigPyIteratorOpen_T(out_iterator curr, PyObject *seq)
: SwigPyIterator_T(curr, seq)
{
}
PyObject *value() const {
return from(static_cast(*(base::current)));
}
SwigPyIterator *copy() const
{
return new self_type(*this);
}
SwigPyIterator *incr(size_t n = 1)
{
while (n--) {
++base::current;
}
return this;
}
SwigPyIterator *decr(size_t n = 1)
{
while (n--) {
--base::current;
}
return this;
}
};
template::value_type,
typename FromOper = from_oper >
class SwigPyIteratorClosed_T : public SwigPyIterator_T
{
public:
FromOper from;
typedef OutIterator out_iterator;
typedef ValueType value_type;
typedef SwigPyIterator_T base;
typedef SwigPyIteratorClosed_T self_type;
SwigPyIteratorClosed_T(out_iterator curr, out_iterator first, out_iterator last, PyObject *seq)
: SwigPyIterator_T(curr, seq), begin(first), end(last)
{
}
PyObject *value() const {
if (base::current == end) {
throw stop_iteration();
} else {
return from(static_cast(*(base::current)));
}
}
SwigPyIterator *copy() const
{
return new self_type(*this);
}
SwigPyIterator *incr(size_t n = 1)
{
while (n--) {
if (base::current == end) {
throw stop_iteration();
} else {
++base::current;
}
}
return this;
}
SwigPyIterator *decr(size_t n = 1)
{
while (n--) {
if (base::current == begin) {
throw stop_iteration();
} else {
--base::current;
}
}
return this;
}
private:
out_iterator begin;
out_iterator end;
};
template
inline SwigPyIterator*
make_output_iterator(const OutIter& current, const OutIter& begin,const OutIter& end, PyObject *seq = 0)
{
return new SwigPyIteratorClosed_T(current, begin, end, seq);
}
template
inline SwigPyIterator*
make_output_iterator(const OutIter& current, PyObject *seq = 0)
{
return new SwigPyIteratorOpen_T(current, seq);
}
}
namespace swig
{
template
struct SwigPySequence_Ref
{
SwigPySequence_Ref(PyObject* seq, Py_ssize_t index)
: _seq(seq), _index(index)
{
}
operator T () const
{
swig::SwigVar_PyObject item = PySequence_GetItem(_seq, _index);
try {
return swig::as(item, true);
} catch (std::exception& e) {
char msg[1024];
sprintf(msg, "in sequence element %d ", (int)_index);
if (!PyErr_Occurred()) {
::SWIG_Error(SWIG_TypeError, swig::type_name());
}
SWIG_Python_AddErrorMsg(msg);
SWIG_Python_AddErrorMsg(e.what());
throw;
}
}
SwigPySequence_Ref& operator=(const T& v)
{
PySequence_SetItem(_seq, _index, swig::from(v));
return *this;
}
private:
PyObject* _seq;
Py_ssize_t _index;
};
template
struct SwigPySequence_ArrowProxy
{
SwigPySequence_ArrowProxy(const T& x): m_value(x) {}
const T* operator->() const { return &m_value; }
operator const T*() const { return &m_value; }
T m_value;
};
template
struct SwigPySequence_InputIterator
{
typedef SwigPySequence_InputIterator self;
typedef std::random_access_iterator_tag iterator_category;
typedef Reference reference;
typedef T value_type;
typedef T* pointer;
typedef Py_ssize_t difference_type;
SwigPySequence_InputIterator()
{
}
SwigPySequence_InputIterator(PyObject* seq, Py_ssize_t index)
: _seq(seq), _index(index)
{
}
reference operator*() const
{
return reference(_seq, _index);
}
SwigPySequence_ArrowProxy
operator->() const {
return SwigPySequence_ArrowProxy(operator*());
}
bool operator==(const self& ri) const
{
return (_index == ri._index) && (_seq == ri._seq);
}
bool operator!=(const self& ri) const
{
return !(operator==(ri));
}
self& operator ++ ()
{
++_index;
return *this;
}
self& operator -- ()
{
--_index;
return *this;
}
self& operator += (difference_type n)
{
_index += n;
return *this;
}
self operator +(difference_type n) const
{
return self(_seq, _index + n);
}
self& operator -= (difference_type n)
{
_index -= n;
return *this;
}
self operator -(difference_type n) const
{
return self(_seq, _index - n);
}
difference_type operator - (const self& ri) const
{
return _index - ri._index;
}
bool operator < (const self& ri) const
{
return _index < ri._index;
}
reference
operator[](difference_type n) const
{
return reference(_seq, _index + n);
}
private:
PyObject* _seq;
difference_type _index;
};
// STL container wrapper around a Python sequence
template
struct SwigPySequence_Cont
{
typedef SwigPySequence_Ref reference;
typedef const SwigPySequence_Ref const_reference;
typedef T value_type;
typedef T* pointer;
typedef Py_ssize_t difference_type;
typedef size_t size_type;
typedef const pointer const_pointer;
typedef SwigPySequence_InputIterator iterator;
typedef SwigPySequence_InputIterator const_iterator;
SwigPySequence_Cont(PyObject* seq) : _seq(0)
{
if (!PySequence_Check(seq)) {
throw std::invalid_argument("a sequence is expected");
}
_seq = seq;
Py_INCREF(_seq);
}
~SwigPySequence_Cont()
{
Py_XDECREF(_seq);
}
size_type size() const
{
return static_cast(PySequence_Size(_seq));
}
bool empty() const
{
return size() == 0;
}
iterator begin()
{
return iterator(_seq, 0);
}
const_iterator begin() const
{
return const_iterator(_seq, 0);
}
iterator end()
{
return iterator(_seq, size());
}
const_iterator end() const
{
return const_iterator(_seq, size());
}
reference operator[](difference_type n)
{
return reference(_seq, n);
}
const_reference operator[](difference_type n) const
{
return const_reference(_seq, n);
}
bool check(bool set_err = true) const
{
Py_ssize_t s = size();
for (Py_ssize_t i = 0; i < s; ++i) {
swig::SwigVar_PyObject item = PySequence_GetItem(_seq, i);
if (!swig::check(item)) {
if (set_err) {
char msg[1024];
sprintf(msg, "in sequence element %d", (int)i);
SWIG_Error(SWIG_RuntimeError, msg);
}
return false;
}
}
return true;
}
private:
PyObject* _seq;
};
}
#define SWIG_From_double PyFloat_FromDouble
namespace swig {
template <> struct traits< double > {
typedef value_category category;
static const char* type_name() { return"double"; }
};
template <> struct traits_asval< double > {
typedef double value_type;
static int asval(PyObject *obj, value_type *val) {
return SWIG_AsVal_double (obj, val);
}
};
template <> struct traits_from< double > {
typedef double value_type;
static PyObject *from(const value_type& val) {
return SWIG_From_double (val);
}
};
}
namespace swig {
template
inline void
assign(const SwigPySeq& swigpyseq, Seq* seq) {
// seq->assign(swigpyseq.begin(), swigpyseq.end()); // not used as not always implemented
typedef typename SwigPySeq::value_type value_type;
typename SwigPySeq::const_iterator it = swigpyseq.begin();
for (;it != swigpyseq.end(); ++it) {
seq->insert(seq->end(),(value_type)(*it));
}
}
template
struct traits_asptr_stdseq {
typedef Seq sequence;
typedef T value_type;
static int asptr(PyObject *obj, sequence **seq) {
if (obj == Py_None || SWIG_Python_GetSwigThis(obj)) {
sequence *p;
if (::SWIG_ConvertPtr(obj,(void**)&p,
swig::type_info(),0) == SWIG_OK) {
if (seq) *seq = p;
return SWIG_OLDOBJ;
}
} else if (PySequence_Check(obj)) {
try {
SwigPySequence_Cont swigpyseq(obj);
if (seq) {
sequence *pseq = new sequence();
assign(swigpyseq, pseq);
*seq = pseq;
return SWIG_NEWOBJ;
} else {
return swigpyseq.check() ? SWIG_OK : SWIG_ERROR;
}
} catch (std::exception& e) {
if (seq) {
if (!PyErr_Occurred()) {
PyErr_SetString(PyExc_TypeError, e.what());
}
}
return SWIG_ERROR;
}
}
return SWIG_ERROR;
}
};
template
struct traits_from_stdseq {
typedef Seq sequence;
typedef T value_type;
typedef typename Seq::size_type size_type;
typedef typename sequence::const_iterator const_iterator;
static PyObject *from(const sequence& seq) {
#ifdef SWIG_PYTHON_EXTRA_NATIVE_CONTAINERS
swig_type_info *desc = swig::type_info();
if (desc && desc->clientdata) {
return SWIG_NewPointerObj(new sequence(seq), desc, SWIG_POINTER_OWN);
}
#endif
size_type size = seq.size();
if (size <= (size_type)INT_MAX) {
PyObject *obj = PyTuple_New((Py_ssize_t)size);
Py_ssize_t i = 0;
for (const_iterator it = seq.begin(); it != seq.end(); ++it, ++i) {
PyTuple_SetItem(obj,i,swig::from(*it));
}
return obj;
} else {
PyErr_SetString(PyExc_OverflowError,"sequence size not valid in python");
return NULL;
}
}
};
}
namespace swig {
template
struct traits_asptr > {
static int asptr(PyObject *obj, std::vector **vec) {
return traits_asptr_stdseq >::asptr(obj, vec);
}
};
template
struct traits_from > {
static PyObject *from(const std::vector& vec) {
return traits_from_stdseq >::from(vec);
}
};
}
namespace swig {
template <> struct traits > > {
typedef pointer_category category;
static const char* type_name() {
return "std::vector<" "double" "," "std::allocator< double >" " >";
}
};
}
SWIGINTERN swig::SwigPyIterator *std_vector_Sl_double_Sg__iterator(std::vector< double > *self,PyObject **PYTHON_SELF){
return swig::make_output_iterator(self->begin(), self->begin(), self->end(), *PYTHON_SELF);
}
SWIGINTERN bool std_vector_Sl_double_Sg____nonzero__(std::vector< double > const *self){
return !(self->empty());
}
SWIGINTERN bool std_vector_Sl_double_Sg____bool__(std::vector< double > const *self){
return !(self->empty());
}
SWIGINTERN std::vector< double >::size_type std_vector_Sl_double_Sg____len__(std::vector< double > const *self){
return self->size();
}
SWIGINTERNINLINE PyObject*
SWIG_From_unsigned_SS_long (unsigned long value)
{
return (value > LONG_MAX) ?
PyLong_FromUnsignedLong(value) : PyLong_FromLong(static_cast< long >(value));
}
SWIGINTERNINLINE PyObject *
SWIG_From_size_t (size_t value)
{
return SWIG_From_unsigned_SS_long (static_cast< unsigned long >(value));
}
SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg____getslice__(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){
return swig::getslice(self, i, j, 1);
}
SWIGINTERN void std_vector_Sl_double_Sg____setslice____SWIG_0(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){
swig::setslice(self, i, j, 1, std::vector< double,std::allocator< double > >());
}
SWIGINTERN void std_vector_Sl_double_Sg____setslice____SWIG_1(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j,std::vector< double,std::allocator< double > > const &v){
swig::setslice(self, i, j, 1, v);
}
SWIGINTERN void std_vector_Sl_double_Sg____delslice__(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::difference_type j){
swig::delslice(self, i, j, 1);
}
SWIGINTERN void std_vector_Sl_double_Sg____delitem____SWIG_0(std::vector< double > *self,std::vector< double >::difference_type i){
swig::erase(self, swig::getpos(self, i));
}
SWIGINTERN std::vector< double,std::allocator< double > > *std_vector_Sl_double_Sg____getitem____SWIG_0(std::vector< double > *self,PySliceObject *slice){
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected.");
return NULL;
}
PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
std::vector< double,std::allocator< double > >::difference_type id = i;
std::vector< double,std::allocator< double > >::difference_type jd = j;
return swig::getslice(self, id, jd, step);
}
SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_0(std::vector< double > *self,PySliceObject *slice,std::vector< double,std::allocator< double > > const &v){
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected.");
return;
}
PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
std::vector< double,std::allocator< double > >::difference_type id = i;
std::vector< double,std::allocator< double > >::difference_type jd = j;
swig::setslice(self, id, jd, step, v);
}
SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_1(std::vector< double > *self,PySliceObject *slice){
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected.");
return;
}
PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
std::vector< double,std::allocator< double > >::difference_type id = i;
std::vector< double,std::allocator< double > >::difference_type jd = j;
swig::delslice(self, id, jd, step);
}
SWIGINTERN void std_vector_Sl_double_Sg____delitem____SWIG_1(std::vector< double > *self,PySliceObject *slice){
Py_ssize_t i, j, step;
if( !PySlice_Check(slice) ) {
SWIG_Error(SWIG_TypeError, "Slice object expected.");
return;
}
PySlice_GetIndices(SWIGPY_SLICE_ARG(slice), (Py_ssize_t)self->size(), &i, &j, &step);
std::vector< double,std::allocator< double > >::difference_type id = i;
std::vector< double,std::allocator< double > >::difference_type jd = j;
swig::delslice(self, id, jd, step);
}
SWIGINTERN std::vector< double >::value_type const &std_vector_Sl_double_Sg____getitem____SWIG_1(std::vector< double > const *self,std::vector< double >::difference_type i){
return *(swig::cgetpos(self, i));
}
SWIGINTERN void std_vector_Sl_double_Sg____setitem____SWIG_2(std::vector< double > *self,std::vector< double >::difference_type i,std::vector< double >::value_type const &x){
*(swig::getpos(self,i)) = x;
}
SWIGINTERN std::vector< double >::value_type std_vector_Sl_double_Sg__pop(std::vector< double > *self){
if (self->size() == 0)
throw std::out_of_range("pop from empty container");
std::vector< double,std::allocator< double > >::value_type x = self->back();
self->pop_back();
return x;
}
SWIGINTERN void std_vector_Sl_double_Sg__append(std::vector< double > *self,std::vector< double >::value_type const &x){
self->push_back(x);
}
SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__erase__SWIG_0(std::vector< double > *self,std::vector< double >::iterator pos){ return self->erase(pos); }
SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__erase__SWIG_1(std::vector< double > *self,std::vector< double >::iterator first,std::vector< double >::iterator last){ return self->erase(first, last); }
SWIGINTERN std::vector< double >::iterator std_vector_Sl_double_Sg__insert__SWIG_0(std::vector< double > *self,std::vector< double >::iterator pos,std::vector< double >::value_type const &x){ return self->insert(pos, x); }
SWIGINTERN void std_vector_Sl_double_Sg__insert__SWIG_1(std::vector< double > *self,std::vector< double >::iterator pos,std::vector< double >::size_type n,std::vector< double >::value_type const &x){ self->insert(pos, n, x); }
#define SWIG_FILE_WITH_INIT
#include
#include
#include
#include
#include "polyiou.h"
#ifdef __cplusplus
extern "C" {
#endif
SWIGINTERN PyObject *_wrap_delete_SwigPyIterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:delete_SwigPyIterator",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_SwigPyIterator" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
delete arg1;
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_value(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
PyObject *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_value",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_value" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
try {
result = (PyObject *)((swig::SwigPyIterator const *)arg1)->value();
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = result;
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
size_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
size_t val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
swig::SwigPyIterator *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_incr",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_incr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
ecode2 = SWIG_AsVal_size_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_incr" "', argument " "2"" of type '" "size_t""'");
}
arg2 = static_cast< size_t >(val2);
try {
result = (swig::SwigPyIterator *)(arg1)->incr(arg2);
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_incr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
swig::SwigPyIterator *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_incr",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_incr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
try {
result = (swig::SwigPyIterator *)(arg1)->incr();
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_incr(PyObject *self, PyObject *args) {
Py_ssize_t argc;
PyObject *argv[3] = {
0
};
Py_ssize_t ii;
if (!PyTuple_Check(args)) SWIG_fail;
argc = args ? PyObject_Length(args) : 0;
for (ii = 0; (ii < 2) && (ii < argc); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_SwigPyIterator_incr__SWIG_1(self, args);
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_SwigPyIterator_incr__SWIG_0(self, args);
}
}
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SwigPyIterator_incr'.\n"
" Possible C/C++ prototypes are:\n"
" swig::SwigPyIterator::incr(size_t)\n"
" swig::SwigPyIterator::incr()\n");
return 0;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_decr__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
size_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
size_t val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
swig::SwigPyIterator *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_decr",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_decr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
ecode2 = SWIG_AsVal_size_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_decr" "', argument " "2"" of type '" "size_t""'");
}
arg2 = static_cast< size_t >(val2);
try {
result = (swig::SwigPyIterator *)(arg1)->decr(arg2);
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_decr__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
swig::SwigPyIterator *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_decr",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_decr" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
try {
result = (swig::SwigPyIterator *)(arg1)->decr();
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_decr(PyObject *self, PyObject *args) {
Py_ssize_t argc;
PyObject *argv[3] = {
0
};
Py_ssize_t ii;
if (!PyTuple_Check(args)) SWIG_fail;
argc = args ? PyObject_Length(args) : 0;
for (ii = 0; (ii < 2) && (ii < argc); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
if (argc == 1) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_SwigPyIterator_decr__SWIG_1(self, args);
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_SwigPyIterator_decr__SWIG_0(self, args);
}
}
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'SwigPyIterator_decr'.\n"
" Possible C/C++ prototypes are:\n"
" swig::SwigPyIterator::decr(size_t)\n"
" swig::SwigPyIterator::decr()\n");
return 0;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_distance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
swig::SwigPyIterator *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
ptrdiff_t result;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_distance",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_distance" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator_distance" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator_distance" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'");
}
arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
try {
result = ((swig::SwigPyIterator const *)arg1)->distance((swig::SwigPyIterator const &)*arg2);
}
catch(std::invalid_argument &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new std::invalid_argument(static_cast< const std::invalid_argument& >(_e))),SWIGTYPE_p_std__invalid_argument,SWIG_POINTER_OWN), "std::invalid_argument", SWIGTYPE_p_std__invalid_argument); SWIG_fail;
}
resultobj = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_equal(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
swig::SwigPyIterator *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_equal",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_equal" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator_equal" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator_equal" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'");
}
arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
try {
result = (bool)((swig::SwigPyIterator const *)arg1)->equal((swig::SwigPyIterator const &)*arg2);
}
catch(std::invalid_argument &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new std::invalid_argument(static_cast< const std::invalid_argument& >(_e))),SWIGTYPE_p_std__invalid_argument,SWIG_POINTER_OWN), "std::invalid_argument", SWIGTYPE_p_std__invalid_argument); SWIG_fail;
}
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_copy(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
swig::SwigPyIterator *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_copy",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_copy" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->copy();
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_next(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
PyObject *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_next",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_next" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
try {
result = (PyObject *)(arg1)->next();
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = result;
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator___next__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
PyObject *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator___next__",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___next__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
try {
result = (PyObject *)(arg1)->__next__();
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = result;
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_previous(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
PyObject *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:SwigPyIterator_previous",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_previous" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
try {
result = (PyObject *)(arg1)->previous();
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = result;
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator_advance(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
ptrdiff_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
swig::SwigPyIterator *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator_advance",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator_advance" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator_advance" "', argument " "2"" of type '" "ptrdiff_t""'");
}
arg2 = static_cast< ptrdiff_t >(val2);
try {
result = (swig::SwigPyIterator *)(arg1)->advance(arg2);
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator___eq__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
swig::SwigPyIterator *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___eq__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___eq__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___eq__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___eq__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'");
}
arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
result = (bool)((swig::SwigPyIterator const *)arg1)->operator ==((swig::SwigPyIterator const &)*arg2);
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator___ne__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
swig::SwigPyIterator *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___ne__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___ne__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___ne__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___ne__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'");
}
arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
result = (bool)((swig::SwigPyIterator const *)arg1)->operator !=((swig::SwigPyIterator const &)*arg2);
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator___iadd__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
ptrdiff_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
swig::SwigPyIterator *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___iadd__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___iadd__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___iadd__" "', argument " "2"" of type '" "ptrdiff_t""'");
}
arg2 = static_cast< ptrdiff_t >(val2);
try {
result = (swig::SwigPyIterator *) &(arg1)->operator +=(arg2);
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator___isub__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
ptrdiff_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
swig::SwigPyIterator *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___isub__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_DISOWN | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___isub__" "', argument " "1"" of type '" "swig::SwigPyIterator *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___isub__" "', argument " "2"" of type '" "ptrdiff_t""'");
}
arg2 = static_cast< ptrdiff_t >(val2);
try {
result = (swig::SwigPyIterator *) &(arg1)->operator -=(arg2);
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator___add__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
ptrdiff_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
swig::SwigPyIterator *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___add__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___add__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___add__" "', argument " "2"" of type '" "ptrdiff_t""'");
}
arg2 = static_cast< ptrdiff_t >(val2);
try {
result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->operator +(arg2);
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator___sub____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
ptrdiff_t arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
swig::SwigPyIterator *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___sub__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___sub__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "ptrdiff_t""'");
}
arg2 = static_cast< ptrdiff_t >(val2);
try {
result = (swig::SwigPyIterator *)((swig::SwigPyIterator const *)arg1)->operator -(arg2);
}
catch(swig::stop_iteration &_e) {
{
(void)_e;
SWIG_SetErrorObj(PyExc_StopIteration, SWIG_Py_Void());
SWIG_fail;
}
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator___sub____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
swig::SwigPyIterator *arg1 = (swig::SwigPyIterator *) 0 ;
swig::SwigPyIterator *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
ptrdiff_t result;
if (!PyArg_ParseTuple(args,(char *)"OO:SwigPyIterator___sub__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_swig__SwigPyIterator, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "SwigPyIterator___sub__" "', argument " "1"" of type '" "swig::SwigPyIterator const *""'");
}
arg1 = reinterpret_cast< swig::SwigPyIterator * >(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_swig__SwigPyIterator, 0 | 0);
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "SwigPyIterator___sub__" "', argument " "2"" of type '" "swig::SwigPyIterator const &""'");
}
arg2 = reinterpret_cast< swig::SwigPyIterator * >(argp2);
result = ((swig::SwigPyIterator const *)arg1)->operator -((swig::SwigPyIterator const &)*arg2);
resultobj = SWIG_From_ptrdiff_t(static_cast< ptrdiff_t >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_SwigPyIterator___sub__(PyObject *self, PyObject *args) {
Py_ssize_t argc;
PyObject *argv[3] = {
0
};
Py_ssize_t ii;
if (!PyTuple_Check(args)) SWIG_fail;
argc = args ? PyObject_Length(args) : 0;
for (ii = 0; (ii < 2) && (ii < argc); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
_v = SWIG_CheckState(res);
if (_v) {
int res = SWIG_ConvertPtr(argv[1], 0, SWIGTYPE_p_swig__SwigPyIterator, 0);
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_SwigPyIterator___sub____SWIG_1(self, args);
}
}
}
if (argc == 2) {
int _v;
void *vptr = 0;
int res = SWIG_ConvertPtr(argv[0], &vptr, SWIGTYPE_p_swig__SwigPyIterator, 0);
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_SwigPyIterator___sub____SWIG_0(self, args);
}
}
}
fail:
Py_INCREF(Py_NotImplemented);
return Py_NotImplemented;
}
SWIGINTERN PyObject *SwigPyIterator_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
SWIG_TypeNewClientData(SWIGTYPE_p_swig__SwigPyIterator, SWIG_NewClientData(obj));
return SWIG_Py_Void();
}
SWIGINTERN PyObject *_wrap_VectorDouble_iterator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
PyObject **arg2 = (PyObject **) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
swig::SwigPyIterator *result = 0 ;
arg2 = &obj0;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_iterator",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_iterator" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = (swig::SwigPyIterator *)std_vector_Sl_double_Sg__iterator(arg1,arg2);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_swig__SwigPyIterator, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___nonzero__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble___nonzero__",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___nonzero__" "', argument " "1"" of type '" "std::vector< double > const *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = (bool)std_vector_Sl_double_Sg____nonzero__((std::vector< double > const *)arg1);
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___bool__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble___bool__",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___bool__" "', argument " "1"" of type '" "std::vector< double > const *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = (bool)std_vector_Sl_double_Sg____bool__((std::vector< double > const *)arg1);
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___len__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
std::vector< double >::size_type result;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble___len__",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___len__" "', argument " "1"" of type '" "std::vector< double > const *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = std_vector_Sl_double_Sg____len__((std::vector< double > const *)arg1);
resultobj = SWIG_From_size_t(static_cast< size_t >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___getslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::difference_type arg2 ;
std::vector< double >::difference_type arg3 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
ptrdiff_t val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
std::vector< double,std::allocator< double > > *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOO:VectorDouble___getslice__",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___getslice__" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble___getslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
}
arg2 = static_cast< std::vector< double >::difference_type >(val2);
ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorDouble___getslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'");
}
arg3 = static_cast< std::vector< double >::difference_type >(val3);
try {
result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg____getslice__(arg1,arg2,arg3);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
catch(std::invalid_argument &_e) {
SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___setslice____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::difference_type arg2 ;
std::vector< double >::difference_type arg3 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
ptrdiff_t val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOO:VectorDouble___setslice__",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___setslice__" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble___setslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
}
arg2 = static_cast< std::vector< double >::difference_type >(val2);
ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorDouble___setslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'");
}
arg3 = static_cast< std::vector< double >::difference_type >(val3);
try {
std_vector_Sl_double_Sg____setslice____SWIG_0(arg1,arg2,arg3);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
catch(std::invalid_argument &_e) {
SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
}
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___setslice____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::difference_type arg2 ;
std::vector< double >::difference_type arg3 ;
std::vector< double,std::allocator< double > > *arg4 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
ptrdiff_t val3 ;
int ecode3 = 0 ;
int res4 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
PyObject * obj3 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOOO:VectorDouble___setslice__",&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___setslice__" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble___setslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
}
arg2 = static_cast< std::vector< double >::difference_type >(val2);
ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorDouble___setslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'");
}
arg3 = static_cast< std::vector< double >::difference_type >(val3);
{
std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0;
res4 = swig::asptr(obj3, &ptr);
if (!SWIG_IsOK(res4)) {
SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "VectorDouble___setslice__" "', argument " "4"" of type '" "std::vector< double,std::allocator< double > > const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorDouble___setslice__" "', argument " "4"" of type '" "std::vector< double,std::allocator< double > > const &""'");
}
arg4 = ptr;
}
try {
std_vector_Sl_double_Sg____setslice____SWIG_1(arg1,arg2,arg3,(std::vector< double,std::allocator< double > > const &)*arg4);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
catch(std::invalid_argument &_e) {
SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
}
resultobj = SWIG_Py_Void();
if (SWIG_IsNewObj(res4)) delete arg4;
return resultobj;
fail:
if (SWIG_IsNewObj(res4)) delete arg4;
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___setslice__(PyObject *self, PyObject *args) {
Py_ssize_t argc;
PyObject *argv[5] = {
0
};
Py_ssize_t ii;
if (!PyTuple_Check(args)) SWIG_fail;
argc = args ? PyObject_Length(args) : 0;
for (ii = 0; (ii < 4) && (ii < argc); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
if (argc == 3) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_VectorDouble___setslice____SWIG_0(self, args);
}
}
}
}
if (argc == 4) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_ptrdiff_t(argv[2], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
int res = swig::asptr(argv[3], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_VectorDouble___setslice____SWIG_1(self, args);
}
}
}
}
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorDouble___setslice__'.\n"
" Possible C/C++ prototypes are:\n"
" std::vector< double >::__setslice__(std::vector< double >::difference_type,std::vector< double >::difference_type)\n"
" std::vector< double >::__setslice__(std::vector< double >::difference_type,std::vector< double >::difference_type,std::vector< double,std::allocator< double > > const &)\n");
return 0;
}
SWIGINTERN PyObject *_wrap_VectorDouble___delslice__(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::difference_type arg2 ;
std::vector< double >::difference_type arg3 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
ptrdiff_t val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOO:VectorDouble___delslice__",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___delslice__" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble___delslice__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
}
arg2 = static_cast< std::vector< double >::difference_type >(val2);
ecode3 = SWIG_AsVal_ptrdiff_t(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorDouble___delslice__" "', argument " "3"" of type '" "std::vector< double >::difference_type""'");
}
arg3 = static_cast< std::vector< double >::difference_type >(val3);
try {
std_vector_Sl_double_Sg____delslice__(arg1,arg2,arg3);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
catch(std::invalid_argument &_e) {
SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
}
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___delitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::difference_type arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:VectorDouble___delitem__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___delitem__" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble___delitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
}
arg2 = static_cast< std::vector< double >::difference_type >(val2);
try {
std_vector_Sl_double_Sg____delitem____SWIG_0(arg1,arg2);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
catch(std::invalid_argument &_e) {
SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
}
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___getitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
PySliceObject *arg2 = (PySliceObject *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
std::vector< double,std::allocator< double > > *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:VectorDouble___getitem__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___getitem__" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
{
if (!PySlice_Check(obj1)) {
SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorDouble___getitem__" "', argument " "2"" of type '" "PySliceObject *""'");
}
arg2 = (PySliceObject *) obj1;
}
try {
result = (std::vector< double,std::allocator< double > > *)std_vector_Sl_double_Sg____getitem____SWIG_0(arg1,arg2);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
catch(std::invalid_argument &_e) {
SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
}
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___setitem____SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
PySliceObject *arg2 = (PySliceObject *) 0 ;
std::vector< double,std::allocator< double > > *arg3 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
int res3 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOO:VectorDouble___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
{
if (!PySlice_Check(obj1)) {
SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorDouble___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
}
arg2 = (PySliceObject *) obj1;
}
{
std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0;
res3 = swig::asptr(obj2, &ptr);
if (!SWIG_IsOK(res3)) {
SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "VectorDouble___setitem__" "', argument " "3"" of type '" "std::vector< double,std::allocator< double > > const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorDouble___setitem__" "', argument " "3"" of type '" "std::vector< double,std::allocator< double > > const &""'");
}
arg3 = ptr;
}
try {
std_vector_Sl_double_Sg____setitem____SWIG_0(arg1,arg2,(std::vector< double,std::allocator< double > > const &)*arg3);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
catch(std::invalid_argument &_e) {
SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
}
resultobj = SWIG_Py_Void();
if (SWIG_IsNewObj(res3)) delete arg3;
return resultobj;
fail:
if (SWIG_IsNewObj(res3)) delete arg3;
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___setitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
PySliceObject *arg2 = (PySliceObject *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:VectorDouble___setitem__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
{
if (!PySlice_Check(obj1)) {
SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorDouble___setitem__" "', argument " "2"" of type '" "PySliceObject *""'");
}
arg2 = (PySliceObject *) obj1;
}
try {
std_vector_Sl_double_Sg____setitem____SWIG_1(arg1,arg2);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
catch(std::invalid_argument &_e) {
SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
}
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___delitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
PySliceObject *arg2 = (PySliceObject *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:VectorDouble___delitem__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___delitem__" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
{
if (!PySlice_Check(obj1)) {
SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorDouble___delitem__" "', argument " "2"" of type '" "PySliceObject *""'");
}
arg2 = (PySliceObject *) obj1;
}
try {
std_vector_Sl_double_Sg____delitem____SWIG_1(arg1,arg2);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
catch(std::invalid_argument &_e) {
SWIG_exception_fail(SWIG_ValueError, (&_e)->what());
}
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___delitem__(PyObject *self, PyObject *args) {
Py_ssize_t argc;
PyObject *argv[3] = {
0
};
Py_ssize_t ii;
if (!PyTuple_Check(args)) SWIG_fail;
argc = args ? PyObject_Length(args) : 0;
for (ii = 0; (ii < 2) && (ii < argc); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
if (argc == 2) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
_v = PySlice_Check(argv[1]);
}
if (_v) {
return _wrap_VectorDouble___delitem____SWIG_1(self, args);
}
}
}
if (argc == 2) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_VectorDouble___delitem____SWIG_0(self, args);
}
}
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorDouble___delitem__'.\n"
" Possible C/C++ prototypes are:\n"
" std::vector< double >::__delitem__(std::vector< double >::difference_type)\n"
" std::vector< double >::__delitem__(PySliceObject *)\n");
return 0;
}
SWIGINTERN PyObject *_wrap_VectorDouble___getitem____SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::difference_type arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
std::vector< double >::value_type *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:VectorDouble___getitem__",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___getitem__" "', argument " "1"" of type '" "std::vector< double > const *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble___getitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
}
arg2 = static_cast< std::vector< double >::difference_type >(val2);
try {
result = (std::vector< double >::value_type *) &std_vector_Sl_double_Sg____getitem____SWIG_1((std::vector< double > const *)arg1,arg2);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
resultobj = SWIG_From_double(static_cast< double >(*result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___getitem__(PyObject *self, PyObject *args) {
Py_ssize_t argc;
PyObject *argv[3] = {
0
};
Py_ssize_t ii;
if (!PyTuple_Check(args)) SWIG_fail;
argc = args ? PyObject_Length(args) : 0;
for (ii = 0; (ii < 2) && (ii < argc); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
if (argc == 2) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
_v = PySlice_Check(argv[1]);
}
if (_v) {
return _wrap_VectorDouble___getitem____SWIG_0(self, args);
}
}
}
if (argc == 2) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_VectorDouble___getitem____SWIG_1(self, args);
}
}
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorDouble___getitem__'.\n"
" Possible C/C++ prototypes are:\n"
" std::vector< double >::__getitem__(PySliceObject *)\n"
" std::vector< double >::__getitem__(std::vector< double >::difference_type) const\n");
return 0;
}
SWIGINTERN PyObject *_wrap_VectorDouble___setitem____SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::difference_type arg2 ;
std::vector< double >::value_type *arg3 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
ptrdiff_t val2 ;
int ecode2 = 0 ;
std::vector< double >::value_type temp3 ;
double val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOO:VectorDouble___setitem__",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble___setitem__" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_ptrdiff_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble___setitem__" "', argument " "2"" of type '" "std::vector< double >::difference_type""'");
}
arg2 = static_cast< std::vector< double >::difference_type >(val2);
ecode3 = SWIG_AsVal_double(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorDouble___setitem__" "', argument " "3"" of type '" "std::vector< double >::value_type""'");
}
temp3 = static_cast< std::vector< double >::value_type >(val3);
arg3 = &temp3;
try {
std_vector_Sl_double_Sg____setitem____SWIG_2(arg1,arg2,(double const &)*arg3);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble___setitem__(PyObject *self, PyObject *args) {
Py_ssize_t argc;
PyObject *argv[4] = {
0
};
Py_ssize_t ii;
if (!PyTuple_Check(args)) SWIG_fail;
argc = args ? PyObject_Length(args) : 0;
for (ii = 0; (ii < 3) && (ii < argc); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
if (argc == 2) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
_v = PySlice_Check(argv[1]);
}
if (_v) {
return _wrap_VectorDouble___setitem____SWIG_1(self, args);
}
}
}
if (argc == 3) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
_v = PySlice_Check(argv[1]);
}
if (_v) {
int res = swig::asptr(argv[2], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_VectorDouble___setitem____SWIG_0(self, args);
}
}
}
}
if (argc == 3) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_ptrdiff_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_double(argv[2], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_VectorDouble___setitem____SWIG_2(self, args);
}
}
}
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorDouble___setitem__'.\n"
" Possible C/C++ prototypes are:\n"
" std::vector< double >::__setitem__(PySliceObject *,std::vector< double,std::allocator< double > > const &)\n"
" std::vector< double >::__setitem__(PySliceObject *)\n"
" std::vector< double >::__setitem__(std::vector< double >::difference_type,std::vector< double >::value_type const &)\n");
return 0;
}
SWIGINTERN PyObject *_wrap_VectorDouble_pop(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
std::vector< double >::value_type result;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_pop",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_pop" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
try {
result = (std::vector< double >::value_type)std_vector_Sl_double_Sg__pop(arg1);
}
catch(std::out_of_range &_e) {
SWIG_exception_fail(SWIG_IndexError, (&_e)->what());
}
resultobj = SWIG_From_double(static_cast< double >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_append(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::value_type *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
std::vector< double >::value_type temp2 ;
double val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:VectorDouble_append",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_append" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_double(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble_append" "', argument " "2"" of type '" "std::vector< double >::value_type""'");
}
temp2 = static_cast< std::vector< double >::value_type >(val2);
arg2 = &temp2;
std_vector_Sl_double_Sg__append(arg1,(double const &)*arg2);
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_new_VectorDouble__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)":new_VectorDouble")) SWIG_fail;
result = (std::vector< double > *)new std::vector< double >();
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_new_VectorDouble__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = 0 ;
int res1 = SWIG_OLDOBJ ;
PyObject * obj0 = 0 ;
std::vector< double > *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_VectorDouble",&obj0)) SWIG_fail;
{
std::vector< double,std::allocator< double > > *ptr = (std::vector< double,std::allocator< double > > *)0;
res1 = swig::asptr(obj0, &ptr);
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_VectorDouble" "', argument " "1"" of type '" "std::vector< double > const &""'");
}
if (!ptr) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "new_VectorDouble" "', argument " "1"" of type '" "std::vector< double > const &""'");
}
arg1 = ptr;
}
result = (std::vector< double > *)new std::vector< double >((std::vector< double > const &)*arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 );
if (SWIG_IsNewObj(res1)) delete arg1;
return resultobj;
fail:
if (SWIG_IsNewObj(res1)) delete arg1;
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_empty(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
bool result;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_empty",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_empty" "', argument " "1"" of type '" "std::vector< double > const *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = (bool)((std::vector< double > const *)arg1)->empty();
resultobj = SWIG_From_bool(static_cast< bool >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_size(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
std::vector< double >::size_type result;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_size",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_size" "', argument " "1"" of type '" "std::vector< double > const *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = ((std::vector< double > const *)arg1)->size();
resultobj = SWIG_From_size_t(static_cast< size_t >(result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_swap(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double > *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
void *argp2 = 0 ;
int res2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:VectorDouble_swap",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_swap" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
res2 = SWIG_ConvertPtr(obj1, &argp2, SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 );
if (!SWIG_IsOK(res2)) {
SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "VectorDouble_swap" "', argument " "2"" of type '" "std::vector< double > &""'");
}
if (!argp2) {
SWIG_exception_fail(SWIG_ValueError, "invalid null reference " "in method '" "VectorDouble_swap" "', argument " "2"" of type '" "std::vector< double > &""'");
}
arg2 = reinterpret_cast< std::vector< double > * >(argp2);
(arg1)->swap(*arg2);
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_begin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
std::vector< double >::iterator result;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_begin",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_begin" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = (arg1)->begin();
resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_end(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
std::vector< double >::iterator result;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_end",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_end" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = (arg1)->end();
resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_rbegin(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
std::vector< double >::reverse_iterator result;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_rbegin",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_rbegin" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = (arg1)->rbegin();
resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::reverse_iterator & >(result)),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_rend(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
std::vector< double >::reverse_iterator result;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_rend",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_rend" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = (arg1)->rend();
resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::reverse_iterator & >(result)),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_clear(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_clear",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_clear" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
(arg1)->clear();
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_get_allocator(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
SwigValueWrapper< std::allocator< double > > result;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_get_allocator",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_get_allocator" "', argument " "1"" of type '" "std::vector< double > const *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = ((std::vector< double > const *)arg1)->get_allocator();
resultobj = SWIG_NewPointerObj((new std::vector< double >::allocator_type(static_cast< const std::vector< double >::allocator_type& >(result))), SWIGTYPE_p_std__allocatorT_double_t, SWIG_POINTER_OWN | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_new_VectorDouble__SWIG_2(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double >::size_type arg1 ;
size_t val1 ;
int ecode1 = 0 ;
PyObject * obj0 = 0 ;
std::vector< double > *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:new_VectorDouble",&obj0)) SWIG_fail;
ecode1 = SWIG_AsVal_size_t(obj0, &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_VectorDouble" "', argument " "1"" of type '" "std::vector< double >::size_type""'");
}
arg1 = static_cast< std::vector< double >::size_type >(val1);
result = (std::vector< double > *)new std::vector< double >(arg1);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_pop_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_pop_back",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_pop_back" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
(arg1)->pop_back();
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_resize__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::size_type arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
size_t val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:VectorDouble_resize",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_resize" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_size_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble_resize" "', argument " "2"" of type '" "std::vector< double >::size_type""'");
}
arg2 = static_cast< std::vector< double >::size_type >(val2);
(arg1)->resize(arg2);
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_erase__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::iterator arg2 ;
void *argp1 = 0 ;
int res1 = 0 ;
swig::SwigPyIterator *iter2 = 0 ;
int res2 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
std::vector< double >::iterator result;
if (!PyArg_ParseTuple(args,(char *)"OO:VectorDouble_erase",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_erase" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
if (!SWIG_IsOK(res2) || !iter2) {
SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorDouble_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
} else {
swig::SwigPyIterator_T::iterator > *iter_t = dynamic_cast::iterator > *>(iter2);
if (iter_t) {
arg2 = iter_t->get_current();
} else {
SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorDouble_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
}
}
result = std_vector_Sl_double_Sg__erase__SWIG_0(arg1,arg2);
resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_erase__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::iterator arg2 ;
std::vector< double >::iterator arg3 ;
void *argp1 = 0 ;
int res1 = 0 ;
swig::SwigPyIterator *iter2 = 0 ;
int res2 ;
swig::SwigPyIterator *iter3 = 0 ;
int res3 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
std::vector< double >::iterator result;
if (!PyArg_ParseTuple(args,(char *)"OOO:VectorDouble_erase",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_erase" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
if (!SWIG_IsOK(res2) || !iter2) {
SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorDouble_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
} else {
swig::SwigPyIterator_T::iterator > *iter_t = dynamic_cast::iterator > *>(iter2);
if (iter_t) {
arg2 = iter_t->get_current();
} else {
SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorDouble_erase" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
}
}
res3 = SWIG_ConvertPtr(obj2, SWIG_as_voidptrptr(&iter3), swig::SwigPyIterator::descriptor(), 0);
if (!SWIG_IsOK(res3) || !iter3) {
SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorDouble_erase" "', argument " "3"" of type '" "std::vector< double >::iterator""'");
} else {
swig::SwigPyIterator_T::iterator > *iter_t = dynamic_cast::iterator > *>(iter3);
if (iter_t) {
arg3 = iter_t->get_current();
} else {
SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorDouble_erase" "', argument " "3"" of type '" "std::vector< double >::iterator""'");
}
}
result = std_vector_Sl_double_Sg__erase__SWIG_1(arg1,arg2,arg3);
resultobj = SWIG_NewPointerObj(swig::make_output_iterator(static_cast< const std::vector< double >::iterator & >(result)),
swig::SwigPyIterator::descriptor(),SWIG_POINTER_OWN);
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_erase(PyObject *self, PyObject *args) {
Py_ssize_t argc;
PyObject *argv[4] = {
0
};
Py_ssize_t ii;
if (!PyTuple_Check(args)) SWIG_fail;
argc = args ? PyObject_Length(args) : 0;
for (ii = 0; (ii < 3) && (ii < argc); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
if (argc == 2) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
swig::SwigPyIterator *iter = 0;
int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
_v = (SWIG_IsOK(res) && iter && (dynamic_cast::iterator > *>(iter) != 0));
if (_v) {
return _wrap_VectorDouble_erase__SWIG_0(self, args);
}
}
}
if (argc == 3) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
swig::SwigPyIterator *iter = 0;
int res = SWIG_ConvertPtr(argv[1], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
_v = (SWIG_IsOK(res) && iter && (dynamic_cast::iterator > *>(iter) != 0));
if (_v) {
swig::SwigPyIterator *iter = 0;
int res = SWIG_ConvertPtr(argv[2], SWIG_as_voidptrptr(&iter), swig::SwigPyIterator::descriptor(), 0);
_v = (SWIG_IsOK(res) && iter && (dynamic_cast::iterator > *>(iter) != 0));
if (_v) {
return _wrap_VectorDouble_erase__SWIG_1(self, args);
}
}
}
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorDouble_erase'.\n"
" Possible C/C++ prototypes are:\n"
" std::vector< double >::erase(std::vector< double >::iterator)\n"
" std::vector< double >::erase(std::vector< double >::iterator,std::vector< double >::iterator)\n");
return 0;
}
SWIGINTERN PyObject *_wrap_new_VectorDouble__SWIG_3(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double >::size_type arg1 ;
std::vector< double >::value_type *arg2 = 0 ;
size_t val1 ;
int ecode1 = 0 ;
std::vector< double >::value_type temp2 ;
double val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
std::vector< double > *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:new_VectorDouble",&obj0,&obj1)) SWIG_fail;
ecode1 = SWIG_AsVal_size_t(obj0, &val1);
if (!SWIG_IsOK(ecode1)) {
SWIG_exception_fail(SWIG_ArgError(ecode1), "in method '" "new_VectorDouble" "', argument " "1"" of type '" "std::vector< double >::size_type""'");
}
arg1 = static_cast< std::vector< double >::size_type >(val1);
ecode2 = SWIG_AsVal_double(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "new_VectorDouble" "', argument " "2"" of type '" "std::vector< double >::value_type""'");
}
temp2 = static_cast< std::vector< double >::value_type >(val2);
arg2 = &temp2;
result = (std::vector< double > *)new std::vector< double >(arg1,(std::vector< double >::value_type const &)*arg2);
resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, SWIG_POINTER_NEW | 0 );
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_new_VectorDouble(PyObject *self, PyObject *args) {
Py_ssize_t argc;
PyObject *argv[3] = {
0
};
Py_ssize_t ii;
if (!PyTuple_Check(args)) SWIG_fail;
argc = args ? PyObject_Length(args) : 0;
for (ii = 0; (ii < 2) && (ii < argc); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
if (argc == 0) {
return _wrap_new_VectorDouble__SWIG_0(self, args);
}
if (argc == 1) {
int _v;
{
int res = SWIG_AsVal_size_t(argv[0], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_new_VectorDouble__SWIG_2(self, args);
}
}
if (argc == 1) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
return _wrap_new_VectorDouble__SWIG_1(self, args);
}
}
if (argc == 2) {
int _v;
{
int res = SWIG_AsVal_size_t(argv[0], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_double(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_new_VectorDouble__SWIG_3(self, args);
}
}
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'new_VectorDouble'.\n"
" Possible C/C++ prototypes are:\n"
" std::vector< double >::vector()\n"
" std::vector< double >::vector(std::vector< double > const &)\n"
" std::vector< double >::vector(std::vector< double >::size_type)\n"
" std::vector< double >::vector(std::vector< double >::size_type,std::vector< double >::value_type const &)\n");
return 0;
}
SWIGINTERN PyObject *_wrap_VectorDouble_push_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::value_type *arg2 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
std::vector< double >::value_type temp2 ;
double val2 ;
int ecode2 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OO:VectorDouble_push_back",&obj0,&obj1)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_push_back" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_double(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble_push_back" "', argument " "2"" of type '" "std::vector< double >::value_type""'");
}
temp2 = static_cast< std::vector< double >::value_type >(val2);
arg2 = &temp2;
(arg1)->push_back((std::vector< double >::value_type const &)*arg2);
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_front(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
std::vector< double >::value_type *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_front",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_front" "', argument " "1"" of type '" "std::vector< double > const *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = (std::vector< double >::value_type *) &((std::vector< double > const *)arg1)->front();
resultobj = SWIG_From_double(static_cast< double >(*result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_back(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
std::vector< double >::value_type *result = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:VectorDouble_back",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_back" "', argument " "1"" of type '" "std::vector< double > const *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
result = (std::vector< double >::value_type *) &((std::vector< double > const *)arg1)->back();
resultobj = SWIG_From_double(static_cast< double >(*result));
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_assign(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::size_type arg2 ;
std::vector< double >::value_type *arg3 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
size_t val2 ;
int ecode2 = 0 ;
std::vector< double >::value_type temp3 ;
double val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOO:VectorDouble_assign",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_assign" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_size_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble_assign" "', argument " "2"" of type '" "std::vector< double >::size_type""'");
}
arg2 = static_cast< std::vector< double >::size_type >(val2);
ecode3 = SWIG_AsVal_double(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorDouble_assign" "', argument " "3"" of type '" "std::vector< double >::value_type""'");
}
temp3 = static_cast< std::vector< double >::value_type >(val3);
arg3 = &temp3;
(arg1)->assign(arg2,(std::vector< double >::value_type const &)*arg3);
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_resize__SWIG_1(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::size_type arg2 ;
std::vector< double >::value_type *arg3 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
size_t val2 ;
int ecode2 = 0 ;
std::vector< double >::value_type temp3 ;
double val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"OOO:VectorDouble_resize",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_resize" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
ecode2 = SWIG_AsVal_size_t(obj1, &val2);
if (!SWIG_IsOK(ecode2)) {
SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "VectorDouble_resize" "', argument " "2"" of type '" "std::vector< double >::size_type""'");
}
arg2 = static_cast< std::vector< double >::size_type >(val2);
ecode3 = SWIG_AsVal_double(obj2, &val3);
if (!SWIG_IsOK(ecode3)) {
SWIG_exception_fail(SWIG_ArgError(ecode3), "in method '" "VectorDouble_resize" "', argument " "3"" of type '" "std::vector< double >::value_type""'");
}
temp3 = static_cast< std::vector< double >::value_type >(val3);
arg3 = &temp3;
(arg1)->resize(arg2,(std::vector< double >::value_type const &)*arg3);
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *_wrap_VectorDouble_resize(PyObject *self, PyObject *args) {
Py_ssize_t argc;
PyObject *argv[4] = {
0
};
Py_ssize_t ii;
if (!PyTuple_Check(args)) SWIG_fail;
argc = args ? PyObject_Length(args) : 0;
for (ii = 0; (ii < 3) && (ii < argc); ii++) {
argv[ii] = PyTuple_GET_ITEM(args,ii);
}
if (argc == 2) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_VectorDouble_resize__SWIG_0(self, args);
}
}
}
if (argc == 3) {
int _v;
int res = swig::asptr(argv[0], (std::vector< double,std::allocator< double > >**)(0));
_v = SWIG_CheckState(res);
if (_v) {
{
int res = SWIG_AsVal_size_t(argv[1], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
{
int res = SWIG_AsVal_double(argv[2], NULL);
_v = SWIG_CheckState(res);
}
if (_v) {
return _wrap_VectorDouble_resize__SWIG_1(self, args);
}
}
}
}
fail:
SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number or type of arguments for overloaded function 'VectorDouble_resize'.\n"
" Possible C/C++ prototypes are:\n"
" std::vector< double >::resize(std::vector< double >::size_type)\n"
" std::vector< double >::resize(std::vector< double >::size_type,std::vector< double >::value_type const &)\n");
return 0;
}
SWIGINTERN PyObject *_wrap_VectorDouble_insert__SWIG_0(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
std::vector< double > *arg1 = (std::vector< double > *) 0 ;
std::vector< double >::iterator arg2 ;
std::vector< double >::value_type *arg3 = 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
swig::SwigPyIterator *iter2 = 0 ;
int res2 ;
std::vector< double >::value_type temp3 ;
double val3 ;
int ecode3 = 0 ;
PyObject * obj0 = 0 ;
PyObject * obj1 = 0 ;
PyObject * obj2 = 0 ;
std::vector< double >::iterator result;
if (!PyArg_ParseTuple(args,(char *)"OOO:VectorDouble_insert",&obj0,&obj1,&obj2)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_std__vectorT_double_std__allocatorT_double_t_t, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "VectorDouble_insert" "', argument " "1"" of type '" "std::vector< double > *""'");
}
arg1 = reinterpret_cast< std::vector< double > * >(argp1);
res2 = SWIG_ConvertPtr(obj1, SWIG_as_voidptrptr(&iter2), swig::SwigPyIterator::descriptor(), 0);
if (!SWIG_IsOK(res2) || !iter2) {
SWIG_exception_fail(SWIG_ArgError(SWIG_TypeError), "in method '" "VectorDouble_insert" "', argument " "2"" of type '" "std::vector< double >::iterator""'");
} else {
swig::SwigPyIterator_T::iterator > *iter_t = dynamic_cast