首页 > 其他分享 >按照tensorflow jupyer

按照tensorflow jupyer

时间:2022-10-23 10:45:23浏览次数:67  
标签:layers jupyer keras 28 test train tf tensorflow 按照

anaconda  安装包 

链接:https://pan.baidu.com/s/1wh6mYu1uMLlPM5Ai5ONCXQ
提取码:3rlo
 

两个库

pip install tensorflow==2.8.0 keras==2.8 -i https://pypi.douban.com/simple/
Looking in indexes: https://pypi.douban.com/simple/

 

pip install protobuf==3.20 -i https://pypi.douban.com/simple/
Looking in indexes: https://pypi.douban.com/simple/

 

 

测试代码

import tensorflow as tf
(x_train, y_train), (x_test, y_test) = tf.keras.datasets.mnist.load_data()
x_train = x_train.reshape(x_train.shape[0], 28, 28, 1).astype('float32')
x_test = x_test.reshape(x_test.shape[0], 28, 28, 1).astype('float32')

model = tf.keras.models.Sequential([
tf.keras.layers.Conv2D(filters=6, kernel_size=(5, 5), activation='sigmoid', input_shape=(28, 28, 1)),
tf.keras.layers.MaxPool2D(pool_size=(2, 2), strides=2),
tf.keras.layers.Conv2D(filters=16, kernel_size=(5, 5), activation='sigmoid'),
tf.keras.layers.MaxPool2D(pool_size=(2, 2), strides=2),
tf.keras.layers.Flatten(),
tf.keras.layers.Dense(120, activation='sigmoid'),
tf.keras.layers.Dense(84, activation='sigmoid'),
tf.keras.layers.Dense(10, activation='softmax'),
])
model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
model.fit(x_train, y_train, epochs=10)
model.evaluate(x_test, y_test)

 

 

标签:layers,jupyer,keras,28,test,train,tf,tensorflow,按照
From: https://www.cnblogs.com/china520/p/16818062.html

相关文章

  • Tensorflow解析tfrecord
    1、序列化#coding:utf-8from__future__importabsolute_importfrom__future__importdivisionfrom__future__importprint_functionimportnumpyasnpimpor......
  • win11+cuda11.2+cudnn+Tensorflow-GPU 环境配置
    名词解释CUDA即英伟达的显卡并行计算框架,nvidia-smi可以查看tensorflow-gpu的运行需要它的底层支持,它是一个计算框架,抽象层次比驱动高,每个版本的CUDA都是基于一定版......
  • 基于TensorFlow和Python的机器学习(笔记2)
    基于TensorFlow和Python的机器学习(笔记2)     油耗预测项目(实战)importioimportos.pathimportmatplotlib.pyplotaspltimportkeras.utilsimportte......
  • 编译tensorflow-lite
    1.centos7编译tensorflow-lite-v2.4.4yuminstall-yepel-releasecentos-release-scl-rhyuminstall-yunzipgitmakedevtoolset-7-toolchainyuminstall-yswig......
  • tomcat中catalina.out按照时间分割(用crontab进行分割)
    具体操作log_control.sh脚本内容(最好是在服务器上vilog_control.sh进行创建文件)#!/bin/bashCUR_PWD="/root/apache-tomcat-8.5.42/logs/catalina_out_bak"NEWLOG=/ca......
  • 使用 TensorFlow 和 Express.js 实现AI图像识别
    人工智能是一个相当广泛的领域,以其惊人的能力和复杂的性质吸引着人们的兴趣。自1940年代首次提出使用电子设备重建大脑的可能性以来,这项技术已经取得了长足的进步。尽管人......
  • TensorFlow+OpenCV实现睡意检测系统
    导读本文主要介绍如何使用Python、OpenCV、TensorFlow和Keras实现一个睡意检测系统。(公众号:OpenCV与AI深度学习)背景介绍   如今,司机的嗜睡是造成交通事故的主要原因......
  • 【软件学习】怎么在Word里面设置MathType分隔符,使公式按照章节自动编号
    前提确保已安装好了MathType,且在设置为Word加载项若没有安装或设置为加载项,请转至博客另一篇文章:【软件学习】如何下载安装Mathtype,并将其加载至Word第一步点击MathT......
  • 【从caffe到Tensorflow 1】io 操作
    最近项目要频繁用到tensorflow,所以不得不认真研究下tensorflow而不是跟之前一样遇到了就搞一下了。首先我觉得所有这些框架里面caffe是最清晰的,所以就算是学习tensorflow,我......
  • TensorFlow学习笔记
    TensorFlowCourse1andCourse2【吴恩达团队Tensorflow2.0实践系列课程第一课】TensorFlow2.0中基于TensorFlow2.0的人工智能、机器学习和深度学习简介及基础编程【吴......