yu4u / noise2noise

An unofficial and partial Keras implementation of "Noise2Noise: Learning Image Restoration without Clean Data"
MIT License
1.07k stars 237 forks source link

AttributeError: module 'tensorflow' has no attribute 'log' #48

Open ahbon123 opened 4 years ago

ahbon123 commented 4 years ago

Hello, may I ask how to deal with Traceback error? Thanks.

I use Ubuntu 18.04, with GPU GeForce RTX 2080 with Max-Q.

Traceback (most recent call last): File "train.py", line 113, in <module> main() File "train.py", line 87, in main model.compile(optimizer=opt, loss=loss_type, metrics=[PSNR]) File "/usr/local/lib/python3.6/dist-packages/keras/backend/tensorflow_backend.py", line 75, in symbolic_fn_wrapper return func(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 222, in compile masks=masks) File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 871, in _handle_metrics self._per_output_metrics[i], target, output, output_mask) File "/usr/local/lib/python3.6/dist-packages/keras/engine/training.py", line 842, in _handle_per_output_metrics metric_fn, y_true, y_pred, weights=weights, mask=mask) File "/usr/local/lib/python3.6/dist-packages/keras/engine/training_utils.py", line 1033, in call_metric_function update_ops = metric_fn.update_state(y_true, y_pred, sample_weight=weights) File "/usr/local/lib/python3.6/dist-packages/keras/utils/metrics_utils.py", line 42, in decorated update_op = update_state_fn(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/keras/metrics.py", line 318, in update_state matches = self._fn(y_true, y_pred, **self._fn_kwargs) File "/home/x/文档/GitHub/noise2noise/model.py", line 45, in PSNR return 10.0 * tf_log10((max_pixel ** 2) / (K.mean(K.square(y_pred - y_true)))) File "/home/x/文档/GitHub/noise2noise/model.py", line 37, in tf_log10 numerator = tf.log(x) AttributeError: module 'tensorflow' has no attribute 'log'

emontalbano commented 4 years ago

pip install tensorflow==1.15

The developers didn't put any versions on their requirements.txt and v2+ doesn't work with their code.

neurocker commented 2 years ago

change it to tf.math.log