本文整理汇总了Python中score.score方法的典型用法代码示例。如果您正苦于以下问题:Python score.score方法的具体用法?Python score.score怎么用?Python score.score使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类score
的用法示例。
在下文中一共展示了score.score方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_imagenet1k_resnet
# 需要导入模块: import score [as 别名]
# 或者: from score import score [as 别名]
def test_imagenet1k_resnet(**kwargs):
models = ['imagenet1k-resnet-50', 'imagenet1k-resnet-152']
accs = [.77, .78]
for (m, g) in zip(models, accs):
acc = mx.metric.create('acc')
(speed,) = score(model=m, data_val=VAL_DATA,
rgb_mean='0,0,0', metrics=acc, **kwargs)
r = acc.get()[1]
print('Tested %s, acc = %f, speed = %f img/sec' % (m, r, speed))
assert r > g and r < g + .1
示例2: test_imagenet1k_resnet
# 需要导入模块: import score [as 别名]
# 或者: from score import score [as 别名]
def test_imagenet1k_resnet(**kwargs):
models = ['imagenet1k-resnet-34',
'imagenet1k-resnet-50',
'imagenet1k-resnet-101',
'imagenet1k-resnet-152']
accs = [.72, .75, .765, .76]
for (m, g) in zip(models, accs):
acc = mx.metric.create('acc')
(speed,) = score(model=m, data_val='data/val-5k-256.rec',
rgb_mean='0,0,0', metrics=acc, **kwargs)
r = acc.get()[1]
print('testing %s, acc = %f, speed = %f img/sec' % (m, r, speed))
assert r > g and r < g + .1
示例3: test_imagenet1k_inception_bn
# 需要导入模块: import score [as 别名]
# 或者: from score import score [as 别名]
def test_imagenet1k_inception_bn(**kwargs):
acc = mx.metric.create('acc')
m = 'imagenet1k-inception-bn'
g = 0.72
(speed,) = score(model=m,
data_val='data/val-5k-256.rec',
rgb_mean='123.68,116.779,103.939', metrics=acc, **kwargs)
r = acc.get()[1]
print('Tested %s acc = %f, speed = %f img/sec' % (m, r, speed))
assert r > g and r < g + .1
示例4: test_imagenet1k_inception_bn
# 需要导入模块: import score [as 别名]
# 或者: from score import score [as 别名]
def test_imagenet1k_inception_bn(**kwargs):
acc = mx.metric.create('acc')
m = 'imagenet1k-inception-bn'
g = 0.75
(speed,) = score(model=m,
data_val=VAL_DATA,
rgb_mean='123.68,116.779,103.939', metrics=acc, **kwargs)
r = acc.get()[1]
print('Tested %s acc = %f, speed = %f img/sec' % (m, r, speed))
assert r > g and r < g + .1
示例5: load_score
# 需要导入模块: import score [as 别名]
# 或者: from score import score [as 别名]
def load_score(title):
import asyncio
from rank.util import purge
from rank.collect.movie import get_comments
loop = asyncio.get_event_loop()
data = get_comments(title.strip())
lines = ["| {0}".format(purge(comment)) for comment in data]
logger.debug("Got comments")
create = asyncio.create_subprocess_exec("vw", "-c", "-k", "-t", "-i", "data/raw.vw", "-p", "/dev/stdout", "--quiet",
stdin=asyncio.subprocess.PIPE, stdout=asyncio.subprocess.PIPE)
logger.debug("Creating classifier")
proc = await create
proc.stdin.write("\n".join(lines).encode("UTF-8"))
await proc.stdin.drain()
proc.stdin.close()
result = await proc.stdout.read()
await proc.wait()
from score import score, parse_num
logger.debug("Calculating score")
ratings = [parse_num(line) for line in result.decode("UTF-8").split("\n")]
for r, c in zip(ratings, data):
logger.debug("Rating: {0}, Comment: {1}".format(r, c))
mean = score(ratings[:-1], base=10)
return True, str(mean)