Cannot write to snapshot prefix '***'. Make sure that the directory exists and is writeable解决方法

在上一篇博客中我介绍了使用caffe的python接口绘制loss曲线和accuracy曲线,但是运行spyder的时候,出现了如下错误:

 Cannot write to snapshot prefix 'caffe/examples/mnist/lenet'.  Make sure that the directory exists and is writeable.
*** Check failure stack trace: ***

原因:原始的prototxt文件里面涉及到的路径都是以caffe的根目录作为基础的,都是假设程序是在caffe的根目录下运行的,因此在其他的地方使用这些prototxt文件时就需要将这些文件里的路径都修改成绝对路径。所以我将程序所需要的proto文件中只要涉及到路径的文件全都修改的一下,比如我绘制曲线时使用的是mnist例子的lenet_solver_adam.prototxt文件,这只是个求解配置文件,与这相关的文件还有lenet_train_test.prototxt文件,所以,需要修改的地方有这么几个位置(以下是修改之后):

lenet_solver_adam.prototxt:


lenet_train_test.prototxt



修改完这些位置之后再重新运行就行了。

其实还有一种方法就是将你的写的这个python脚本文件移动到caffe的根目录下,使用命令:

root@cyz:~/caffe# spyder loss.py

在根目录下运行就行了,这样就完全没必要修改上面这些文件。我上面说的这些只不过是为了强调出现了这种问题的原因就在出在文件的绝对路径上而已,绝不是坑各位。

注:这里的loss.py就是我绘制loss曲线的脚本文件

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
Git is a distributed version control system, widely used in software development to manage and track changes made to code repositories over time. It was designed by Linus Torvalds for the Linux kernel project and has since become the de facto standard for managing source code collaboration. Here's a brief overview of key concepts in Git: 1. Repository: A Git repository is a central location where all the files and their versions are stored. Each repository has a local copy on your computer, as well as a remote copy on a server or online platform like GitHub. 2. Working directory: This is the folder on your local machine that contains the latest version of the files from the repository. You can make changes here and stage them for committing. 3. Commit: A commit is a snapshot of the current state of your working directory. It includes all changes, along with a message describing what you've done. Commits are saved locally and can be pushed to the remote repository. 4. Branches: In Git, you can create multiple branches, which are separate lines of development. This allows developers to work on different features or bug fixes without interfering with each other's work. 5. Merge: When a branch is ready to be integrated into the mainline code, developers can merge the changes from one branch into another using `git merge`. 6. Pull request: A pull request is a way to propose changes to a shared codebase. You create a request on a remote repository, asking others to review and potentially merge your changes. 7. Stashing: If you need to switch between tasks but don't want to lose your changes, Git allows you to stash them temporarily.
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值