YunYang1994/tensorflow-yolov3 IndexError: list index out of range 解决办法
YunYang1994/tensorflow-yolov3 IndexError: list index out of range 解决办法
- 原项目地址:YunYang1994/tensorflow-yolov3
- 报错描述:
- 详细描述:
- 寻找错误原因:
- 总结:
原项目地址:YunYang1994/tensorflow-yolov3
报错描述:
运行识别程序 video_demo.py 时,程序报错:
D:\Yolov3_Tensorflow\python\python.exe D:/Yolov3_Tensorflow/tensorflow-yolov3/video_demo.py
2019-10-10 08:26:58.675604: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
2019-10-10 08:26:59.363176: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1411] Found device 0 with properties:
name: GeForce MX250 major: 6 minor: 1 memoryClockRate(GHz): 1.582
pciBusID: 0000:01:00.0
totalMemory: 2.00GiB freeMemory: 1.62GiB
2019-10-10 08:26:59.363377: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1490] Adding visible gpu devices: 0
2019-10-10 08:27:00.278345: I tensorflow/core/common_runtime/gpu/gpu_device.cc:971] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-10-10 08:27:00.278458: I tensorflow/core/common_runtime/gpu/gpu_device.cc:977] 0
2019-10-10 08:27:00.278519: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990] 0: N
2019-10-10 08:27:00.278730: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1103] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1374 MB memory) -> physical GPU (device: 0, name: GeForce MX250, pci bus id: 0000:01:00.0, compute capability: 6.1)
2019-10-10 08:27:18.867149: W tensorflow/core/common_runtime/bfc_allocator.cc:215] Allocator (GPU_0_bfc) ran out of memory trying to allocate 1.13GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2019-10-10 08:27:18.894705: W tensorflow/core/common_runtime/bfc_allocator.cc:215] Allocator (GPU_0_bfc) ran out of memory trying to allocate 1.14GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2019-10-10 08:27:18.898060: W tensorflow/core/common_runtime/bfc_allocator.cc:215] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.13GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2019-10-10 08:27:19.032698: W tensorflow/core/common_runtime/bfc_allocator.cc:215] Allocator (GPU_0_bfc) ran out of memory trying to allocate 1.60GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2019-10-10 08:27:19.109551: W tensorflow/core/common_runtime/bfc_allocator.cc:215] Allocator (GPU_0_bfc) ran out of memory trying to allocate 1.56GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
2019-10-10 08:27:19.123356: W tensorflow/core/common_runtime/bfc_allocator.cc:215] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.06GiB. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
Traceback (most recent call last):File "D:/Yolov3_Tensorflow/tensorflow-yolov3/video_demo.py", line 141, in <module>image = utils.draw_bbox(frame, bboxes)File "D:\Yolov3_Tensorflow\tensorflow-yolov3\core\utils.py", line 83, in draw_bboxbbox_color = colors[class_ind]
IndexError: list index out of rangeProcess finished with exit code 1
详细描述:
程序运行成功会打开识别或者视频流进行识别并画出识别框,在画面静止的状态下,运行貌似稳定并能准确显示识别框,当画面有较大幅度动作时,会立即出现上述报错。
寻找错误原因:
1、在检查的过程中偶然看见程序说 ./data/classes/voc.names
文件不存在,当时没在意。因为查看文件夹,voc.names
文件确实存在。
2、后来查看 video_demo.py
文件,看到两个参数,突然想起什么,input_size = 416
可能是识别时识别框预设大小,而num_classes = 80
依稀记得是识别分类的数量。
于是打开 voc.names
查看,发现里面只有20个类,而打开 coco.names
,发现有80个类,这应该多少有点问题:
3、于是打开 config.py
文件,将 __C.YOLO.CLASSES 参数由 "./data/classes/voc.names"
改成了 "./data/classes/coco.names
"。
4、运行程序,没有再出现程序报错,识别也良好!
总结:
识别使用的权重文件一定要与我们识别类的 .names
文件相对应(猜测权重文件中记录的只是类序号,它转换成文字表示需要 .names
文件支持),同时我们在 video_demo.py
中填写的 num_classes
参数也要与 .names
文件中的类数量一致。
(我本次使用的权重文件为 yolov3_coco_demo.ckpt
)
YunYang1994/tensorflow-yolov3 IndexError: list index out of range 解决办法相关推荐
- 成功解决.append方法出现错误IndexError: list index out of range
成功解决.append方法出现错误IndexError: list index out of range 目录 解决问题 解决方法 解决问题 .append方法出现错误IndexError: list ...
- 成功解决sys.argv[1] IndexError: list index out of range错误
成功解决sys.argv[1] IndexError: list index out of range错误 目录 解决问题 解决思路 解决办法 解决问题 sys.argv[1] IndexError: ...
- maskrcnn训练问题报错:selected_polygons.append(self.polygons[i]) IndexError: list index out of range
训练mask rcnn实例分割时报错: Traceback (most recent call last):File "tools/train_net.py", line 203, ...
- 使用pcb-tools解码Gerber文件报错IndexError: list index out of range
问题描述: 基于Github提供的示例代码编写: import gerber from gerber.render.cairo_backend import GerberCairoContext# R ...
- IndexError: list index out of range的解决办法
IndexError: list index out of range的解决办法 列表的索引也就是他的元素的个数是没有你所想要找的元素位置,比如这个列表只有十个元素你要找第11个元素这个肯定找不到 解 ...
- 爬虫时出现 IndexError: list index out of range 的原因
爬虫时出现 IndexError: list index out of range 的原因有两种: 简单举例如下: 第一种情况: index越界 Alex = [1,2,3] Alex[1] 2 Al ...
- 很有必要看,这篇 解决 IndexError: list index out of range
运行逻辑回归代码,遭遇bug: Traceback (most recent call last):File "D:/DTLFolder/paperTest/Paper_logistic r ...
- mmdetection训练出现:IndexError: list index out of range 错误
mmdetection训练出现:IndexError: list index out of range 错误 文章目录: 1 问题分析 1.1 尝试解决错误:第一次 1.2 尝试解决错误:第二次 2 ...
- 成功解决pml.Simple derived_col_names[int(obj[‘split_feature‘])],\ IndexError: list index out of range
成功解决pml.SimplePredicate(field=xgboostToPmml.replace_name_with_derivedColumnNames(derived_col_names[i ...
最新文章
- windows10 mysql 5.5.36 安装
- Intellij 如何在新窗口中打开项目
- C# 学习笔记(14)自己的串口助手----多行发送
- 开源配置管理平台-Apollo
- QT的QGraphicsAnchorLayout类的使用
- js数字转中文大写支持负数
- 为什么跨境电商独立站将成为几年的焦点?
- Linux的企业-Codis 3集群搭建详解
- 前端 JavaScript 条件语句优化
- 第五次上课 PPT作业——随机数组,并求和
- [oeasy]python0010 - python虚拟机解释执行py文件的原理
- 37_Flutter之Sliver组件扩展
- matlab2014b与carsim8.02联合仿真可能遇到的问题
- mysql语句中limt_mysql sql语句中的limit用法
- 和在java和c语言中的那些事
- citus插件安装及使用
- uCOS2的events事件源码分析-第4季第5部分-朱有鹏-专题视频课程
- 基于H.264的远程视频监控
- 日常水文章之rk3188 5.0最简单的视频图片混播
- 【算法java版04】:顺时针方向循环输出矩阵