【发布时间】:2018-06-03 02:24:40
【问题描述】:
我正在开发 Yolo3-4-PY 以使用 tkinter 实现它。
我到处查找,但无法解决问题。
当我运行程序时,画布会显示,但是当我点击开始视频(btton)时,我收到以下错误:
从 weights/yolov3.weights 加载权重...完成! /usr/local/lib/python3.5/dist-packages/PIL/ImageTk.py:119:FutureWarning:元素比较失败;而是返回标量,但将来将执行元素比较 如果模式不在 ["1", "L", "RGB", "RGBA"]:
Exception in Tkinter callback
Traceback (most recent call last):
File "/usr/lib/python3.5/tkinter/__init__.py", line 1553, in __call__
return self.func(*args)
File "webcam_demo.py", line 13, in start_video
show_frame()
File "webcam_demo.py", line 39, in show_frame
imgtk = ImageTk.PhotoImage(image=cv2image)
File "/usr/local/lib/python3.5/dist-packages/PIL/ImageTk.py", line 120, in
__init__
mode = Image.getmodebase(mode)
File "/usr/local/lib/python3.5/dist-packages/PIL/Image.py", line 313, in
getmodebase
return ImageMode.getmode(mode).basemode
File "/usr/local/lib/python3.5/dist-packages/PIL/ImageMode.py", line 55, in
getmode
return _modes[mode]
TypeError: unhashable type: 'numpy.ndarray'
Exception ignored in: <bound method PhotoImage.__del__ of
<PIL.ImageTk.PhotoImage object at 0x7f4b73f455c0>>
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/PIL/ImageTk.py", line 130, in
__del__ name = self.__photo.name
AttributeError: 'PhotoImage' object has no attribute '_PhotoImage__photo'
【问题讨论】:
-
在我的例子中,当 Python 在我放置的路径中找不到图像文件时,我收到了这个错误。我更正了路径,它开始工作了。
标签: python python-3.x tkinter python-imaging-library yolo