title: Permission denied when running make_imagenet_mean.sh
body: <p>I'm making an ImageNet with my own data which I have successfully made into two database files in the caffe root directory under folders "DB_train" and "DB_verify".</p>
  
  <p>My <code>make_imagenet_mean.sh</code> looks like:</p>
  
  <pre><code>#!/usr/bin/env sh
  # Compute the mean image from the imagenet training lmdb
  # N.B. this is available in data/ilsvrc12
  
  EXAMPLE=/home/andrew/caffe/DB_train
  DATA=/home/andrew/caffe/data/ilsvrc12
  TOOLS=/home/andrew/caffe/build/tools
  
  /home/andrew/caffe/build/tools/compute_image_mean /home/andrew/caffe/DB_train \
    /home/andrew/caffe/data/ilsvrc12/imagenet_mean.binaryproto
  
  echo "Done."
  </code></pre>
  
  <p>When I run the command:</p>
  
  <pre><code>andrew@ubuntu:~/caffe$ sudo ./examples/imagenet/make_imagenet_mean.sh
  </code></pre>
  
  <p>I get the error:</p>
  
  <pre><code>./examples/imagenet/make_imagenet_mean.sh: 11: ./examples/imagenet/make_imagenet_mean.sh: data/ilsvrc12/imagenet_mean.binaryproto: Permission denied
  Done.
  </code></pre>
  
  <p>Any reason as to why this is happening?</p>
  
  <p>When I run </p>
  
  <pre><code>GLOG_minloglevel=0 GLOG_logtostderr=1 /home/andrew/caffe/build/tools/compute_image_mean /home/andrew/caffe/DB_train /home/andrew/caffe/data/ilsvrc12/imagenet_mean.binaryproto
  </code></pre>
  
  <p>I get </p>
  
  <blockquote>
  <pre><code>I0215 01:42:17.412768 11659 db_lmdb.cpp:38] Opened lmdb /home/andrew/caffe/DB_train
  I0215 01:42:17.414031 11659 compute_image_mean.cpp:68] Starting Iteration
  I0215 01:42:17.660877 11659 compute_image_mean.cpp:99] Processed 400 files.
  I0215 01:42:17.661558 11659 compute_image_mean.cpp:106] Write to /home/andrew/caffe/data/ilsvrc12/imagenet_mean.binaryproto
  I0215 01:42:17.666162 11659 compute_image_mean.cpp:112] Number of channels: 3
  I0215 01:42:17.666352 11659 compute_image_mean.cpp:117] mean_value channel [0]:132.566
  I0215 01:42:17.666553 11659 compute_image_mean.cpp:117] mean_value channel [1]:150.438
  I0215 01:42:17.666694 11659 compute_image_mean.cpp:117] mean_value channel [2]:154.507
  </code></pre>
  </blockquote>