tensorflow1.2训练cifar10步骤以及问题汇总
2017-07-19 17:16
651 查看
CIFAR-10数据集是机器学习中的一个通用的用于图像识别的基础数据集,官网链接为:http://www.cs.toronto.edu/~kriz/cifar.html ,下载binary version版本
CIFAR-10 网络模型部分参见官网教程下载地址,我因为打不开,在Github上找了一份 https://github.com/tensorflow/models#tensorflow-models
解压网络模型压缩包,修改cifar10.py 函数maybe_download_and_extract()如下:
运行cifar10_train.py,因为tensorflow版本兼容不好会遇到若干问题,解决如下,我的解决方式是不断运行cifar10_train.py,发现错误,修改错误。参见以下几篇博客以及说明进行修改相关代码:
http://blog.csdn.net/zeuseign/article/details/72771598
http://blog.csdn.net/edwards_june/article/details/65652385
http://blog.csdn.net/c2a2o2/article/details/67639356
http://blog.csdn.net/caicai2526/article/details/72963126?utm_source=itdadao&utm_medium=referral
上面几篇博客解决问题有不齐全的,打开这几篇博客这篇找不到就找其他篇,下面附加额外博客没找到的2个解决方案:
额外问题1:AttributeError: ‘module’ object has no attribute ‘mul’
解决方法用tf.multiply替代tf.mul
额外问题2:若按照上面博客修改后仍有AttributeError: ‘module’ object has no attribute ‘summaries’,将tf.summaries修改为tf.summary.
OK,以上问题解决完了就可以开始训练了,再次运行cifar10_train.py,成功开始训练迭代
CIFAR-10 网络模型部分参见官网教程下载地址,我因为打不开,在Github上找了一份 https://github.com/tensorflow/models#tensorflow-models
解压网络模型压缩包,修改cifar10.py 函数maybe_download_and_extract()如下:
def maybe_download_and_extract(): """Download and extract the tarball from Alex's website.""" dest_directory = FLAGS.data_dir if not os.path.exists(dest_directory): os.mkdir(dest_directory) filename = DATA_URL.split('/')[-1] filepath = os.path.join('/home/hmw/tensorflow/cifa10', filename) #说明:上面的路径为你下载的cifar10数据集压缩包所在文件夹 '''if not os.path.exists(filepath): def _progress(count, block_size, total_size): sys.stdout.write('\r>> Downloading %s %.1f%%' % (filename, float(count * block_size) / float(total_size) * 100.0)) sys.stdout.flush() filepath, _ = urllib.request.urlretrieve(DATA_URL, filepath, reporthook=_progress) print() ''' statinfo = os.stat(filepath) print('Successfully downloaded', filename, statinfo.st_size, 'bytes.') tarfile.open(filepath, 'r:gz').extractall(dest_directory)
运行cifar10_train.py,因为tensorflow版本兼容不好会遇到若干问题,解决如下,我的解决方式是不断运行cifar10_train.py,发现错误,修改错误。参见以下几篇博客以及说明进行修改相关代码:
http://blog.csdn.net/zeuseign/article/details/72771598
http://blog.csdn.net/edwards_june/article/details/65652385
http://blog.csdn.net/c2a2o2/article/details/67639356
http://blog.csdn.net/caicai2526/article/details/72963126?utm_source=itdadao&utm_medium=referral
上面几篇博客解决问题有不齐全的,打开这几篇博客这篇找不到就找其他篇,下面附加额外博客没找到的2个解决方案:
额外问题1:AttributeError: ‘module’ object has no attribute ‘mul’
解决方法用tf.multiply替代tf.mul
额外问题2:若按照上面博客修改后仍有AttributeError: ‘module’ object has no attribute ‘summaries’,将tf.summaries修改为tf.summary.
OK,以上问题解决完了就可以开始训练了,再次运行cifar10_train.py,成功开始训练迭代
相关文章推荐
- win7下android studio1.2安装以及出错问题解决方式汇总
- Mac下安装mysql5.7 完整步骤以及 Mac平台重新设置MySQL的root密码等问题汇总
- Tensorflow-gpu 训练 cifar10 遇到问题
- Mac下安装mysql5.7 完整步骤以及 Mac平台重新设置MySQL的root密码等问题汇总
- Ubuntu下安装anaconda以及TensorFlow的安装步骤(附上相关的问题解决)
- Tensorflow 在训练中的内存溢出以及线程安全问题
- 安装widows mysql 免安装版(zip) 步骤详解 以及遇到问题解决 以及忘记密码的修改方法
- tensorflow遇到问题汇总
- VMware10 安装黑苹果步骤以及遇到的问题
- TensorFlow识别复杂验证码以及搭建生产环境(2)—— 搭建训练环境
- QTP与QC连接步骤以及遇到的问题
- docker配置文件以及各种问题汇总---随笔
- tensorflow使用GPU训练时的显存占用问题
- 水平分库分表的关键步骤以及可能遇到的问题
- ubuntu将svn项目迁移到git步骤以及遇到问题的解决方案
- tensorflow中遇到的问题汇总
- Linux 使用rpm方式安装最新mysql(5.7.16)步骤以及常见问题解决
- TensorFlow使用GPU训练网络时多块显卡的显存使用问题
- 移植Andorid4.0.4 - 步骤及问题汇总
- cocos2d-x-2.2.0_win7+vs2010搭建_eclipse+ndk-r9+cygwin搭建_教程以及编译问题汇总