资源简介
自己修改过的源码,可以直接利用cmake生成sln工程,导入VS2013就能编译,编译不通过可以到我博客去看编译步骤。
代码片段和文件信息
import csv
import sys
import cv
import cv2
def bb_overlap(bb1bb2frame):
if (bb1[0] == ‘NaN‘ or bb2[0] == ‘NaN‘):
return 0
if (bb1[0]>bb2[2]):
return 0
if (bb1[1]>bb2[3]):
return 0
if (bb1[2] return 0
if (bb1[3] return 0
x1 = max(bb1[0]bb2[0])
x2 = min(bb1[2]bb2[2])
y1 = max(bb1[1]bb2[1])
y2 = min(bb1[3]bb2[3])
colInt = x2-x1
rowInt = y2-y1
frame[y1:y2x1:x2]=(100200100)
intersection = colInt*rowInt
area1 = (bb1[2]-bb1[0])*(bb1[3]-bb1[1])
area2 = (bb2[2]-bb2[0])*(bb2[3]-bb2[1])
overlap = intersection/(area1 + area2 - intersection)
#if (overlap<0.5):
# print “overlap %f“ %overlap
return overlap
def drawBox(frameboxcolor):
cv2.rectangle(frame(int(box[0])int(box[1]))(int(box[2])int(box[3]))color1)
cap = cv2.VideoCapture(sys.argv[1])
#size = (int(cap.get(cv.CV_CAP_PROP_frame_WIDTH))int(cap.get(cv.CV_CAP_PROP_frame_HEIGHT)))
#rec = cv2.VideoWriter(“evaluation.avi“cv.CV_FOURCC(‘P‘‘I‘‘M‘‘1‘)30size1)
boxes = csv.reader(open(sys.argv[2]‘rb‘)delimiter=‘‘)
true_boxes = csv.reader(open(sys.argv[3]‘rb‘)delimiter=‘‘)
correct_detections = 0.0
detections = 0.0
true_detections = 0.0
while (1):
retframe= cap.read()
if (ret!=1):
break
true_box = true_boxes.next()
box = boxes.next()
if (box[0] != ‘NaN‘):
box = map(floatbox)
drawBox(framebox(00255))
detections=detections+1
if (true_box[0] != ‘NaN‘):
true_detections=true_detections +1
true_box = map(floattrue_box)
drawBox(frametrue_box(02550))
if (bb_overlap(boxtrue_boxframe)>0.25):
correct_detections = correct_detections + 1
cv2.imshow(“Evaluation“frame)
#rec.write(frame)
cv2.waitKey(30)
print “detections = %f“ % detections
print “true detections = %f“ % true_detections
print “correct detections = %f“ % correct_detections
precision = correct_detections/detections
recall = correct_detections/true_detections
f_measure = 2*precision*recall/(precision+recall) if (precision >0 or recall >0) else 0
print “precision=%f“ % precision
print “recall=%f“ % recall
print “f-measure= %f“ % f_measure
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
....... 927 2011-12-04 05:39 OpenTLD-master\.gitignore
....... 962560 2011-12-04 05:39 OpenTLD-master\datasets\01_david\david.mpg
....... 20923 2011-12-04 05:39 OpenTLD-master\datasets\01_david\gt.txt
....... 14 2011-12-04 05:39 OpenTLD-master\datasets\01_david\init.txt
....... 18096 2011-12-04 05:39 OpenTLD-master\datasets\01_david\pn_tracker.txt
....... 8595 2011-12-04 05:39 OpenTLD-master\datasets\02_jumping\gt.txt
....... 15 2011-12-04 05:39 OpenTLD-master\datasets\02_jumping\init.txt
....... 704512 2011-12-04 05:39 OpenTLD-master\datasets\02_jumping\jumping.mpg
....... 7301 2011-12-04 05:39 OpenTLD-master\datasets\02_jumping\pn_tracker.txt
....... 3839 2011-12-04 05:39 OpenTLD-master\datasets\03_pedestrian1\gt.txt
....... 11 2011-12-04 05:39 OpenTLD-master\datasets\03_pedestrian1\init.txt
....... 313344 2011-12-04 05:39 OpenTLD-master\datasets\03_pedestrian1\pedestrian1.mpg
....... 2991 2011-12-04 05:39 OpenTLD-master\datasets\03_pedestrian1\pn_tracker.txt
....... 3836 2011-12-04 05:39 OpenTLD-master\datasets\03_pedestrian1\TLD1.0.txt
....... 2192 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\BeyondSemiBoost.txt
....... 13942 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\coGD.original.txt
....... 9242 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\coGD.txt
....... 8301 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\CVPR.txt
....... 7060 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\final_detector.txt
....... 8449 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\gt.txt
....... 15 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\init.txt
....... 6920 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\initial_detector.txt
....... 4942 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\MIL.original.txt
....... 5278 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\MIL.txt
....... 688 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\OnlineBoost.txt
....... 452608 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\pedestrian2.mpg
....... 7916 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\pn_tracker.txt
....... 5353 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\SemiBoost.txt
....... 8507 2011-12-04 05:39 OpenTLD-master\datasets\04_pedestrian2\TLD1.0.txt
....... 2793 2011-12-04 05:39 OpenTLD-master\datasets\05_pedestrian3\BeyondSemiBoost.txt
............此处省略121个文件信息
评论
共有 条评论