balancap / SSD-Tensorflow

Single Shot MultiBox Detector in TensorFlow
4.11k stars 1.89k forks source link

Error: Variables not initialized when trying to evaluate on VOC 07 #304

Closed UndecidedBoy closed 5 years ago

UndecidedBoy commented 5 years ago

Hello,

I'm trying this code on windows 10 with python 3.6 and Tensorflow 1.12.

While trying to evaluate SSD on Pascal VOC 2007, i'm getting the following error: RuntimeError: Init operations did not make model ready for local_init.

This comes from the following function:

slim.evaluation.evaluate_once(
                master=FLAGS.master,
                checkpoint_path=checkpoint_path,
                logdir=FLAGS.eval_dir,
                num_evals=num_batches,
                eval_op=flatten(list(names_to_updates.values())),
                variables_to_restore=variables_to_restore,
                session_config=config)

I presume that there is a new input in the function for the initialization process, but I can't get a grasp on what to feed it with, or if one input is deprecated and there is a new name for it.

Every help is appreciated! Thanks in advance :)

jianyuheng commented 5 years ago

I got the same problem, have you solved it?

UndecidedBoy commented 5 years ago

Hi, No I did not manage yet to find what the reason behind this error is.

wangxianrui commented 5 years ago

I got the same problem also...

UndecidedBoy commented 5 years ago

I thought that initializing with an intial_op in the function would do the trick, but it did not...

jianyuheng commented 5 years ago

@UndecidedBoy @wangxianrui I think I found a solution to the problem. SSD-Tensorflow-master\tf_extended\metrics.py", line 51, in _create_local tf.Variable()

return variables.Variable( initial_value=array_ops.zeros(shape, dtype=dtype), name=name, trainable=False, collections=collections, validate_shape=validate_shape)

The problem is that we did not initialize local variables created by slim.metrics.

Two ways to solve this problem :

  1. use variables.Variable._variable_v1_call()
  2. or you can choose the way to downgrade tensorflow version to 1.6.0
B3QL commented 5 years ago
  1. use variables.Variable._variable_v1_call()

Changing L51 in tf_extended\metrics.py to variables.VariableV1(...) fixes it.

TaehoLi commented 5 years ago

I fix this error by above one, thx!! (TypeError: _variable_v2_call() got an unexpected keyword argument 'collections')