HOME
  Security
   Software
    Hardware
  
FPGA
  CPU
   Android
    Raspberry Pi
  
nLite
  Xcode
   etc.
    ALL
  
English Translate 中文翻訳
LINK
BACK
 

[NEW] 2020/06/25

【2020年版】NVIDIA Jetson Nanoで TensorFlowの StyleGANを動かして、顔画像を生成 【2020年版】NVIDIA Jetson Nanoで TensorFlowの StyleGANを動かして、顔画像を生成

(NVIDIA Jetson Nano JetPack StyleGAN、敵対的生成ネットワーク AIで自然な顔画像を生成する)

Tags: [Raspberry Pi], [電子工作], [ディープラーニング]





● Jetson Xavier NXを国内定価よりも安く買う!!ザビエル元年!!

[NEW] 2020/06/27
【2020年】Jetson Xavier NX 開発者キットが安かったので衝動買いした件、標準販売価格5万円が4万4千円!
【2020年】Jetson Xavier NX 開発者キットが安かったので衝動買いした件、標準販売価格5万円が4万4千円!

  【ザビエル元年】Jetson Xavier NX 開発者キットを最安値で購入で、しかも国内在庫で注文から翌日で到着、ザビエル開封レビュー


● Jetson Nanoの初期設定、最高速で動かす設定、空きメモリを増やす方法等
 6GBのスワップ設定が必要。

[NEW] 2020/06/13
【2020年版】NVIDIA Jetson Nanoの初期設定、最高速で動かす設定、空きメモリを増やす方法等
【2020年版】NVIDIA Jetson Nanoの初期設定、最高速で動かす設定、空きメモリを増やす方法等

  2020年の JetPack 4.4になっても nvccのパスがデフォルトで通って無いとか、初期設定が必要です


● NVIDIA Jetson Nano、Jetson Xavier NX 開発者キット TensorFlow on Jetson Platform

 TensorFlowを Jetson Nano、Jetson Xavier NXにインストールする方法。


[NEW] 2020/06/28
Jetson Nano、Jetson Xavier NX 開発者キット TensorFlow on Jetson Platform
Jetson Nano、Jetson Xavier NX 開発者キット TensorFlow on Jetson Platform

  NVIDIA Jetson Nano、Jetson Xavier NX Developer TensorFlow on Jetson Platform


● 2020年版 NVIDIA Jetson Nano JetPack StyleGAN TensorFlow

 Jetson Nano JetPack 4.3
 Jetson Nano JetPack 4.4
 Jetson Xavier NX JetPack 4.4

 GAN = Generative Adversarial Networks 敵対的生成ネットワーク

 Official TensorFlow for Jetson Nano
Install TensorFlow for Jetson Platform
Official TensorFlow for Jetson Nano

 StyleGAN
StyleGAN - Official TensorFlow Implementation

 StyleGAN2(StyleGANの改良版)
StyleGAN2 - Official TensorFlow Implementation

手塚治虫の伝説的な作品をもとに、AI が新作漫画の制作を支援



● Install StyleGAN TensorFlow on Jetson JetPack

# StyleGAN
cd
git clone https://github.com/NVlabs/stylegan --depth 1
cd stylegan
python3 pretrained_example.py

# Traceback (most recent call last):
#   File "pretrained_example.py", line 12, in <module>
#     import numpy as np
# ModuleNotFoundError: No module named 'numpy'

● StyleGANの実行には TensorFlow v1系が必要なので NVIDIA公式の手順でインストールする
# Install TensorFlow for Jetson Platform

# Install system packages required by TensorFlow
sudo apt-get update
sudo apt-get -y install libhdf5-serial-dev hdf5-tools libhdf5-dev zlib1g-dev zip libjpeg8-dev liblapack-dev libblas-dev gfortran

# Install and upgrade pip3.
sudo apt-get -y install python3-pip
# sudo pip3 install -U pip testresources setuptools

# Install Cython
#         raise OSError('Cython needs to be installed in Python as a module')
# sudo pip3 install --no-use-wheel --no-cache-dir Cython
# DEPRECATION: --no-use-wheel is deprecated and will be removed in the future.  Please use --no-binary :all: instead.
# https://kurozumi.github.io/pip/reference/pip_wheel.html
sudo pip3 install --no-binary :all: --no-cache-dir Cython

# Install the Python package dependencies.
sudo pip3 install -U numpy==1.16.1 future==0.17.1 mock==3.0.5 h5py==2.9.0 keras_preprocessing==1.0.5 keras_applications==1.0.8 gast==0.2.2 futures protobuf pybind11

#         raise OSError('Cython needs to be installed in Python as a module')
#     OSError: Cython needs to be installed in Python as a module
#     Running from numpy source directory.
#     /tmp/easy_install-na5g1t43/numpy-1.19.0/setup.py:460: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
#     ----------------------------------------
# Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-eoih3y93/h5py/

# TensorFlow 1.x Jetson Nano JetPack 4.3
# https://developer.download.nvidia.com/compute/redist/jp/v43/tensorflow/tensorflow-1.15.2+nv20.3-cp36-cp36m-linux_aarch64.whl
# sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v43 tensorflow==1.15.2+nv20.3
#   File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/models.py", line 935, in raise_for_status
#     raise HTTPError(http_error_msg, response=self)
# requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://developer.download.nvidia.com/compute/redist/jp/v43/opt-einsum/
# --no-cache-dirを付ける
sudo pip3 install --pre --no-cache-dir --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v43 tensorflow==1.15.2+nv20.3

#   Running setup.py install for absl-py ... done
#   Running setup.py install for termcolor ... done
#   Running setup.py install for grpcio ... done
#   Running setup.py install for wrapt ... done
# Successfully installed absl-py-0.9.0 astor-0.8.1 google-pasta-0.2.0 grpcio-1.30.0 importlib-metadata-1.6.1 markdown-3.2.2 opt-einsum-3.2.1 tensorboard-1.15.0 tensorflow-1.15.2+nv20.3.tf1 tensorflow-estimator-1.15.1 termcolor-1.1.0 werkzeug-1.0.1 wrapt-1.12.1 zipp-3.1.0

# Verifying The Installation
# TF-1.15 tensorflow-1.15.2+nv20.3-cp36-cp36m-linux_aarch64.whl
python3 -c "import tensorflow; print (tensorflow.__version__)"
# 1.15.2

● StyleGANを実行する
python3 pretrained_example.py
# Traceback (most recent call last):
#   File "pretrained_example.py", line 13, in <module>
#     import PIL.Image
# ModuleNotFoundError: No module named 'PIL'

# ModuleNotFoundError: No module named 'PIL'
sudo pip3 install pillow

sudo pip3 install pillow
# The directory '/home/jetson/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
# The directory '/home/jetson/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
# Requirement already satisfied: pillow in /usr/local/lib/python3.6/dist-packages

# jetson@jetson-desktop:~/stylegan $ pip3 -V
# pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)

pretrained_example.py
# Using pre-trained networks
python3 pretrained_example.py

2020-06-26 00:02:43.493830: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
WARNING:tensorflow:From /home/jetson/stylegan/dnnlib/tflib/tfutil.py:34: The name tf.Dimension is deprecated. Please use tf.compat.v1.Dimension instead.

WARNING:tensorflow:From /home/jetson/stylegan/dnnlib/tflib/tfutil.py:74: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

WARNING:tensorflow:From /home/jetson/stylegan/dnnlib/tflib/tfutil.py:128: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

WARNING:tensorflow:From /home/jetson/stylegan/dnnlib/tflib/tfutil.py:97: The name tf.get_default_session is deprecated. Please use tf.compat.v1.get_default_session instead.
...
2020-06-26 00:02:49.388855: W tensorflow/core/platform/profile_utils/cpu_utils.cc:98] Failed to find bogomips in /proc/cpuinfo; cannot determine CPU frequency
2020-06-26 00:02:49.389325: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x122db0f0 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-06-26 00:02:49.389382: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-06-26 00:02:49.397224: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-06-26 00:02:49.455965: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:950] ARM64 does not support NUMA - returning NUMA node zero
2020-06-26 00:02:49.456256: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x12288d50 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-06-26 00:02:49.456316: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): NVIDIA Tegra X1, Compute Capability 5.3
2020-06-26 00:02:49.456738: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:950] ARM64 does not support NUMA - returning NUMA node zero
2020-06-26 00:02:49.456852: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1639] Found device 0 with properties:
name: NVIDIA Tegra X1 major: 5 minor: 3 memoryClockRate(GHz): 0.9216
pciBusID: 0000:00:00.0
...
2020-06-26 00:02:50.625538: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1325] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 807 MB memory) -> physical GPU (device: 0, name: NVIDIA Tegra X1, pci bus id: 0000:00:00.0, compute capability: 5.3)
Downloading https://drive.google.com/uc?id=1MEGjdvVpUsu1jB4zrXZN7Y4kBBOzizDQ .... done
WARNING:tensorflow:From /home/jetson/stylegan/dnnlib/tflib/network.py:142: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.

Gs                              Params    OutputShape          WeightShape
---                             ---       ---                  ---
latents_in                      -         (?, 512)             -
...
G_synthesis/noise17             -         (1, 1, 1024, 1024)   -
images_out                      -         (?, 3, 1024, 1024)   -
---                             ---       ---                  ---
Total                           26219627

2020-06-26 00:05:21.044356: W tensorflow/core/common_runtime/bfc_allocator.cc:239] Allocator (GPU_0_bfc) ran out of memory trying to allocate 313.00MiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.

Allocator (GPU_0_bfc) ran out of memory trying to allocate 313.00MiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
 意味:メモリがもっと沢山あれば、パフォーマンス(動作速度)が良くなるよ。

# Using pre-trained networks
python3 pretrained_example.py

# 2020-06-26 00:08:18.306368: W tensorflow/core/common_runtime/bfc_allocator.cc:239] Allocator (GPU_0_bfc) ran out of memory trying to allocate 2.27GiB with freed_by_count=0. The caller indicates that this is not a failure, but may mean that there could be performance gains if more memory were available.
# https://stackoverflow.com/questions/37327312/what-can-i-do-to-run-specific-tensorflow-calculations-on-a-cpu-as-part-of-a-gpu
# What can I do to run specific TensorFlow calculations on a CPU as part of a GPU implementation ?

# https://github.com/tensorflow/tensorflow/issues/35264
# ran out of memory trying to allocate #35264

free -h
              total        used        free      shared  buff/cache   available
Mem:           3.9G        1.0G        2.6G        3.1M        293M        3.2G
Swap:          6.0G        106M        5.9G

# example.png
ls -l results/
# -rw-rw-r-- 1 jetson jetson 1678371  6月 26 00:35 example.png

generate_figures.py
# A more advanced example is given in generate_figures.py
python3 generate_figures.py

# メモリ不足で死亡 OOM = Out Of Memory
  (0) Resource exhausted: OOM when allocating tensor with shape[8,16,1024,1024] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
         [[node Gs/_Run/Gs/G_synthesis/cond/cond/cond/cond/cond/cond/cond/1024x1024/Conv0_up/conv2d_transpose (defined at /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py:1748) ]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

         [[Gs/_Run/saturate_cast/_1421]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

  (1) Resource exhausted: OOM when allocating tensor with shape[8,16,1024,1024] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
         [[node Gs/_Run/Gs/G_synthesis/cond/cond/cond/cond/cond/cond/cond/1024x1024/Conv0_up/conv2d_transpose (defined at /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/framework/ops.py:1748) ]]
Hint: If you want to see a list of allocated tensors when OOM happens, add report_tensor_allocations_upon_oom to RunOptions for current allocation info.

# Google Driveの転送量が多すぎでダウンロードの打ち止め Google Drive quota exceeded
Downloading https://drive.google.com/uc?id=1MQywl0FNt6lHu8E_EUqnRbviagS7fbiJ ............ failed
Traceback (most recent call last):
  File "generate_figures.py", line 159, in <module>
    main()
  File "generate_figures.py", line 154, in main
    draw_uncurated_result_figure(os.path.join(config.result_dir, 'figure12-uncurated-cats.png'), load_Gs(url_cats), cx=0, cy=0, cw=256, ch=256, rows=5, lods=[0,0,1,1,2,2,2], seed=1)
  File "generate_figures.py", line 33, in load_Gs
    with dnnlib.util.open_url(url, cache_dir=config.cache_dir) as f:
  File "/home/jetson/stylegan/dnnlib/util.py", line 378, in open_url
    raise IOError("Google Drive quota exceeded")
OSError: Google Drive quota exceeded
# Google Driveの転送量が多すぎでダウンロードの打ち止め Google Drive quota exceeded
# 翌日とかに時間を置いて再度試す(転送量がリセットされるのでダウンロードできる)


● AIで生成した顔画像

 Jetson Nanoで数分の初期設定後に 3秒程度で 1枚の顔画像を生成します。

python3 pretrained_example.py
・NVIDIA Jetson Nano JetPack 4.3 StyleGAN TensorFlow
NVIDIA Jetson Nano JetPack 4.3 StyleGAN TensorFlow


・NVIDIA Jetson Nano JetPack 4.3 StyleGAN TensorFlow
NVIDIA Jetson Nano JetPack 4.3 StyleGAN TensorFlow


・NVIDIA Jetson Nano JetPack 4.3 StyleGAN TensorFlow
NVIDIA Jetson Nano JetPack 4.3 StyleGAN TensorFlow


・NVIDIA Jetson Nano JetPack 4.3 StyleGAN TensorFlow
NVIDIA Jetson Nano JetPack 4.3 StyleGAN TensorFlow



● pretrained_example.pyを改造して AIによる人工顔画像を 100枚生成する

 forループを追加して、RandomState()の引数部分を削除。
 ※ Python言語はインデント(段組)でループ等のネストを認識するので段組の修正も必要。
pretrained_example.py
 黄色行が追加、変更の行。
...
    # Print network details.
    Gs.print_layers()

    for i in range(100):
      print(i)

      # Pick latent vector.
      rnd = np.random.RandomState()
      latents = rnd.randn(1, Gs.input_shape[1])

      # Generate image.
      fmt = dict(func=tflib.convert_images_to_uint8, nchw_to_nhwc=True)
      images = Gs.run(latents, None, truncation_psi=0.7, randomize_noise=True, output_transform=fmt)

      # Save image.
      os.makedirs(config.result_dir, exist_ok=True)
      png_filename = os.path.join(config.result_dir, 'example_'+ str(i).zfill(3) +'.png')
      PIL.Image.fromarray(images[0], 'RGB').save(png_filename)

・Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで顔画像を生成
Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで顔画像を生成


・Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで顔画像を生成
Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで顔画像を生成


・Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで顔画像を生成
Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで顔画像を生成




● TensorFlow チュートリアル

# A more advanced example is given in generate_figures.py

 全部が有効だとメモリ不足で死ぬので、コメントアウトする。
 (下記の例は一番下の行の「猫」サンプルだけを残して有効にした場合)

generate_figures.py
...

def main():
    tflib.init_tf()
    os.makedirs(config.result_dir, exist_ok=True)
#    draw_uncurated_result_figure(os.path.join(config.result_dir, 'figure02-uncurated-ffhq.png'), load_Gs(url_ffhq), cx=0, cy=0, cw=1024, ch=1024, rows=3, lods=[0,1,2,2,3,3], seed=5)
#    draw_style_mixing_figure(os.path.join(config.result_dir, 'figure03-style-mixing.png'), load_Gs(url_ffhq), w=1024, h=1024, src_seeds=[639,701,687,615,2268], dst_seeds=[888,829,1898,1733,1614,845], style_ranges=[range(0,4)]*3+[range(4,8)]*2+[range(8,18)])
#    draw_noise_detail_figure(os.path.join(config.result_dir, 'figure04-noise-detail.png'), load_Gs(url_ffhq), w=1024, h=1024, num_samples=100, seeds=[1157,1012])
#    draw_noise_components_figure(os.path.join(config.result_dir, 'figure05-noise-components.png'), load_Gs(url_ffhq), w=1024, h=1024, seeds=[1967,1555], noise_ranges=[range(0, 18), range(0, 0), range(8, 18), range(0, 8)], flips=[1])
#    draw_truncation_trick_figure(os.path.join(config.result_dir, 'figure08-truncation-trick.png'), load_Gs(url_ffhq), w=1024, h=1024, seeds=[91,388], psis=[1, 0.7, 0.5, 0, -0.5, -1])
#    draw_uncurated_result_figure(os.path.join(config.result_dir, 'figure10-uncurated-bedrooms.png'), load_Gs(url_bedrooms), cx=0, cy=0, cw=256, ch=256, rows=5, lods=[0,0,1,1,2,2,2], seed=0)
#    draw_uncurated_result_figure(os.path.join(config.result_dir, 'figure11-uncurated-cars.png'), load_Gs(url_cars), cx=0, cy=64, cw=512, ch=384, rows=4, lods=[0,1,2,2,3,3], seed=2)
    draw_uncurated_result_figure(os.path.join(config.result_dir, 'figure12-uncurated-cats.png'), load_Gs(url_cats), cx=0, cy=0, cw=256, ch=256, rows=5, lods=[0,0,1,1,2,2,2], seed=1)

● Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで猫画像を生成

cw=256, ch=256, rows=5, lods=[0,0,1,1,2,2,2]
生成される画像の大きさ 960x1280
画像の基準の大きさ cw=256, ch=256
縦の画像の個数 rows=5
横軸に並べる画像の個数と大きさ(分割数) lods=[0,0,1,1,2,2,2]
乱数の種 seed=1
・Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで猫画像を生成
Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで猫画像を生成



●指定例
    draw_uncurated_result_figure(os.path.join(config.result_dir, 'figure12-uncurated-cats_2.png'), load_Gs(url_cats), cx=0, cy=0, cw=256, ch=256, rows=2, lods=[0,0,1,1], seed=12345)
生成される画像の大きさ 768x512
画像の基準の大きさ cw=256, ch=256
縦の画像の個数 rows=2
横軸に並べる画像の個数と大きさ(分割数) lods=[0,0,1,1]
乱数の種 seed=12345
・Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで猫画像を生成
Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで猫画像を生成


・Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで猫画像を生成
Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで猫画像を生成



● Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで自動車画像を生成
    draw_uncurated_result_figure(os.path.join(config.result_dir, 'figure11-uncurated-cars.png'), load_Gs(url_cars), cx=0, cy=64, cw=512, ch=384, rows=4, lods=[0,1,2,2,3,3], seed=2)
・Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで自動車画像を生成
Jetson Nano StyleGAN TensorFlow 敵対的生成ネットワークで自動車画像を生成




● TensorFlow チュートリアル

TensorFlow チュートリアル
TensorFlow 1.x tutorials (archived)

mnist.py
import tensorflow as tf

mnist = tf.keras.datasets.mnist

(x_train, y_train),(x_test, y_test) = mnist.load_data()
x_train, x_test = x_train / 255.0, x_test / 255.0

model = tf.keras.models.Sequential([
  tf.keras.layers.Flatten(input_shape=(28, 28)),
  tf.keras.layers.Dense(128, activation='relu'),
#  tf.keras.layers.Dense(512, activation=tf.nn.relu),
  tf.keras.layers.Dropout(0.2),
  tf.keras.layers.Dense(10, activation='softmax')
])

model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

model.fit(x_train, y_train, epochs=5)
model.evaluate(x_test, y_test)
nano mnist.py
python3 mnist.py
2020-06-25 23:57:41.028458: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/mnist.npz
11493376/11490434 [==============================] - 1s 0us/step
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
Train on 60000 samples
2020-06-25 23:57:50.724827: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2020-06-25 23:57:52.062096: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:950] ARM64 does not support NUMA - returning NUMA node zero
2020-06-25 23:57:52.062250: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1639] Found device 0 with properties:
name: NVIDIA Tegra X1 major: 5 minor: 3 memoryClockRate(GHz): 0.9216
pciBusID: 0000:00:00.0
2020-06-25 23:57:52.062359: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2020-06-25 23:57:54.269765: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2020-06-25 23:57:54.594083: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0
2020-06-25 23:57:55.444668: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0
2020-06-25 23:57:56.411056: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0
2020-06-25 23:57:56.777884: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0
2020-06-25 23:58:02.277521: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2020-06-25 23:58:02.277789: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:950] ARM64 does not support NUMA - returning NUMA node zero
2020-06-25 23:58:02.278006: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:950] ARM64 does not support NUMA - returning NUMA node zero
2020-06-25 23:58:02.278093: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1767] Adding visible gpu devices: 0
2020-06-25 23:58:02.299945: W tensorflow/core/platform/profile_utils/cpu_utils.cc:98] Failed to find bogomips in /proc/cpuinfo; cannot determine CPU frequency
2020-06-25 23:58:02.300485: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x76e9020 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2020-06-25 23:58:02.300542: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2020-06-25 23:58:02.590697: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:950] ARM64 does not support NUMA - returning NUMA node zero
2020-06-25 23:58:02.590989: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x61b2e80 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2020-06-25 23:58:02.591050: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): NVIDIA Tegra X1, Compute Capability 5.3
2020-06-25 23:58:02.591468: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:950] ARM64 does not support NUMA - returning NUMA node zero
2020-06-25 23:58:02.591587: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1639] Found device 0 with properties:
name: NVIDIA Tegra X1 major: 5 minor: 3 memoryClockRate(GHz): 0.9216
pciBusID: 0000:00:00.0
2020-06-25 23:58:02.591663: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2020-06-25 23:58:02.591728: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2020-06-25 23:58:02.591774: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0
2020-06-25 23:58:02.591819: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0
2020-06-25 23:58:02.591860: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0
2020-06-25 23:58:02.591900: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0
2020-06-25 23:58:02.591941: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2020-06-25 23:58:02.592075: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:950] ARM64 does not support NUMA - returning NUMA node zero
2020-06-25 23:58:02.592243: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:950] ARM64 does not support NUMA - returning NUMA node zero
2020-06-25 23:58:02.592324: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1767] Adding visible gpu devices: 0
2020-06-25 23:58:02.592417: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2020-06-25 23:58:03.855489: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1180] Device interconnect StreamExecutor with strength 1 edge matrix:
2020-06-25 23:58:03.855572: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1186]      0
2020-06-25 23:58:03.855609: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1199] 0:   N
2020-06-25 23:58:03.855914: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:950] ARM64 does not support NUMA - returning NUMA node zero
2020-06-25 23:58:03.856151: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:950] ARM64 does not support NUMA - returning NUMA node zero
2020-06-25 23:58:03.856306: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1325] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 74 MB memory) -> physical GPU (device: 0, name: NVIDIA Tegra X1, pci bus id: 0000:00:00.0, compute capability: 5.3)
Epoch 1/5
2020-06-25 23:58:04.501848: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
60000/60000 [==============================] - 34s 562us/sample - loss: 0.2949 - acc: 0.9151
Epoch 2/5
60000/60000 [==============================] - 17s 292us/sample - loss: 0.1449 - acc: 0.9566
Epoch 3/5
60000/60000 [==============================] - 16s 270us/sample - loss: 0.1077 - acc: 0.9673
Epoch 4/5
60000/60000 [==============================] - 16s 261us/sample - loss: 0.0905 - acc: 0.9719
Epoch 5/5
60000/60000 [==============================] - 16s 261us/sample - loss: 0.0757 - acc: 0.9760
10000/10000 [==============================] - 2s 165us/sample - loss: 0.0766 - acc: 0.9762



Jetson Nano JetPack 4.3で下記のインストールコマンドだと下記のエラーが出る

# TF-1.15 tensorflow-1.15.2+nv20.3-cp36-cp36m-linux_aarch64.whl
sudo pip3 install --pre --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v43 'tensorflow<2'

Collecting astor>=0.6.0 (from tensorflow<2)
Exception:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 342, in run
    requirement_set.prepare_files(finder)
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 380, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 554, in _prepare_file
    require_hashes
  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 278, in populate_link
    self.link = finder.find_requirement(self, upgrade)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 465, in find_requirement
    all_candidates = self.find_all_candidates(req.name)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 423, in find_all_candidates
    for page in self._get_pages(url_locations, project_name):
  File "/usr/lib/python3/dist-packages/pip/index.py", line 568, in _get_pages
    page = self._get_page(location)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 683, in _get_page
    return HTMLPage.get_page(link, session=self.session)
  File "/usr/lib/python3/dist-packages/pip/index.py", line 795, in get_page
    resp.raise_for_status()
  File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://developer.download.nvidia.com/compute/redist/jp/v43/astor/

●解決方法
Unable to install TensorFlow on Jetson Nano because of “404” on NVidia server


--no-cache-dir
 を付ける。

pip3 install --pre --no-cache-dir --extra-index-url https://developer.download.nvidia.com/compute/redist/jp/v42 tensorflow-gpu


● StyleGANの改良版の StyleGAN2

[NEW] 2020/06/25
【2020年版】NVIDIA Jetson Nanoで StyleGANの改良版の StyleGAN2で自然な画像を生成
【2020年版】NVIDIA Jetson Nanoで StyleGANの改良版の StyleGAN2で自然な画像を生成

  NVIDIA Jetson Nano JetPack StyleGAN2、敵対的生成ネットワーク AIで自然な顔画像を生成する


● Jetson Nanoで StyleGANを動かして可愛い美少女のアニメ顔を大量生産する方法

[NEW] 2020/06/25
【2020年版】Jetson Nanoで StyleGANを動かして可愛い美少女のアニメ顔を大量生産する方法
【2020年版】Jetson Nanoで StyleGANを動かして可愛い美少女のアニメ顔を大量生産する方法

  【俺の嫁】Jetson Nanoで StyleGANと StyleGAN2のそれぞれで、敵対的生成ネットワーク AIでアニメ顔を生成



Tags: [Raspberry Pi], [電子工作], [ディープラーニング]

●関連するコンテンツ(この記事を読んだ人は、次の記事も読んでいます)

【2020年版】NVIDIA Jetson Nano、Jetson Xavier NXの便利スクリプト
【2020年版】NVIDIA Jetson Nano、Jetson Xavier NXの便利スクリプト

  Jetsonの面倒な初期設定やミドルウェアのインストールを bashスクリプトの実行だけで簡単にできます

【2020年】Jetson Xavier NX 開発者キットが安かったので衝動買いした件、標準販売価格5万円が4万4千円!
【2020年】Jetson Xavier NX 開発者キットが安かったので衝動買いした件、標準販売価格5万円が4万4千円!

  【ザビエル元年】Jetson Xavier NX 開発者キットを最安値で購入で、しかも国内在庫で注文から翌日で到着、ザビエル開封レビュー

【2020年版】NVIDIA Jetson用に最新の CMake 3.17.3をビルドしてインストールする方法
【2020年版】NVIDIA Jetson用に最新の CMake 3.17.3をビルドしてインストールする方法

  2020年の JetPack 4.4になっても CMakeのバージョンが 3.10.2と古く OpenPoseのビルドでエラー発生の原因

【2020年版】NVIDIA JetPack 4.4 DP Developer Previewで OpenPoseのビルドエラーの対策方法
【2020年版】NVIDIA JetPack 4.4 DP Developer Previewで OpenPoseのビルドエラーの対策方法

  Jetson Nano、Jetson Xavier NX 開発者キット + JetPack 4.4 DPで OpenPoseをビルドする手順

Jetson Nano、Jetson Xavier NX 開発者キット TensorFlow on Jetson Platform
Jetson Nano、Jetson Xavier NX 開発者キット TensorFlow on Jetson Platform

  NVIDIA Jetson Nano、Jetson Xavier NX Developer TensorFlow on Jetson Platform

NVIDIA Jetson Nano 開発者キットを買ってみた。メモリ容量 4GB LPDDR4 RAM
NVIDIA Jetson Nano 開発者キットを買ってみた。メモリ容量 4GB LPDDR4 RAM

  Jetson Nanoで TensorFlow PyTorch Caffe/Caffe2 Keras MXNet等を GPUパワーで超高速で動かす!

【2020年版】NVIDIA Jetson Nanoの初期設定、最高速で動かす設定、空きメモリを増やす方法等
【2020年版】NVIDIA Jetson Nanoの初期設定、最高速で動かす設定、空きメモリを増やす方法等

  2020年の JetPack 4.4になっても nvccのパスがデフォルトで通って無いとか、初期設定が必要です

【2020年版】NVIDIA Jetson Nano JetPackのバージョン情報まとめ、JetPack 4.4 DPは不具合多い
【2020年版】NVIDIA Jetson Nano JetPackのバージョン情報まとめ、JetPack 4.4 DPは不具合多い

  最新の JetPackでは 2019年当時の殆どの記事の内容がそのままではエラーが出て動かない様になりました

【2020年版】NVIDIA Jetson Nano対応の FFmpegをビルドする手順
【2020年版】NVIDIA Jetson Nano対応の FFmpegをビルドする手順

  NVIDIA Jetson Nano対応の FFmpegをビルドする手順、x264と x265にも対応

【2020年版】NVIDIA Jetson Nano対応の OpenPoseをビルドする手順
【2020年版】NVIDIA Jetson Nano対応の OpenPoseをビルドする手順

  NVIDIA Jetson Nano対応の OpenPoseをビルドする手順

NVIDIA Jetson Nanoで OpenCV 3をビルドしてインストールする方法、NVCaffe等の OpenCV 4未対応を動かす
NVIDIA Jetson Nanoで OpenCV 3をビルドしてインストールする方法、NVCaffe等の OpenCV 4未対応を動かす

  NVIDIA Jetson Nanoに「古い」 OpenCV 3.4.10をビルドしてインストールする方法

NVIDIA Jetson Nanoで Visual Studio Code Open Sourceをビルドして実行する
NVIDIA Jetson Nanoで Visual Studio Code Open Sourceをビルドして実行する

  NVIDIA Jetson Nanoで VSCode Open Source Code - OSSをビルドして実行する、1.35.0

【2020年版】NVIDIA Jetson Nanoで StyleGANの改良版の StyleGAN2で自然な画像を生成
【2020年版】NVIDIA Jetson Nanoで StyleGANの改良版の StyleGAN2で自然な画像を生成

  NVIDIA Jetson Nano JetPack StyleGAN2、敵対的生成ネットワーク AIで自然な顔画像を生成する

【2020年版】Jetson Nanoで StyleGANを動かして可愛い美少女のアニメ顔を大量生産する方法
【2020年版】Jetson Nanoで StyleGANを動かして可愛い美少女のアニメ顔を大量生産する方法

  【俺の嫁】Jetson Nanoで StyleGANと StyleGAN2のそれぞれで、敵対的生成ネットワーク AIでアニメ顔を生成

【メモリ8GB】Raspberry Pi 4 Model B 8GBを KSYで最安値で購入。ベンチマークレビュー
【メモリ8GB】Raspberry Pi 4 Model B 8GBを KSYで最安値で購入。ベンチマークレビュー

  【技適取得】ラズパイ4B 8GBモデルを入手。従来の Pi3、Pi3B+と速度比較

【Vulkan】Raspberry Pi 4 Model Bで Vulkanドライバをビルドして 3Dグラフィックのデモを動かす
【Vulkan】Raspberry Pi 4 Model Bで Vulkanドライバをビルドして 3Dグラフィックのデモを動かす

  【v3dv】ラズパイ4Bで Vulkan APIを動かす、VK_ICD_FILENAMES broadcom_icd.armv7l.json



[HOME] | [BACK]
リンクフリー(連絡不要、ただしトップページ以外は Web構成の変更で移動する場合があります)
Copyright (c) 2020 FREE WING,Y.Sakamoto
Powered by 猫屋敷工房 & HTML Generator

http://www.neko.ne.jp/~freewing/raspberry_pi/nvidia_jetson_nano_tensorflow_stylegan/