python bug
马大哈先生
新人一枚,请大家多多关照!
展开
-
python bug(一)——python TabError: Inconsistent use of tabs and spaces in indentation
自己敲的程序会出现下面的bug:缩进中不一致地使用制表符和空格错误原因,在所写的函数中用了空格,python应该要用tab来进行缩进的。这个错误是说你用了tab键作缩进了,因为在Python不像C/C++里用大括号来区分程序块,而是用缩进所以缩进很重要你把空格都换成Tab就好了 转自:https://blog.csdn.net/robinson_911/article/deta...转载 2018-12-26 17:38:04 · 230 阅读 · 0 评论 -
python bug(十)——Object was never used (type class 'tensorflow.python.framework.ops.Tensor'
在做目标检测或者分类,训练自己的数据时,会出现如下的bug:ERROR:tensorflow:==================================Object was never used (type <class 'tensorflow.python.framework.ops.Tensor'>):<tf.Tensor 'init_ops/report_...原创 2019-06-12 19:30:42 · 8516 阅读 · 9 评论 -
UnicodeEncodeError: 'utf-8' codec can't encode character '\udcd5' in position 2214: surrogates not a
在xml生成tfrecoed时出现如下错误: 代码def create_tf_example(group, path): with tf.gfile.GFile(os.path.join(path, '{}'.format(group.filename)), 'rb') as fid: #读图像 encoded_jpg = fid.r...原创 2019-05-06 16:11:34 · 4186 阅读 · 0 评论 -
xml文件转化成tfrecord格式出现错误TypeError: None has type NoneType, but expected one of: int, long
此错误是由于数据集标注不全或标签拼写错误而引起的,应检查训练集以及测试集里的照片是否和生成的xml文件一一对应,改正之后,需要重新生成csv数据。生成tfrecords时报错:TypeError: None has type NoneType, but expected one of: int, long:https://blog.csdn.net/qq_27882063/article...转载 2019-05-08 22:41:08 · 1264 阅读 · 0 评论 -
python bug(九)——IndexError: list index out of range
错误如下: data = line.split(",") #通过指定分隔符‘,’对字符串进行切片label = float(data[9]) #统计cvs文件中的列数,【】里的值应该比实际列数少1我.cvs文件有8列,则应该是label = float(data[7])关于Error:IndexError: list index out of ...原创 2019-05-04 17:18:43 · 999 阅读 · 0 评论 -
python bug(八)——关于FileNotFoundError: [Errno 2] No such file or directory: 'XXX’
在进行.cvs转tfrecord时,出现如下故障: 解决办法:1、没有该文件夹或者该文件(如果你访问用的是只读(r)方法的话,在没有该文件时,会出现这种情况。但用w方法的话,是会新建文档的,一般不是文件的问题) 2、文件路径的问题。可以将程序中的文件路径改为绝对路径我这个是文件路径的问题。应改为 加一个反斜杠就好了。参考资料:Python:错误F...原创 2019-05-04 16:51:54 · 4105 阅读 · 0 评论 -
python bug(七)——关于DuplicateFlagError: The flag ‘xxx' is defined twice.的错误处理
关于DuplicateFlagError: The flag ‘xxx' is defined twice.的错误处理解决办法:清除控制台 重新启动:点击consoles然后Restart Kernel参考:关于DuplicateFlagError: The flag ‘xxx' is defined twice.的错误处理:https://blog.csdn.net/us...转载 2019-05-04 16:26:03 · 3946 阅读 · 2 评论 -
python bug(六)——TypeError: object of type ‘zip’ has no len()
在python3上跑Neural Networks and Deep Learning的手写数字识别代码时,神经网络部分的代码出现了这个bug:if test_data: n_test = len(test_data)TypeError: object of type ‘zip’ has no len()这应该是版本变更带来的问题,将程序里的if test_data: n_t...原创 2019-04-24 11:05:04 · 2502 阅读 · 8 评论 -
python bug(五)——UnicodeDecodeError: 'ascii' codec can't decode byte 0x90 in position 614...
今天在运行代码中时遇到了下面的错误,经过多方努力后终于得到解决,在此记录一下。错误日志如下:>>> import mnist_loader>>> training_data, validation_data, test_data=mnist_loader.load_data_wrapper()根据以上信息可以判断出错处在pickle.load(f)...转载 2019-04-23 21:18:31 · 358 阅读 · 0 评论 -
python bug(四)——DuplicateFlagError: The flag ‘xxx' is defined twice.的错误处理
关于DuplicateFlagError: The flag ‘xxx' is defined twice.的错误处理清除控制台重新启动Restart Kernel转载 2019-04-04 19:55:49 · 2371 阅读 · 0 评论 -
python bug(三)——ModuleNotFoundError: No module named 'pandas'
使用‘pandas’的首要条件,python版本必须是2.7以上。pip方式安装如果有外网一般推荐使用pip安装,linux下和windows下均可使用pip安装python -m pip install --upgrade pippip install --user numpy scipy matplotlib jupyter pandas sympy nose但很快就...转载 2019-04-04 16:56:07 · 7650 阅读 · 1 评论 -
python bug(二)——from .cv2 import * Import Error: DLL load failed: 找不到指定的模块。
Anaconda中装python3.7+opencv后,测试opencv时出现如下问题:from .cv2 import * ImportError: DLL load failed: 找不到指定的模块。问题原因:1、python版本与opencv版本不搭(我的就是这个问题)解决办法:安装opencv时不能直接用pip install opencv_pyth...原创 2019-03-18 21:08:09 · 7357 阅读 · 0 评论 -
Tenflow bug(一)——tensorflow.python.framework.errors_impl.InvalidArgumentError
问题描述: 在做resnet101分类时,在原本resnet50做数字分类的基础上,改成了采用别的预训练集训练自己的数据,在训练完生成.pd文件时,出现如下问题:tensorflow.python.framework.errors_impl.InvalidArgumentError: Assign requires shapes of both tensors to match...转载 2019-06-14 08:39:43 · 35038 阅读 · 7 评论