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

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

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

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

Python

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

Q&A

解決済

2回答

3613閲覧

'tensorflow' has no attribute 'flags'がわかりません

退会済みユーザー

退会済みユーザー

総合スコア0

MacOS(OSX)

MacOSとは、Appleの開発していたGUI(グラフィカルユーザーインターフェース)を採用したオペレーションシステム(OS)です。Macintoshと共に、市場に出てGUIの普及に大きく貢献しました。

Python

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

0グッド

0クリップ

投稿2021/08/16 12:25

編集2021/08/18 08:56

やりたいプログラムを実行したいです。
プログラムは

# -*- coding: utf-8 -*- #Copyright (c) 2017, Gabriel Eilertsen. #All rights reserved. import os, sys import tensorflow as tf import tensorlayer as tl import numpy as np import network, img_io eps = 1e-5 def print_(str, color='', bold=False): if color == 'w': sys.stdout.write('\033[93m') elif color == "e": sys.stdout.write('\033[91m') elif color == "m": sys.stdout.write('\033[95m') if bold: sys.stdout.write('\033[1m') sys.stdout.write(str) sys.stdout.write('\033[0m') sys.stdout.flush() #設定、TensorFlow引数を使用 FLAGS = tf.flags.FLAGS tf.flags.DEFINE_integer("width", "1024", "Reconstruction image width") tf.flags.DEFINE_integer("height", "768", "Reconstruction image height") tf.flags.DEFINE_string("im_dir", "data", "Path to image directory or an individual image") tf.flags.DEFINE_string("out_dir", "out", "Path to output directory") tf.flags.DEFINE_string("params", "hdrcnn_params.npz", "Path to trained CNN weights") tf.flags.DEFINE_float("scaling", "1.0", "Pre-scaling, which is followed by clipping, in order to remove compression artifacts close to highlights") tf.flags.DEFINE_float("gamma", "1.0", "Gamma/exponential curve applied before, and inverted after, prediction. This can be used to control the boost of reconstructed pixels.") #32の倍数に丸めて、オートエンコーダのプーリングとアップサンプリングを行う #入力画像と同じサイズになります sx = int(np.maximum(32, np.round(FLAGS.width/32.0)*32)) sy = int(np.maximum(32, np.round(FLAGS.height/32.0)*32)) if sx != FLAGS.width or sy != FLAGS.height: print_("Warning: ", 'w', True) print_("prediction size has been changed from %dx%d pixels to %dx%d\n"%(FLAGS.width, FLAGS.height, sx, sy), 'w') print_("ピクセル、オートエンコーダのプーリングとアップサンプリングに準拠します。\n\n", 'w') #情報 print_("\n\n\t-------------------------------------------------------------------\n", 'm') print_("\t ディープCNNを使用した単一露光からのHDR画像再構成\n\n", 'm') print_("\t 予測設定\n", 'm') print_("\t -------------------\n", 'm') print_("\t 入力画像のディレクトリ/ファイル:%s\n" % FLAGS.im_dir, 'm') print_("\t 出力ディレクトリ:%s\n" % FLAGS.out_dir, 'm') print_("\t CNN重み:%s\n" % FLAGS.params, 'm') print_("\t 予測解像度: %dx%d ピクセル\n" % (sx, sy), 'm') if FLAGS.scaling > 1.0: print_("\t Pre-scaling: %0.4f\n" % FLAGS.scaling, 'm') if FLAGS.gamma > 1.0 + eps or FLAGS.gamma < 1.0 - eps: print_("\t Gamma: %0.4f\n" % FLAGS.gamma, 'm') print_("\t-------------------------------------------------------------------\n\n\n", 'm') # シングルフレーム frames = [FLAGS.im_dir] # ディレクトリが指定されている場合は、パス内のすべてのファイルの名前を取得します if os.path.isdir(FLAGS.im_dir): frames = [os.path.join(FLAGS.im_dir, name) for name in sorted(os.listdir(FLAGS.im_dir)) if os.path.isfile(os.path.join(FLAGS.im_dir, name))] #画像入力用のプレースホルダー x = tf.placeholder(tf.float32, shape=[1, sy, sx, 3]) #HDR再構成オートエンコーダモデル print_("Network setup:\n") net = network.model(x) #CNN予測(これには入力画像xとのブレンドも含まれます) y = network.get_final(net, x) #推論を実行するためのTensorFlowセッション sess = tf.InteractiveSession() #トレーニング済みのCNNウェイトをロードする print_("\nLoading trained parameters from '%s'..."%FLAGS.params) load_params = tl.files.load_npz(name=FLAGS.params) tl.files.assign_params(sess, load_params, net) print_("\tdone\n") if not os.path.exists(FLAGS.out_dir): os.makedirs(FLAGS.out_dir) print_("\nStarting prediction...\n\n") k = 0 for i in range(len(frames)): print("Frame %d: '%s'"%(i,frames[i])) try: # Read frame print_("\tReading...") x_buffer = img_io.readLDR(frames[i], (sy,sx), True, FLAGS.scaling) print_("\tdone") print_("\t(Saturation: %0.2f%%)\n" % (100.0*(x_buffer>=1).sum()/x_buffer.size), 'm') # Run prediction. # The gamma value is used to allow for boosting/reducing the intensity of # the reconstructed highlights. If y = f(x) is the reconstruction, the gamma # g alters this according to y = f(x^(1/g))^g print_("\tInference...") feed_dict = {x: np.power(np.maximum(x_buffer, 0.0), 1.0/FLAGS.gamma)} y_predict = sess.run([y], feed_dict=feed_dict) y_predict = np.power(np.maximum(y_predict, 0.0), FLAGS.gamma) print_("\tdone\n") # Gamma corrected output y_gamma = np.power(np.maximum(y_predict, 0.0), 0.5) # Write to disc print_("\tWriting...") k += 1; img_io.writeLDR(x_buffer, '%s/%06d_in.png' % (FLAGS.out_dir, k), -3) img_io.writeLDR(y_gamma, '%s/%06d_out.png' % (FLAGS.out_dir, k), -3) img_io.writeEXR(y_predict, '%s/%06d_out.exr' % (FLAGS.out_dir, k)) print_("\tdone\n") except img_io.IOException as e: print_("\n\t\tWarning! ", 'w', True) print_("%s\n"%e, 'w') except Exception as e: print_("\n\t\tError: ", 'e', True) print_("%s\n"%e, 'e') print_("Done!\n") sess.close()

です。実行したら

$ python3 hdrcnn_predict.py -h Traceback (most recent call last): File "hdrcnn_predict.py", line 28, in <module> FLAGS = tf.flags.FLAGS AttributeError: module 'tensorflow' has no attribute 'flags'

となってしまいました。
原因を調べたところ
https://github.com/tensorflow/tensor2tensor/issues/1754
で、tensorflow2.0をサポートしてないとあったので、

$ pip freeze | grep tensor tensorboard==1.15.0 tensorboard-data-server==0.6.1 tensorboard-plugin-wit==1.8.0 tensorflow==1.15.3 tensorflow-estimator==1.15.1 tensorlayer==1.11.1

にしたところ、

$ python3 hdrcnn_predict.py -h Traceback (most recent call last): File "hdrcnn_predict.py", line 4, in <module> import tensorflow as tf File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow/__init__.py", line 102, in <module> from tensorflow_core import * File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_core/__init__.py", line 36, in <module> from tensorflow._api.v1 import compat File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_core/_api/v1/compat/__init__.py", line 23, in <module> from tensorflow._api.v1.compat import v1 File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_core/_api/v1/compat/v1/__init__.py", line 672, in <module> from tensorflow_estimator.python.estimator.api._v1 import estimator File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_estimator/__init__.py", line 10, in <module> from tensorflow_estimator._api.v1 import estimator File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_estimator/_api/v1/estimator/__init__.py", line 12, in <module> from tensorflow_estimator._api.v1.estimator import inputs File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_estimator/_api/v1/estimator/inputs/__init__.py", line 10, in <module> from tensorflow_estimator.python.estimator.inputs.numpy_io import numpy_input_fn File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_estimator/python/estimator/inputs/numpy_io.py", line 26, in <module> from tensorflow_estimator.python.estimator.inputs.queues import feeding_functions File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_estimator/python/estimator/inputs/queues/feeding_functions.py", line 40, in <module> import pandas as pd File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/__init__.py", line 22, in <module> from pandas.compat import ( File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/compat/__init__.py", line 15, in <module> from pandas.compat.numpy import ( File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/compat/numpy/__init__.py", line 7, in <module> from pandas.util.version import Version File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/util/__init__.py", line 1, in <module> from pandas.util._decorators import ( # noqa File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/util/_decorators.py", line 14, in <module> from pandas._libs.properties import cache_readonly # noqa File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/_libs/__init__.py", line 13, in <module> from pandas._libs.interval import Interval File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject

となってしまいました。

どうすればいいのかおしえてください。
よろしくお願い致します。

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

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

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

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

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

jbpb0

2021/08/16 13:54 編集

> numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject 使ってるnumpyのバージョンは、いくつでしょうか? 参考 https://zenn.dev/ymd_h/articles/934a90e1468a05
退会済みユーザー

退会済みユーザー

2021/08/16 14:03

>>> import numpy as np >>> print(np.__version__) 1.15.4 でした。
退会済みユーザー

退会済みユーザー

2021/08/16 14:06

参考を読んだのですが理解できませんでした。 どうしたらいいのでしょうか?
jbpb0

2021/08/16 14:30

現状で、下記はできますか? import pandas as pd
退会済みユーザー

退会済みユーザー

2021/08/16 14:32

numpyをインストールしたらエラーが出たところでした。 Installing collected packages: numpy Attempting uninstall: numpy Found existing installation: numpy 1.15.4 Uninstalling numpy-1.15.4: Successfully uninstalled numpy-1.15.4 WARNING: The scripts f2py, f2py3 and f2py3.7 are installed in '/Users/1831083/Library/Python/3.7/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorlayer 1.11.1 requires numpy<1.16,>=1.14, but you have numpy 1.16.1 which is incompatible. tensorflow 1.15.3 requires wrapt>=1.11.1, but you have wrapt 1.10.11 which is incompatible. umap-learn 0.5.1 requires numpy>=1.17, but you have numpy 1.16.1 which is incompatible. umap-learn 0.5.1 requires scikit-learn>=0.22, but you have scikit-learn 0.20.4 which is incompatible. pandas 1.3.0 requires numpy>=1.17.3, but you have numpy 1.16.1 which is incompatible. Successfully installed numpy-1.16.1
退会済みユーザー

退会済みユーザー

2021/08/16 14:32

import pandas as pdを実行したところ >>> import pandas as pd Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/__init__.py", line 22, in <module> from pandas.compat import ( File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/compat/__init__.py", line 15, in <module> from pandas.compat.numpy import ( File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/compat/numpy/__init__.py", line 21, in <module> f"this version of pandas is incompatible with numpy < {_min_numpy_ver}\n" ImportError: this version of pandas is incompatible with numpy < 1.17.3 your numpy version is 1.16.1. Please upgrade numpy to >= 1.17.3 to use this pandas version >>> となりました。
jbpb0

2021/08/16 14:48 編集

矛盾しまくってますね tensorlayer 1.11.1はnumpy 1.16よりも古いのが要る(1.16はダメ)けど、pandas 1.3.0はnumpy 1.17.3以降が要る、とか tensorlayer 1.11.1に合わせて他を古いのに取り換えるか、あるいはtensorlayerを1.11.1よりも新しいのにする(tensorflow 2.*を使う)か いろいろいじっておかしくなるかもしれないので、仮想環境を作って、その中でバージョンを触ることをお勧めします
退会済みユーザー

退会済みユーザー

2021/08/16 14:54

tensorflow 2.*で'tensorflow' has no attribute 'flags'を起こさない方法分かりませんか? または、tensorflow1.*で平気できる範囲などわかれば教えていただければ幸いです。 自分は仮想環境を作ったことがないので、何もわからないので不安なのでできるでけ今のまま行いたいので、お力をお借りしたいです。
jbpb0

2021/08/16 15:45 編集

仮想環境を作らずにtensorlayer 1.11.1に合わせて他を古いのに取り換えると、今動かそうとしてるの以外ので、支障が出るかもしれませんよ https://weber.itn.liu.se/~gabei62/hdrcnn/ が発表された「SIGGRAPH Asia 2017」 https://sa2017.siggraph.org/ が2017年11月で、コードが書かれたのはそれより前だから、おそらく2017年8〜9月当時の最新バージョンに必要なもの全てを差し換えたら動く可能性高いと思いますけど、仮想環境作らないでそうしたら、質問者さんのパソコンのPython環境が4年前の状態になりますので、それ以降の過去4年間に発表されたコードの中には、動かないものも出てくるでしょうね
退会済みユーザー

退会済みユーザー

2021/08/16 22:18

macで仮想環境を作るにはどうすればいいでしょうか? 「Mac 仮想環境」と調べても「mac上でWindows実行」が出てきてやり方が分かりません。 申し訳ないのですが教えて頂けませんか?
jbpb0

2021/08/16 23:45

仮想環境を作るツールはいろいろあります https://www.acrovision.jp/career/?p=2254 https://blog.codecamp.jp/programming-python-virtual-environment はじめて使うなら、とりあえずPython標準モジュールのvenvを使ってみるといいと思いますよ 何も追加せずに使えるので しばらく使ってみて、もし不満が出てきたら、他のに乗り換えるか考えたらいいと思います 使い方は、 venv mac とかでググれば、解説記事がたくさん見つかるので、それ見てください あと、 ・どの仮想環境に何を入れたか把握しておく ・現在どの環境で作業してるか意識する ことに気を付けてください 環境を間違えてインストールしてしまったら、仮想環境に分けた意味がありませんので
guest

回答2

0

ベストアンサー

Deep learning HDR image reconstruction
が書かれた時点のバージョンに合わせた仮想環境を作って、そこで実行したら、動く可能性が高いと思います

HDR image reconstruction from a single exposure using deep CNNs
が発表された
SIGGRAPH Asia 2017
が2017年11月なので、その少し前でしょうね

投稿2021/08/23 00:54

編集2021/08/23 01:00
jbpb0

総合スコア7651

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

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

jbpb0

2021/08/23 08:37 編集

https://github.com/gabrieleilertsen/hdrcnn/issues/42 で、作者(gabrieleilertsenさん)が tensorflow-gpu 1.15.0 OpenEXR 2.5.3 tensorlayer 1.11.1 の組み合わせで動いてると書いてたのを見つけて、当方のMacの tensorflow 1.15.3 OpenEXR 1.3.2 (brewで入れたのは 2.5.7) とバージョンが近かったので、そこに tensorlayer 1.11.1 を入れたら、 https://github.com/gabrieleilertsen/hdrcnn の「Usage」の「Example」の python hdrcnn_predict.py --params hdrcnn_params.npz --im_dir data --width 1024 --height 768 が実行できました
退会済みユーザー

退会済みユーザー

2021/08/23 14:07

ありがとうございます。 自分も実行したくてMacでAnacondaの仮想環境を作り、pipでOpenEXRをインストールしようとしたらエラーが出てしまいました。 Anacondaの仮想環境にpipのOpenEXRをいれるにはどうしたら良いですか?
退会済みユーザー

退会済みユーザー

2021/08/23 14:14

mac本体のターミナルで教えていただいた環境で実行したところ、以下のエラーが出ました。 $ python3 hdrcnn_predict.py --params hdrcnn_params.npz --im_dir data --width 1024 --height 768 Traceback (most recent call last): File "hdrcnn_predict.py", line 4, in <module> import tensorflow.compat.v1 as tf File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow/__init__.py", line 102, in <module> from tensorflow_core import * File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_core/__init__.py", line 36, in <module> from tensorflow._api.v1 import compat File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_core/_api/v1/compat/__init__.py", line 23, in <module> from tensorflow._api.v1.compat import v1 File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_core/_api/v1/compat/v1/__init__.py", line 672, in <module> from tensorflow_estimator.python.estimator.api._v1 import estimator File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_estimator/__init__.py", line 10, in <module> from tensorflow_estimator._api.v1 import estimator File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_estimator/_api/v1/estimator/__init__.py", line 12, in <module> from tensorflow_estimator._api.v1.estimator import inputs File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_estimator/_api/v1/estimator/inputs/__init__.py", line 10, in <module> from tensorflow_estimator.python.estimator.inputs.numpy_io import numpy_input_fn File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_estimator/python/estimator/inputs/numpy_io.py", line 26, in <module> from tensorflow_estimator.python.estimator.inputs.queues import feeding_functions File "/Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorflow_estimator/python/estimator/inputs/queues/feeding_functions.py", line 40, in <module> import pandas as pd File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/__init__.py", line 22, in <module> from pandas.compat import ( File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/compat/__init__.py", line 15, in <module> from pandas.compat.numpy import ( File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/compat/numpy/__init__.py", line 7, in <module> from pandas.util.version import Version File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/util/__init__.py", line 1, in <module> from pandas.util._decorators import ( # noqa File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/util/_decorators.py", line 14, in <module> from pandas._libs.properties import cache_readonly # noqa File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/pandas/_libs/__init__.py", line 13, in <module> from pandas._libs.interval import Interval File "pandas/_libs/interval.pyx", line 1, in init pandas._libs.interval ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject
退会済みユーザー

退会済みユーザー

2021/08/23 14:15

tensorlayer 1.11.1にするときに、このようなエラーが発生していました。 ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorflow 1.15.3 requires numpy<2.0,>=1.16.0, but you have numpy 1.15.4 which is incompatible. tensorflow 1.15.3 requires wrapt>=1.11.1, but you have wrapt 1.10.11 which is incompatible. umap-learn 0.5.1 requires numpy>=1.17, but you have numpy 1.15.4 which is incompatible. umap-learn 0.5.1 requires scikit-learn>=0.22, but you have scikit-learn 0.20.4 which is incompatible. pandas 1.3.0 requires numpy>=1.17.3, but you have numpy 1.15.4 which is incompatible. Successfully installed imageio-2.4.1 matplotlib-3.0.3 numpy-1.15.4 progressbar2-3.38.0 requests-2.20.1 scikit-image-0.14.5 scikit-learn-0.20.4 scipy-1.1.0 tensorlayer-1.11.1 wrapt-1.10.11
退会済みユーザー

退会済みユーザー

2021/08/23 14:17

$ pip list Package Version ----------------------- ------------------- absl-py 0.13.0 appnope 0.1.2 argon2-cffi 20.1.0 astor 0.8.1 astunparse 1.6.3 async-generator 1.10 attrs 21.2.0 backcall 0.2.0 bleach 1.5.0 cached-property 1.5.2 cachetools 4.2.2 certifi 2021.5.30 cffi 1.14.5 chardet 3.0.4 charset-normalizer 2.0.3 clang 5.0 cloudpickle 1.6.0 cmake 3.21.1 cycler 0.10.0 debugpy 1.3.0 decorator 5.0.9 defusedxml 0.7.1 entrypoints 0.3 flatbuffers 1.12 future 0.18.2 gast 0.2.2 google-auth 1.34.0 google-auth-oauthlib 0.4.4 google-pasta 0.2.0 graphviz 0.16 grpcio 1.39.0 h5py 3.1.0 html5lib 0.9999999 idna 2.7 imageio 2.4.1 imath 0.0.1 importlib-metadata 4.6.1 ipykernel 6.0.1 ipython 7.25.0 ipython-genutils 0.2.0 ipywidgets 7.6.3 jedi 0.18.0 Jinja2 3.0.1 joblib 1.0.1 jsonschema 3.2.0 jupyter 1.0.0 jupyter-client 6.1.12 jupyter-console 6.4.0 jupyter-core 4.7.1 jupyterlab-pygments 0.1.2 jupyterlab-widgets 1.0.0 keras 2.6.0 Keras-Applications 1.0.8 keras-nightly 2.5.0.dev2021032900 Keras-Preprocessing 1.1.2 kiwisolver 1.3.1 llvmlite 0.36.0 lxml 4.2.6 Markdown 3.3.4 MarkupSafe 2.0.1 matplotlib 3.0.3 matplotlib-inline 0.1.2 mistune 0.8.4 nbclient 0.5.3 nbconvert 6.1.0 nbformat 5.1.3 nest-asyncio 1.5.1 networkx 2.6.2 notebook 6.4.0 np-utils 0.5.12.1 numba 0.53.1 numpy 1.15.4 oauthlib 3.1.1 OpenEXR 1.3.2 opt-einsum 3.3.0 packaging 21.0 pandas 1.3.0 pandocfilters 1.4.3 parso 0.8.2 pexpect 4.8.0 pickleshare 0.7.5 Pillow 8.2.0 pip 21.2.4 progressbar2 3.38.0 prometheus-client 0.11.0 prompt-toolkit 3.0.19 protobuf 3.17.3 ptyprocess 0.7.0 pyasn1 0.4.8 pyasn1-modules 0.2.8 pycparser 2.20 pydot 1.4.2 pydotplus 2.0.2 Pygments 2.9.0 pynndescent 0.5.4 pyparsing 2.4.7 pyrsistent 0.18.0 python-dateutil 2.8.1 python-utils 2.5.6 pytz 2021.1 PyWavelets 1.1.1 PyYAML 5.4.1 pyzmq 22.1.0 qtconsole 5.1.1 QtPy 1.9.0 requests 2.20.1 requests-oauthlib 1.3.0 rsa 4.7.2 scikit-image 0.14.5 scikit-learn 0.20.4 scipy 1.1.0 seaborn 0.11.1 Send2Trash 1.7.1 setuptools 47.1.0 six 1.15.0 sklearn 0.0 tensorboard 1.15.0 tensorboard-data-server 0.6.1 tensorboard-plugin-wit 1.8.0 tensorflow 1.15.3 tensorflow-estimator 1.15.1 tensorlayer 1.11.1 termcolor 1.1.0 terminado 0.10.1 testpath 0.5.0 threadpoolctl 2.2.0 tifffile 2021.7.2 tornado 6.1 tqdm 4.28.1 traitlets 5.0.5 typing-extensions 3.7.4.3 umap-learn 0.5.1 urllib3 1.24.3 wcwidth 0.2.5 webencodings 0.5.1 Werkzeug 2.0.1 wheel 0.36.2 widgetsnbextension 3.5.1 wrapt 1.10.11 zipp 3.5.0
jbpb0

2021/08/24 05:48 編集

> File "hdrcnn_predict.py", line 4, in <module> import tensorflow.compat.v1 as tf TF 1.*で動かすのなら、下記のTF 2.*用の変更は不要です import tensorflow as tf ↓ 変更 import tensorflow.compat.v1 as tf tf.disable_v2_behavior() 上記をやってない、オリジナルのコードを実行してください (「network.py」も)
jbpb0

2021/08/24 05:54 編集

> ValueError: numpy.ufunc size changed, may indicate binary incompatibility. Expected 216 from C header, got 192 from PyObject 「質問への追記・修正」の「2021/08/16 23:21」の私のコメントを読んでください
jbpb0

2021/08/24 05:53

> ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. 「Successfully installed...」と、インストール自体は成功してるので、とりあえず無視で
退会済みユーザー

退会済みユーザー

2021/08/24 06:29

言われたところを直したら以下のようなりました。 $ python3 hdrcnn_predict.py --params hdrcnn_params.npz --im_dir data --width 1024 --height 768 WARNING:tensorflow:From /Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorlayer/layers/core.py:39: The name tf.GraphKeys is deprecated. Please use tf.compat.v1.GraphKeys instead. WARNING:tensorflow:From /Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorlayer/layers/pooling.py:66: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead. ------------------------------------------------------------------- ディープCNNを使用した単一露光からのHDR画像再構成 予測設定 ------------------- 入力画像のディレクトリ/ファイル:data 出力ディレクトリ:out CNN重み:hdrcnn_params.npz 予測解像度: 1024x768 ピクセル ------------------------------------------------------------------- WARNING:tensorflow:From hdrcnn_predict.py:72: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead. Network setup: WARNING:tensorflow:From /Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorlayer/layers/core.py:131: The name tf.get_variable_scope is deprecated. Please use tf.compat.v1.get_variable_scope instead. WARNING:tensorflow:From /Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorlayer/layers/convolution/expert_conv.py:201: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead. WARNING:tensorflow:From /Users/1831083/Library/Python/3.7/lib/python/site-packages/tensorlayer/layers/convolution/expert_conv.py:202: The name tf.get_variable is deprecated. Please use tf.compat.v1.get_variable instead. WARNING:tensorflow:From /Users/1831083/hdrcnn/hdrcnn-master/network.py:250: calling Constant.__init__ (from tensorflow.python.ops.init_ops) with dtype is deprecated and will be removed in a future version. Instructions for updating: Call initializer instance with the dtype argument instead of passing it to the constructor WARNING:tensorflow:From /Users/1831083/hdrcnn/hdrcnn-master/network.py:202: The name tf.log is deprecated. Please use tf.math.log instead. WARNING:tensorflow: The TensorFlow contrib module will not be included in TensorFlow 2.0. For more information, please see: * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md * https://github.com/tensorflow/addons * https://github.com/tensorflow/io (for I/O related ops) If you depend on functionality not listed there, please file an issue. WARNING:tensorflow:From hdrcnn_predict.py:82: The name tf.InteractiveSession is deprecated. Please use tf.compat.v1.InteractiveSession instead. 2021-08-24 15:21:57.033777: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2021-08-24 15:21:57.073488: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x7fbb491ab700 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2021-08-24 15:21:57.073521: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version Loading trained parameters from 'hdrcnn_params.npz'... done Starting prediction... Frame 0: 'data/img_001.png' Reading... done (Saturation: 4.44%) Inference... done Writing... done Frame 1: 'data/img_002.png' Reading... done (Saturation: 3.45%) Inference... done Writing... done Frame 2: 'data/img_003.png' Reading... done (Saturation: 5.17%) Inference... done Writing... done Frame 3: 'data/img_004.png' Reading... done (Saturation: 37.77%) Inference... done Writing... done Frame 4: 'data/img_005.png' Reading... done (Saturation: 6.08%) Inference... done Writing... done Frame 5: 'data/img_006.png' Reading... done (Saturation: 5.25%) Inference... done Writing... done Frame 6: 'data/img_007.png' Reading... done (Saturation: 3.72%) Inference... done Writing... done Done!
退会済みユーザー

退会済みユーザー

2021/08/24 06:30

これは正しく動作していますか? また、正しく動作しているのでしたらHDR画像はどこにあるのでしょうか?
jbpb0

2021/08/24 06:43 編集

> 出力ディレクトリ:out 「out」というディレクトリの中にありませんか?
退会済みユーザー

退会済みユーザー

2021/08/24 06:43

ありました。 ありがとうございます。 わかればで良いのですが、in.pngとout.pngはもとの画像の明と暗ですか? .exrは再構築したHDR画像だと分かるのですが...
guest

0

tensorflow2系では、無くなっているようです。

tf.compat.v1.flags.Flag

を使えと言うことのようですね。

投稿2021/08/16 13:08

ppaul

総合スコア24666

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

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

退会済みユーザー

退会済みユーザー

2021/08/16 13:15

自分もそれは読んだのですが、使い方が分かりません。 どのようにして使えばいいですか?
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問