资源算法tensorflow.cifar10

tensorflow.cifar10

2020-02-06 | |  34 |   0 |   0

tensorflow.cifar10

The examples of image recognition with the dataset CIFAR10 via tensorflow.

1 CIFAR-10 数据集

CIFAR-10数据集是机器学习中的一个通用的用于图像识别的基础数据集,官网链接为:The CIFAR-10 dataset

图片.png

将其解压后(代码中包含自动解压代码),内容为:

图片.png

2 测试代码

测试代码公布在GitHub:yhlleo

主要代码及作用:

文件作用
cifar10_input.py读取本地或者在线下载CIFAR-10的二进制文件格式数据集
cifar10.py建立CIFAR-10的模型
cifar10_train.py在CPU或GPU上训练CIFAR-10的模型
cifar10_multi_gpu_train.py在多个GPU上训练CIFAR-10的模型
cifar10_eval.py评估CIFAR-10模型的预测性能

该部分的代码,介绍了如何使用TensorFlow在CPU和GPU上训练和评估卷积神经网络(convolutional neural network, CNN)。

3 相关网页及教程

更加详细地介绍说明,请浏览网页:Convolutional Neural Networks

中文网站极客学院也有该部分的汉译版:卷积神经网络

代码源自tensorflow官网:tensorflow/models/image/cifar10

4 代码修改说明

GitHub公布代码相对源码,主要进行了以下修正:

  • cifar10.py

#indices = tf.reshape(tf.range(FLAGS.batch_size), [FLAGS.batch_size, 1])indices = tf.reshape(range(FLAGS.batch_size), [FLAGS.batch_size, 1])# orindices = tf.reshape(tf.range(0, FLAGS.batch_size, 1), [FLAGS.batch_size, 1])

此处,源码编译时会出现以下错误:

  ...
  File ".../cifar10.py", line 271, in loss
    indices = tf.reshape(tf.range(FLAGS.batch_size), [FLAGS.batch_size, 1])TypeError: range() takes at least 2 arguments (1 given)
  • cifar10_input_test.py

#self.assertEqual("%s:%d" % (filename, i), tf.compat.as_text(key))import compat as cp...self.assertEqual("%s:%d" % (filename, i), cp.as_text(key))

不然的话,我测试的时候就会出现这的错误:

AttributeError: 'module' object has no attribute 'compat'
  • cifar10_train.pycifar10_multi_gpu_train.py

源代码里的最大迭代次数max_steps1000000,需要训练几个小时,不忍心折腾我的破笔记本,就改为了20000

其他改动,例如导入模块或者文件路径等,都很容易理解,就不列举了~


上一篇:resnet-cifar10-caffe

下一篇:cifar10-fast

用户评价
全部评价

热门资源

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • inferno-boilerplate

    This is a very basic boilerplate example for pe...