質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Keras

Kerasは、TheanoやTensorFlow/CNTK対応のラッパーライブラリです。DeepLearningの数学的部分を短いコードでネットワークとして表現することが可能。DeepLearningの最新手法を迅速に試すことができます。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

PyCharm

エディター・開発ツール

Q&A

解決済

1回答

1770閲覧

kerasのmodelを呼ぶ際にエラーが出ます。(pycharm上)

Deep_passion

総合スコア45

Keras

Kerasは、TheanoやTensorFlow/CNTK対応のラッパーライブラリです。DeepLearningの数学的部分を短いコードでネットワークとして表現することが可能。DeepLearningの最新手法を迅速に試すことができます。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

PyCharm

エディター・開発ツール

0グッド

0クリップ

投稿2021/12/22 02:16

前提・実現したいこと

お世話になっております。
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

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

[512, 512, 3] ==> (512, 512, 3)でなおりました。

投稿2021/12/22 02:19

Deep_passion

総合スコア45

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問