
tf、pytorch、sklearn
tf、pytorch、sklearn
buptwhq
这个作者很懒,什么都没留下…
展开
-
(‘You must install pydot (`pip install pydot`) and install graphviz...)
Linux下绘制模型结构图出现报错原创 2022-07-16 11:24:19 · 1837 阅读 · 0 评论 -
python绘图记录(模型训练)
除了用tensorboard,也可如此如此history = model.fit(generate_data(npy_path + '/train'), steps_per_epoch=len(os.listdir(npy_path + '/train')) // 3, epochs=epochs, validation_data=generate_valid_data(npy_pa原创 2022-03-16 21:50:40 · 1954 阅读 · 0 评论 -
tf使用GPU训练与推理记录
推理import osos.environ['CUDA_VISIBLE_DEVICES'] = '0, 1' # 选择GPU设备predict = model.predict(SignalSeq_16[:10])训练os.environ['CUDA_VISIBLE_DEVICES'] = '0'gpus = tf.config.experimental.list_physical_devices(device_type='GPU')for gpu in gpus: tf.config原创 2022-03-16 18:19:29 · 1030 阅读 · 0 评论 -
TensorFlow的plot_model功能
TensorFlow的画图功能非常强大,可以在模型设计完后进行检验、总结与展示。tf调用该函数如下所示:tf.keras.utils.plot_model(model, to_file='model.png')除此调用可能会缺少包:ImportError: Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work.在Windows环境下,用conda命令安装即可。conda inst原创 2021-05-18 16:33:08 · 1521 阅读 · 0 评论 -
preprocessing.LabelEncoder()使用
preprocessing.LabelEncoder()使用e.g. 1:from sklearn import preprocessingle = preprocessing.LabelEncoder()arr_gf = [1,2,3,'wom','wom','中文','中文']le.fit(arr_gf)one_hot_gf = le.transform(arr_gf)print(one_hot_gf)输出:[0 1 2 3 3 4 4]e.g. 2:csv_path = './原创 2022-02-04 18:12:23 · 3718 阅读 · 0 评论 -
载入预训练model权重
def load_pretrain_embedding(goods_path, seller_path): model = build_model() goods_model = tf.keras.models.load_model(goods_path) # 预训练模型 for i, pretrain_layer in enumerate(goods_model.layers): if isinstance(pretrain_layer, tf.keras原创 2022-02-04 17:30:31 · 1277 阅读 · 0 评论 -
标签shuffle
载入数据input1 = np.load('/root/whq/input/one_hot_1400/xf_p_n.npy')input2 = np.load('/root/whq/input/one_hot_1400/gf_p_n.npy')output_ = np.load('/root/whq/input/one_hot_1400/label_p_n_-1.npy')output_0 = np.load('/root/whq/input/one_hot_1400/label_p_n_0.npy原创 2022-02-04 17:03:49 · 982 阅读 · 0 评论