引用回帖:
天天进步啊 at 2020-04-15 20:41:22
一看就知道是python代码,先把你代码贴出来,再讲你的报错...
您好,这个代码是Yan Wu, Mihaela Rosca, Timothy Lillicrap Deep Compressed Sensing. ICML 2019的开源代码(This is the example code for the following ICML 2019 paper. If you use the code here please cite this paper),网址https://github.com/deepmind/deepmind-research/tree/master/cs_gan
下面是报错,运行后报错的main_cs.py文件以及utils.py文件代码
File "D:\deep compressed sensing\main_cs.py", line 76, in main
images = utils.get_train_dataset(data_processor, FLAGS.dataset,
AttributeError: module 'cs_gan.utils' has no attribute 'get_train_dataset'
#main_cs.py
"""Training script."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from absl import app
from absl import flags
from absl import logging
import tensorflow.compat.v1 as tf
import tensorflow_probability as tfp
from cs_gan import cs
from cs_gan import file_utils
from cs_gan import utils
tfd = tfp.distributions
flags.DEFINE_string(
'mode', 'recons', 'Model mode.')
flags.DEFINE_integer(
'num_training_iterations', 10000000,
'Number of training iterations.')
flags.DEFINE_integer(
'batch_size', 64, 'Training batch size.')
flags.DEFINE_integer(
'num_measurements', 25, 'The number of measurements')
flags.DEFINE_integer(
'num_latents', 100, 'The number of latents')
flags.DEFINE_integer(
'num_z_iters', 3, 'The number of latent optimisation steps.')
flags.DEFINE_float(
'z_step_size', 0.01, 'Step size for latent optimisation.')
flags.DEFINE_string(
'z_project_method', 'norm', 'The method to project z.')
flags.DEFINE_integer(
'summary_every_step', 1000,
'The interval at which to log debug ops.')
flags.DEFINE_integer(
'export_every', 10,
'The interval at which to export samples.')
flags.DEFINE_string(
'dataset', 'mnist', 'The dataset used for learning (cifar|mnist.')
flags.DEFINE_float('learning_rate', 1e-4, 'Learning rate.')
flags.DEFINE_string(
'output_dir', '/tmp/cs_gan/cs', 'Location where to save output files.')
FLAGS = flags.FLAGS
# Log info level (