"green" : ( 0, 255, 0),
"blue" : (255, 0 , 0)}
+def range(s):
+ try:
+ lb, rb = map(int, s.split(','))
+ return lb, rb
+ except:
+ raise argparse.ArgumentTypeError("Must be lb, rb")
+
def call_parser(f, a):
return eval( "sft.parse_" + f + "('" + a + "')")
parser.add_argument("-o", "--output", dest = "output", type = str, metavar= "path", help = "Path to store resultiong image.", default = "./roc.png")
parser.add_argument("-n", "--nscales", dest = "nscales", type = int, metavar= "n", help = "Prefered count of scales from min to max.", default = 55)
+ parser.add_argument("-r", "--scale-range", dest = "scale_range", type = range, default = (128 * 0.4, 128 * 2.4))
+ parser.add_argument("-e", "--extended-range-ratio", dest = "ext_ratio", type = float, default = 1.25)
+
# required
parser.add_argument("-f", "--anttn-format", dest = "anttn_format", choices = ['inria', 'caltech', "idl"], help = "Annotation file for test sequence.", required = True)
args = parser.parse_args()
+ print args.scale_range
+
print args.cascade
# # parse annotations
sft.initPlot()
boxes = samples[tail]
boxes = sft.norm_acpect_ratio(boxes, 0.5)
+ boxes = [b for b in boxes if (b[3] - b[1]) > args.scale_range[0] / args.ext_ratio]
+ boxes = [b for b in boxes if (b[3] - b[1]) < args.scale_range[1] * args.ext_ratio]
nannotated = nannotated + len(boxes)
nframes = nframes + 1
"""Show resulted plot"""
def showPlot(file_name):
- # plt.savefig(file_name)
+ plt.savefig(file_name)
plt.axis((pow(10, -3), pow(10, 1), 0.0, 1))
plt.yticks( [0.05, 0.1, 0.2, 0.3, 0.4, 0.5, 0.64, 0.8, 1], ['.05', '.10', '.20', '.30', '.40', '.50', '.64', '.80', '1'] )
plt.show()
def match(gts, dts):
- # Cartesian product for each detection BB_dt with each BB_gt
- overlaps = [[dt.overlap(gt) for gt in gts]for dt in dts]
-
matches_gt = [0]*len(gts)
matches_dt = [0]*len(dts)
matches_ignore = [0]*len(dts)
+ if len(gts) == 0:
+ return matches_dt, matches_ignore
+
+ # Cartesian product for each detection BB_dt with each BB_gt
+ overlaps = [[dt.overlap(gt) for gt in gts]for dt in dts]
+
for idx, row in enumerate(overlaps):
imax = row.index(max(row))