本文整理汇总了Python中dataset.DataSet.get_nobjs方法的典型用法代码示例。如果您正苦于以下问题:Python DataSet.get_nobjs方法的具体用法?Python DataSet.get_nobjs怎么用?Python DataSet.get_nobjs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataset.DataSet
的用法示例。
在下文中一共展示了DataSet.get_nobjs方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse
# 需要导入模块: from dataset import DataSet [as 别名]
# 或者: from dataset.DataSet import get_nobjs [as 别名]
def parse(filen, crawl = False):
file = open(filen, "r")
ret = DataSet()
for line in file:
line = line.strip().rstrip()
splited = line.split()
filename = splited[0]
# filename = filename[filename.rfind("/")+1:]
# filename = filename[:filename.rfind(".")]
height = int(splited[1])
width = int(splited[2])
class_id = int(splited[3])
(confidence, x, y, x2, y2) = tuple([float(a) for a in splited[4:]])
#if confidence > parse_confidence_min: #TODO
if hratio != None:
height = y2 - y
height2 = height * hratio
y += (height - height2) / 2.0
y2 = y + height2
if wratio != None:
width = x2 - x
width2 = width * wratio
x += (width - width2) / 2.0
x2 = x + width2
if whratio != None:
height = y2 - y
width = x2 - x
width2 = height * whratio
x += (width - width2) / 2.0
x2 = x + width2
bb = BoundingBox(x, y, x2, y2)
area = bb.area()
if (min_area == None or area >= min_area) and \
(max_area == None or area <= max_area):
ret.add_obj(filename, bb)
file.close()
# print summary
print 'Dataset ' + str(filen) + ' has ' + str(len(ret)) + ' images and ' \
+ str(ret.get_nobjs()) + ' positive objects.'
return ret