前提・実現したいこと
お世話になっております。
pycharm上で、
こちらのコード
実行すると、エラーが出ます。
発生している問題・エラーメッセージ
/usr/local/bin/python3.9 /Users/SN/PycharmProjects/3/3/Pretrainedvgg16_unet/inception_resnetv2.py 2021-12-22 10:29:17.153723: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. Downloading data from https://storage.googleapis.com/tensorflow/keras-applications/inception_resnet_v2/inception_resnet_v2_weights_tf_dim_ordering_tf_kernels_notop.h5 Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1342, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1010, in _send_output self.send(msg) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 950, in send self.connect() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/http/client.py", line 1424, in connect self.sock = self._context.wrap_socket(self.sock, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 500, in wrap_socket return self.sslsocket_class._create( File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1040, in _create self.do_handshake() File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/ssl.py", line 1309, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/SN/Library/Python/3.9/lib/python/site-packages/keras/utils/data_utils.py", line 276, in get_file urlretrieve(origin, fpath, dl_progress) File "/Users/SN/Library/Python/3.9/lib/python/site-packages/keras/utils/data_utils.py", line 82, in urlretrieve response = urlopen(url, data) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 214, in urlopen return opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 517, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 534, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 494, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1385, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/urllib/request.py", line 1345, in do_open raise URLError(err) urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)> During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/SN/PycharmProjects/3/3/Pretrainedvgg16_unet/inception_resnetv2.py", line 28, in <module> build_inception_resnetv2(input_shape) File "/Users/SN/PycharmProjects/3/3/Pretrainedvgg16_unet/inception_resnetv2.py", line 21, in build_inception_resnetv2 encoder = InceptionResNetV2(include_top=False, weights='imagenet', input_tensor=input) File "/Users/SN/Library/Python/3.9/lib/python/site-packages/keras/applications/inception_resnet_v2.py", line 243, in InceptionResNetV2 weights_path = data_utils.get_file( File "/Users/SN/Library/Python/3.9/lib/python/site-packages/keras/utils/data_utils.py", line 280, in get_file raise Exception(error_msg.format(origin, e.errno, e.reason)) Exception: URL fetch failure on https://storage.googleapis.com/tensorflow/keras-applications/inception_resnet_v2/inception_resnet_v2_weights_tf_dim_ordering_tf_kernels_notop.h5: None -- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)
該当のソースコード
from tensorflow.keras.layers import Conv2D, BatchNormalization, Activation, MaxPool2D, Conv2DTranspose, Concatenate, Input, ZeroPadding2D from tensorflow.keras.models import Model from tensorflow.keras.applications import InceptionResNetV2 def conv_block(input, num_filters): x = Conv2D(num_filters, 3, padding='same')(input) x = BatchNormalization()(x) x = Activation('relu')(x) x = Conv2D(num_filters, 3, padding='same')(x) x = BatchNormalization()(x) x = Activation('relu')(x) def build_inception_resnetv2(input_shape): input = Input(input_shape) encoder = InceptionResNetV2(include_top=False, weights='imagenet', input_tensor=input) encoder.summary() if __name__ == '__main__': input_shape = [512, 512, 3] build_inception_resnetv2(input_shape)
試したこと
1,こちらを参考にしたのですが、modelの仕様が、ゴリ押しでおこなっているので、少し違うのかなと存じ上げております。
2,terminalではできました。(環境構築では、pip install tensorflowは、pycharm,terminal両方同じように入れました。
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
Python3 (3.9)
pycharm 2020.3.5
macbookpro 16
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。