티스토리 뷰
[업데이트 2018.03.18 14:11]
Tensorflow 예제 중에 MNIST data에 대해 classification하는 예제가 있습니다. 해당 예제의 경우 MNIST data를 다운로드를 하는데, 만약 다음과 같은 오류가 발생할 경우 proxy server 설정이 되어 있지 않은 경우입니다.
C:\Python36\python.exe C:/dev/ai/NeuralNetwork03.py Traceback (most recent call last): File "C:\Python36\lib\urllib\request.py", line 1318, in do_open encode_chunked=req.has_header('Transfer-encoding')) File "C:\Python36\lib\http\client.py", line 1239, in request self._send_request(method, url, body, headers, encode_chunked) File "C:\Python36\lib\http\client.py", line 1285, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "C:\Python36\lib\http\client.py", line 1234, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "C:\Python36\lib\http\client.py", line 1026, in _send_output self.send(msg) File "C:\Python36\lib\http\client.py", line 964, in send self.connect() File "C:\Python36\lib\http\client.py", line 1400, in connect server_hostname=server_hostname) File "C:\Python36\lib\ssl.py", line 407, in wrap_socket _context=self, _session=session) File "C:\Python36\lib\ssl.py", line 814, in __init__ self.do_handshake() File "C:\Python36\lib\ssl.py", line 1068, in do_handshake self._sslobj.do_handshake() File "C:\Python36\lib\ssl.py", line 689, in do_handshake self._sslobj.do_handshake() ssl.SSLError: [SSL: TLSV1_ALERT_ACCESS_DENIED] tlsv1 alert access denied (_ssl.c:777) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:/dev/ai/NeuralNetwork03.py", line 10, inmnist = input_data.read_data_sets("MNIST_data/", one_hot=True) File "C:\Python36\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\mnist.py", line 235, in read_data_sets SOURCE_URL + TRAIN_IMAGES) File "C:\Python36\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py", line 208, in maybe_download temp_file_name, _ = urlretrieve_with_retry(source_url) File "C:\Python36\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py", line 165, in wrapped_fn return fn(*args, **kwargs) File "C:\Python36\lib\site-packages\tensorflow\contrib\learn\python\learn\datasets\base.py", line 190, in urlretrieve_with_retry return urllib.request.urlretrieve(url, filename) File "C:\Python36\lib\urllib\request.py", line 248, in urlretrieve with contextlib.closing(urlopen(url, data)) as fp: File "C:\Python36\lib\urllib\request.py", line 223, in urlopen return opener.open(url, data, timeout) File "C:\Python36\lib\urllib\request.py", line 526, in open response = self._open(req, data) File "C:\Python36\lib\urllib\request.py", line 544, in _open '_open', req) File "C:\Python36\lib\urllib\request.py", line 504, in _call_chain result = func(*args) File "C:\Python36\lib\urllib\request.py", line 1361, in https_open context=self._context, check_hostname=self._check_hostname) File "C:\Python36\lib\urllib\request.py", line 1320, in do_open raise URLError(err) urllib.error.URLError: Process finished with exit code 1
Windows 기준으로 환경변수로 아래와 같이 추가하게 되면 해결 할 수 있습니다.
HTTP_PROXY=http://proxy_server_hostname:proxy_server_port HTTPS_PROXY=https://proxy_server_hostname:proxy_server_port
수정 후 정상적으로 실행된 결과입니다.
Microsoft Windows [Version 10.0.10586] (c) 2015 Microsoft Corporation. All rights reserved. C:\>C:\Python36\python.exe C:/dev/ai/NeuralNetwork03.py Successfully downloaded train-images-idx3-ubyte.gz 9912422 bytes. Extracting MNIST_data/train-images-idx3-ubyte.gz Successfully downloaded train-labels-idx1-ubyte.gz 28881 bytes. Extracting MNIST_data/train-labels-idx1-ubyte.gz Successfully downloaded t10k-images-idx3-ubyte.gz 1648877 bytes. Extracting MNIST_data/t10k-images-idx3-ubyte.gz Successfully downloaded t10k-labels-idx1-ubyte.gz 4542 bytes. Extracting MNIST_data/t10k-labels-idx1-ubyte.gz WARNING:tensorflow:From C:/dev/ai/NeuralNetwork03.py:29: arg_max (from tensorflow.python.ops.gen_math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use `argmax` instead WARNING:tensorflow:From C:/dev/ai/NeuralNetwork03.py:29: arg_max (from tensorflow.python.ops.gen_math_ops) is deprecated and will be removed in a future version. Instructions for updating: Use `argmax` instead 2017-11-16 15:09:22.738972: W C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. 2017-11-16 15:09:22.741257: W C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations. 2017-11-16 15:09:24.761612: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:955] Found device 0 with properties: name: Quadro M1000M major: 5 minor: 0 memoryClockRate (GHz) 1.0715 pciBusID 0000:01:00.0 Total memory: 2.00GiB Free memory: 1.65GiB 2017-11-16 15:09:24.764200: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:976] DMA: 0 2017-11-16 15:09:24.765900: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:986] 0: Y 2017-11-16 15:09:24.767794: I C:\tf_jenkins\home\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1045] Creating TensorFlow device (/gpu:0) -> (device: 0, name: Quadro M1000M, pci bus id: 0000:01:00.0) Epoch: 0001 cost = 2.826302619 Epoch: 0002 cost = 1.061668924 Epoch: 0003 cost = 0.838061295 Epoch: 0004 cost = 0.733232720 Epoch: 0005 cost = 0.669279865 Epoch: 0006 cost = 0.624611813 Epoch: 0007 cost = 0.591160332 Epoch: 0008 cost = 0.563868975 Epoch: 0009 cost = 0.541745164 Epoch: 0010 cost = 0.522673562 Epoch: 0011 cost = 0.506782307 Epoch: 0012 cost = 0.492447628 Epoch: 0013 cost = 0.479955819 Epoch: 0014 cost = 0.468893656 Epoch: 0015 cost = 0.458703467 Learning finished Accuracy: 0.8951 Label: [8] Prediction: [8] C:\>
** MAC의 경우 터미널에서 아래와 같이 실행
/Applications/Python\ 3.6/Install\ Certificates.command
* 참고 : https://www.tensorflow.org/get_started/mnist/beginners
* 참고 : https://hunkim.github.io/ml/
* 참고 : https://github.com/tensorflow/tensorflow/issues/10779
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- #ApacheZeppelin
- some time ago
- #ApacheSpark
- Sea Bottom
- Game Engine
- 도커
- docker
- Meow
- English
- Jekyll and Hyde
- Physical Simulation
- Mask R-CNN
- sentence test
- Ragdoll
- ate
- Memorize
- belief
- GOD
- #TensorFlow
- aws #cloudfront
- Worry
- #ELK Stack
- 2D Game
- Badge
- #REST API
- ILoop Engine
- Library
- SSM
- project
- OST
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 | 16 | 17 | 18 | 19 | 20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 |
29 | 30 | 31 |
글 보관함