tensorflow_multigpu_imagenet icon indicating copy to clipboard operation
tensorflow_multigpu_imagenet copied to clipboard

got a “None values not supported” error for densenet121 training.

Open xh-yuan opened this issue 4 years ago • 2 comments

...
Instructions for updating:
Deprecated in favor of operator or tf.math.divide.
Filling queue with 2000 images before starting to train. This may take some times.
WARNING:tensorflow:From /home/yuanxh/DenseNet121/tensorflow_multigpu_imagenet-master/data_loader.py:162: batch (from tensorflow.python.training.input) is deprecated and will be removed in a future version.
Instructions for updating:
Queue-based input pipelines have been replaced by `tf.data`. Use `tf.data.Dataset.batch(batch_size)` (or `padded_batch(...)` if `dynamic_pad=True`).
Traceback (most recent call last):
  File "run.py", line 393, in <module>
    main()
  File "run.py", line 366, in main
    do_train(sess, args)
  File "run.py", line 78, in do_train
    train_ops = dnn_model.train_ops()
  File "/home/yuanxh/DenseNet121/tensorflow_multigpu_imagenet-master/architectures/model.py", line 180, in train_ops
    grads, last_grads, batchnorm_updates, cross_entropy_mean, top1acc, topnacc = self.get_grads('/gpu:0')
  File "/home/yuanxh/DenseNet121/tensorflow_multigpu_imagenet-master/architectures/model.py", line 100, in get_grads
    probabilities= tf.nn.softmax(logits, name='output')
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow_core/python/ops/nn_ops.py", line 2958, in softmax
    return _softmax(logits, gen_nn_ops.softmax, axis, name)
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow_core/python/ops/nn_ops.py", line 2884, in _softmax
    logits = ops.convert_to_tensor(logits)
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1184, in convert_to_tensor
    return convert_to_tensor_v2(value, dtype, preferred_dtype, name)
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1242, in convert_to_tensor_v2
    as_ref=False)
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1297, in internal_convert_to_tensor
    ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 286, in _constant_tensor_conversion_function
    return constant(v, dtype=dtype, name=name)
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 227, in constant
    allow_broadcast=True)
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow_core/python/framework/constant_op.py", line 265, in _constant_impl
    allow_broadcast=allow_broadcast))
  File "/usr/local/python3/lib/python3.7/site-packages/tensorflow_core/python/framework/tensor_util.py", line 437, in make_tensor_proto
    raise ValueError("None values not supported.")
ValueError: None values not supported.

(tensorflow 1.15.0, python 3.7.5) I've trained vgg, resnet50 successfully. But I got a problem when I tried densenet121.

xh-yuan avatar May 19 '20 01:05 xh-yuan

I figure out the problem. there is something wrong with the inference function in model.py :

  def inference(self):
    if self.architecture.lower()=='alexnet':
      return alexnet(self.inputs, self.num_classes, self.wd, tf.where(self.is_training, 0.5, 1.0), self.is_training)
    elif self.architecture.lower().startswith('resnet'):
      depth= int(re.search('(\d+)$', self.architecture).group(0)) 
      return resnet(self.inputs, self.num_classes, self.wd, self.is_training, self.transfer_mode, depth)
    elif self.architecture.lower()=='densenet':    # --------- here it is --------
      depth= int(re.search('(\d+)$', self.architecture).group(0)) 
      return densenet(self.inputs, depth, self.num_classes, self.wd, self.is_training)
    elif self.architecture.lower()=='vgg':
        return vgg(self.inputs, self.num_classes, self.wd, tf.where(self.is_training, 0.5, 1.0), self.is_training)
    elif self.architecture.lower()=='googlenet':
        return googlenet(self.inputs, self.num_classes, self.wd, tf.where(self.is_training, 0.4, 1.0), self.is_training)
    elif self.architecture.lower()=='nin':
        return nin(self.inputs, self.num_classes, self.wd, self.is_training)

it should be elif self.architecture.lower().startswith('densenet'): i guess.

xh-yuan avatar May 19 '20 11:05 xh-yuan

Hello, xh-yuan. I try to run vgg net with imagenet dataset, but i got some errors. Can you tell me what is the parameter 'run_metadata'? it seems where the error is from

helloyuning avatar Jul 27 '22 04:07 helloyuning