- 博客(11)
- 收藏
- 关注
原创 Python split()方法(X[i].lower().split())
Python split()方法Python 字符串 Python 字符串描述Python split() 通过指定分隔符对字符串进行切片,如果参数 num 有指定值,则分隔 num+1 个子字符串语法split() 方法语法:str.split(str="", num=string.count(str)).参数str – 分隔符,默认为所有的空字符,包括空格、换行(\n)、制表符(\t)等。num – 分割次数。默认为 -1, 即分隔所有。返回值返回分割后的字符串列表。str =
2020-09-26 15:55:11 2336
原创 numpy中np.clip()用法
np.clip()裁剪(限制)数组中的值。给定一个间隔,该间隔之外的值将被裁剪到间隔边缘。 例如,如果指定间隔[0,1],则小于0的值将变为0,而大于1的值将变为1。即整个数组的值限制在指定值a_min,与a_max之间,对比a_min小的和比a_max大的值就重置为a_min,和a_max。import numpy as npx=np.array([1,2,3,5,6,7,8,9])np.clip(x,3,8)输出:array([3, 3, 3, 5, 6, 7, 8, 8])..
2020-09-21 14:53:16 1371
原创 AttributeError: module ‘scipy.misc‘ has no attribute ‘imread‘解决(吴恩达深度学习课程四第四课)
解决方法一:降低版本到1.2.2版本的scipy便可解决命令如下:pip install scipy==1.2.1二:可换一种包代替将scipy替换成imageio包:pip install imageioimport imageiocontent_image = imageio.imread("images/louvre.jpg")
2020-09-18 10:50:34 349
原创 OSError:`pydot` failed to call GraphViz.(解决办法)
OSError: pydot failed to call GraphViz.Please install GraphViz (https://www.graphviz.org/) and ensure that its executables are in the $PATH.环境:win 10,,,python3.7刚安装完graphviz-2.38windows系统下,在 keras里面绘图时,如果没有导入过pydot和 graphviz,在运行时会报告" Failed to import py
2020-09-17 20:22:40 1139 6
原创 AttributeError: module ‘scipy.misc‘ has no attribute ‘imread‘[吴恩达深度学习第四周第三课]
出错原因:安装的scipy的版本太高不能直接使用scipy.misc.imread(os.path.join("out", image_file))解决方法:将scipy替换成imageio包:pip install imageioimport imageiooutput_image = imageio.imread(os.path.join("out", image_file))即可解决。...
2020-09-14 17:56:28 226
原创 AttributeError: module ‘tensorflow‘ has no attribute ‘space_to_depth‘
应该还是tensorflow2.0 的锅我的环境是win10,python3.7我安装的是 tensorflow2.0和keras2.4,然后运行报错了(吴恩达老师的深度学习第四周第三课)yolo_model = load_model("model_data/yolov2.h5")yolo_model.summary()解决办法:我终究还是妥协了,把tensorflow降到了 1.14.0 然后 kera降到了 2.3.1首先卸载安装的 tensorflow2.0和keras2.4分别
2020-09-14 15:45:26 2569 21
原创 RuntimeError: get_session is not available.[keras中K.get_session()无法使用]【tensorflow2.0】
RuntimeError: get_session is not available when using TensorFlow 2.0.import tensorflow as tffrom keras import backend as K在tensorflow2.0中无法使用get_session()函数若直接运行以下代码会报错 K.get_session().run(tf.variables_initializer([max_boxes_tensor])) #初始化变量max_boxes
2020-09-14 09:45:48 2603 1
原创 RuntimeError: tf.placeholder() is not compatible with eager execution.解决方法
在写吴恩达老师的第四课第一周作业时,由于我的tensorflo是2.3版本,自己改了之后出现了以下错误提示RuntimeError: tf.placeholder() is not compatible with eager execution.错误代码:def create_placeholders(n_H0, n_W0, n_C0, n_y): """ 为session创建占位符 参数: n_H0 - 实数,输入图像的高度 n_W0 -
2020-09-06 10:06:09 3508 3
原创 np.pad()函数解析
np.pad()函数方法参数:pad(array, pad_width, mode, **kwargs)方法返回:填充后的数组参数解释:array:表示需要填充的数组;pad_width:表示每个轴(axis)边缘需要填充的数值数目。参数输入方式为:((before_1, after_1), … (before_N, after_N)),其中(before_1, after_1)表示第1轴两边缘分别填充before_1个和after_1个数值。mode:表示填充的方式(取值:str...
2020-09-05 16:50:08 965
原创 %matplotlib、%load_ext autoreload 、%autoreload 2 作用
其中%matplotlib、 inline%load_ext autoreload 、%autoreload 2 比较奇怪,而且无论你是用哪个python的IDE如spyder或者pycharm,这个地方都会报错,显示是invalid syntax(无效语法)。以%matplotlib 为例1、是在使用jupyter notebook 或者 jupyter qtconsole的时候,才会经常用到%matplotlib,也就是说那一份代码可能就是别人使用jupyter notebook 或者 jup
2020-09-05 10:27:57 4939 4
原创 tensorflow安装错误:ERROR: Cannot uninstall ‘wrapt‘.
用cmd :pip install tensorflow 时出错ERROR: Cannot uninstall ‘wrapt’. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.解决办法:先输入以下代码:pip install wrapt --ignor
2020-09-01 23:22:36 264
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人