计算机一级考试题库蛇,错误运行库蟒蛇

python python_examples/face_detector.py examples/faces/2007_007763.jpg

收回错误。 首先,错误是

AttributeError: 'module' object has no attribute 'image_window'

到第8行 现在,误差为Illegal instruction (core dumped),但我不知道为什么。 请帮助我正确地添加库。

import sys

import dlib

from skimage import io

detector = dlib.get_frontal_face_detector()

win = dlib.image_window()

for f in sys.argv[1:]:

print("Processing file: {}".format(f))

img = io.imread(f)

# The 1 in the second argument indicates that we should upsample the image

# 1 time. This will make everything bigger and allow us to detect more

# faces.

dets = detector(img, 1)

print("Number of faces detected: {}".format(len(dets)))

for i, d in enumerate(dets):

print("Detection {}: Left: {} Top: {} Right: {} Bottom: {}".format(

i, d.left(), d.top(), d.right(), d.bottom()))

win.clear_overlay()

win.set_image(img)

win.add_overlay(dets)

dlib.hit_enter_to_continue()

# Finally, if you really want to you can ask the detector to tell you the score

# for each detection. The score is bigger for more confident detections.

# The third argument to run is an optional adjustment to the detection threshold,

# where a negative value will return more detections and a positive value fewer.

# Also, the idx tells you which of the face sub-detectors matched. This can be

# used to broadly identify faces in different orientations.

if (len(sys.argv[1:]) > 0):

img = io.imread(sys.argv[1])

dets, scores, idx = detector.run(img, 1, -1)

for i, d in enumerate(dets):

print("Detection {}, score: {}, face_type:{}".format(

d, scores[i], idx[i]))

+0

你可以发布你的代码吗?发生的事情是,您正试图在另一个模块中访问名为image_window的函数或对象,但它不存在。 –

+0

欢迎来到StackOverflow。请阅读并遵守帮助文档中的发布准则。 [最小,完整,可验证的示例](http://stackoverflow.com/help/mcve)适用于此处。在您发布代码并准确描述问题之前,我们无法有效帮助您。 –

+0

既然你没有充分描述你开始做什么,也没有你改变什么,也没有提供完整的错误信息,我们真的不能帮助。 –

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值