
tensorflow
深度学习扛把子
这个作者很懒,什么都没留下…
展开
-
tensorflow生成器读取图像数据
import osimport cv2from DeepFace import functions,analyzefrom keras.callbacks import ModelCheckpointimport numpy as npfrom sklearn import metricsimport tensorflow as tffrom sklearn.utils.class_weight import compute_class_weight, compute_sample_weig原创 2021-12-01 10:57:13 · 1661 阅读 · 0 评论 -
tensorflow数据预处理
假设img为PIL.image格式img = tf.convert_to_tensor(img)img = tf.image.resize(img,(224,224))原创 2021-11-30 10:20:44 · 1679 阅读 · 0 评论 -
根据tensorflow版本修改导入包
import tensorflow as tftf_version = int(tf.__version__.split(".")[0])if tf_version == 1: from keras.models import Model, Sequential from keras.layers import Input, Convolution2D, ZeroPadding2D, MaxPooling2D, Flatten, Dense, Dropout, Activationelse:原创 2021-10-15 10:22:35 · 253 阅读 · 0 评论 -
module ‘h5py‘ has no attribute ‘File‘
h5py和tensorflow版本不对应问题原创 2021-09-08 10:11:22 · 436 阅读 · 0 评论 -
ImportError: cannot import name ‘get_config‘ from ‘tensorflow.python.eager.context‘
用import tensorflow.keras替代import keras原创 2021-09-06 18:38:29 · 2650 阅读 · 0 评论 -
TF-tf.keras.layers.Conv1D
tf.keras.layers.Conv1D(filters, kernel_size, strides=1, padding=‘valid’,data_format=‘channels_last’,dilation_rate=1, groups=1, activation=None, use_bias=True,kernel_initializer=‘glorot_uniform’, bias_initializer=‘zeros’,kernel_regularizer=None, bias_r转载 2021-07-06 16:32:07 · 1331 阅读 · 0 评论 -
keras实现多层LSTM
model = Sequential()model.add(LSTM(units=hidden, input_shape=(time_steps, input_size),return_sequences=True))#返回所有节点的输出model.add(LSTM(units=hidden,return_sequences=False))#返回最后一个节点的输出### model.add(Dense(1, activation='softmax'))model.add(Dense(1, acti原创 2021-07-02 15:49:44 · 1608 阅读 · 0 评论 -
LSTM代码keras版
from tensorflow.keras.layers import Dense, LSTMfrom tensorflow.keras.models import Sequentialimport pandas as pdimport numpy as npdf = pd.read_excel(r'C:\Users\zhoutao\Desktop\data\data01.xlsx')# ###########df=df.drop(['dropcol'][0], axis=1)X=df.dr原创 2021-07-02 10:44:24 · 971 阅读 · 0 评论 -
ImportError: cannot import name ‘get_config‘ from ‘tensorflow.python.eager.context‘
from keras.layers import Dense, LSTMfrom keras.models import Sequential改为from tensorflow.keras.layers import Dense, LSTMfrom tensorflow.keras.models import Sequential原创 2021-07-01 16:20:43 · 4007 阅读 · 0 评论 -
tensorflow have no attribute enable_eager_execution() 问题解决
tensorflow2.0以上版本将tf.enable_eager_execution()改为tf.compat.v1.enable_eager_execution()原创 2021-05-18 14:05:26 · 249 阅读 · 0 评论 -
AttributeError: module ‘tensorflow._api.v2.train‘ has no attribute ‘Optimizer‘
将tf.train.Optimizer改为tf.keras.optimizers.Optimizer原创 2021-04-19 16:00:00 · 8980 阅读 · 0 评论 -
AttributeError: module ‘tensorflow‘ has no attribute ‘ConfigProto‘
config = tf.ConfigProto()改为config = tf.compat.v1.ConfigProto()session = tf.Session(config=config)改为session = tf.compat.v1.Session(config=config)原创 2021-04-19 15:57:45 · 3190 阅读 · 0 评论 -
ImportError: cannot import name ‘activations‘ from ‘keras.layers‘
from keras.layersimport activations改为from keras import activations原创 2021-04-19 14:29:03 · 2500 阅读 · 1 评论 -
ImportError: attempted relative import with no known parent package
将相对引用改为绝对引用from . import wikitext改为from example import wikitext原创 2021-04-19 14:14:36 · 153 阅读 · 0 评论 -
安装tensorflow
pip install --upgrade tensorflow原创 2021-04-14 18:28:32 · 98 阅读 · 0 评论