If you have error in this command ;

from tensorflow.examples.tutorials.mnist import input_data

mnist_data = input_data.read_data_sets('MNIST_data',one_hot=True)

 

File "F:\software\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile
execfile(filename, namespace)
File "F:\software\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "H:/matlab1.com/product Video/Deep Learning for Computer Vision/Chapter2/Code/main1.py", line 19, in <module>
mnist_data = input_data.read_data_sets('MNIST_data',one_hot=True)
File "F:\software\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 250, in new_func
return func(*args, **kwargs)
File "F:\software\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\mnist.py", line 260, in read_data_sets
local_file = base.maybe_download(TRAIN_IMAGES, train_dir,
File "F:\software\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 250, in new_func
return func(*args, **kwargs)
File "F:\software\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py", line 252, in maybe_download
temp_file_name, _ = urlretrieve_with_retry(source_url)
File "F:\software\Anaconda3\lib\site-packages\tensorflow\python\util\deprecation.py", line 250, in new_func
return func(*args, **kwargs)
File "F:\software\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py", line 205, in wrapped_fn
return fn(*args, **kwargs)
File "F:\software\Anaconda3\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py", line 233, in urlretrieve_with_retry
return urllib.request.urlretrieve(url, filename)
File "F:\software\Anaconda3\lib\urllib\request.py", line 248, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "F:\software\Anaconda3\lib\urllib\request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "F:\software\Anaconda3\lib\urllib\request.py", line 532, in open
response = meth(req, response)
File "F:\software\Anaconda3\lib\urllib\request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "F:\software\Anaconda3\lib\urllib\request.py", line 570, in error
return self._call_chain(*args)
File "F:\software\Anaconda3\lib\urllib\request.py", line 504, in _call_chain
result = func(*args)
File "F:\software\Anaconda3\lib\urllib\request.py", line 650, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
HTTPError: Forbidden

 

solution :

This error is because of wrong path for MNIST dataset in mnist python code in TensorFlow.

 

to solve change your code to the following code :

from tensorflow.examples.tutorials.mnist import input_data
mnist_data = input_data.read_data_sets('MNIST_data',one_hot=True,
source_url='http://yann.lecun.com/exdb/mnist/')