前提・実現したいこと
オライリーの直感deeplerningを読みながらquiver-engineを使用し、localhostでデVGG16モデルの可視化を行おうとしています。
localhost:8000を開くと./sample_images内の画像が表示され画像を選択すると、Select a layerと表示されるのですが選択すべきレイヤーが表示されません。
本来であれば画面左にレイヤーが表示されるはずです。
下記のコードに「コマンドの構文が間違っています」と出ているのはこちらの質問にある通りmkdirコマンドの構文エラーであり./tmpを自作すれば問題ないのかなと思っています(違うかもしれません)。
KerasやTensorFlowについても素人で丸一日この問題が解決できず困っております。
質問も下手くそで恐縮ですが、何卒宜しくお願いします。
該当のソースコード
python
1>>> from keras.applications.vgg16 import VGG16 22021-09-26 20:44:16.997340: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 32021-09-26 20:44:16.997606: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. 4>>> from quiver_engine import server 5>>> model = VGG16() 62021-09-26 20:44:25.368588: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library nvcuda.dll 72021-09-26 20:44:25.394442: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1716] Found device 0 with properties: 8pciBusID: 0000:01:00.0 name: GeForce GTX 1660 SUPER computeCapability: 7.5 9coreClock: 1.8GHz coreCount: 22 deviceMemorySize: 6.00GiB deviceMemoryBandwidth: 312.97GiB/s 102021-09-26 20:44:25.396509: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 112021-09-26 20:44:25.398060: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cublas64_10.dll'; dlerror: cublas64_10.dll not found 122021-09-26 20:44:25.401379: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cufft64_10.dll 132021-09-26 20:44:25.403012: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library curand64_10.dll 142021-09-26 20:44:25.410150: I tensorflow/stream_executor/platform/default/dso_loader.cc:48] Successfully opened dynamic library cusolver64_10.dll 152021-09-26 20:44:25.411627: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cusparse64_10.dll'; dlerror: cusparse64_10.dll not found 162021-09-26 20:44:25.413387: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudnn64_7.dll'; dlerror: cudnn64_7.dll not found 172021-09-26 20:44:25.413726: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1753] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform. 18Skipping registering GPU devices... 192021-09-26 20:44:25.414365: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2 20To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 212021-09-26 20:44:25.421323: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1e0c58bc420 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 222021-09-26 20:44:25.421614: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version 232021-09-26 20:44:25.422078: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1257] Device interconnect StreamExecutor with strength 1 edge matrix: 242021-09-26 20:44:25.422365: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1263] 25>>> server.launch(model, input_folder='./sample_images', temp_folder='./tmp', port=8000) 26コマンドの構文が誤っています。 27Starting webserver from: C:\Users\kubo\anaconda3\envs\python_for_ch02\lib\site-packages\quiver_engine 28::1 - - [2021-09-26 20:44:30] "GET / HTTP/1.1" 304 173 0.001026 29::1 - - [2021-09-26 20:44:30] "GET /app.c1d3d21cfba8c1aabed6806773c8f0ba.css HTTP/1.1" 304 203 0.000997 30::1 - - [2021-09-26 20:44:30] "GET /vendor.280c5ce1d78077ee8d66.js HTTP/1.1" 304 193 0.000998 31::1 - - [2021-09-26 20:44:30] "GET /app.14b8092d6ea379715007.js HTTP/1.1" 304 190 0.000997 32::1 - - [2021-09-26 20:44:30] "GET /model HTTP/1.1" 200 10742 0.006952 33::1 - - [2021-09-26 20:44:30] "GET /inputs HTTP/1.1" 200 162 0.000000 34::1 - - [2021-09-26 20:44:30] "GET /input-file/cat.png HTTP/1.1" 304 170 0.000997 35::1 - - [2021-09-26 20:44:30] "GET /input-file/dog.png HTTP/1.1" 304 170 0.000998
補足情報(FW/ツールのバージョンなど)
環境:Windows10
Python3.6
Anaconda3で仮想環境を作成し、パッケージのインストールはpip install -r requirements-windows.txtで行いました。
keras==2.4.3 tensorflow==2.3.0 gevent==21.8.0 git+https://github.com/SnowMasaya/quiver h5py==2.10.0
試したこと
ここに至るまでにいくつかエラーが発生したためquiver_engineに手を加えています。
server.py
こちらを参考に変更を加えました。
python
1# from gevent.wsgi import WSGIServer 2from gevent.pywsgi import WSGIServer
file_utils.py
こちらを参考に変更を加えました。
python
1# from imageio import imwrite 2# ... 3# imsave(filename, deprocess_image(layer_outputs)) 4 5import imageio 6... 7 imageio.imwrite(filename, deprocess_image(layer_outputs)) 8
util.py
こちらを参考に変更を加えました。
python
1def get_input_config(model): 2 ''' 3 returns a tuple (inputDimensions, numChannels) 4 ''' 5 # return ( 6 # model.get_input_shape_at(0)[2:4], 7 # model.get_input_shape_at(0)[1] 8 # ) if K.image_data_format() == 'th' else ( 9 # # ) if K.image_dim_ordering() == 'th' else ( 10 # #tf ordering 11 # model.get_input_shape_at(0)[1:3], 12 # model.get_input_shape_at(0)[3] 13 # ) 14 return ( 15 model.get_config(0), 16 model.get_config(0) 17 ) if K.image_data_format() == 'th' else ( 18 #tf ordering 19 model.get_layer(index=0).get_config(), 20 model.get_layer(index=0).get_config() 21 )
回答1件
あなたの回答
tips
プレビュー