benbenlijie / style_swap_tensorflow

tensorflow code for Fast Patch-based Style Transfer of Arbitrary Style
Apache License 2.0
40 stars 12 forks source link

Attempting to use uninitialized value #2

Open Victordongy opened 6 years ago

Victordongy commented 6 years ago

I ran the command line as suggested in cmd, and the error showed as :

Caused by op 'inverse_net/conv1/Conv/biases/read', defined at:
  File "main.py", line 88, in <module>
    main()
  File "main.py", line 82, in main
    evaluate(config, args.content, args.style)
  File "main.py", line 35, in evaluate
    model.init_evaluate_model()
  File "C:\Users\User\Documents\machine_learning\CNN_deep_learning\week4\style_swap\style_swap_tensorflow\base\base_model.py", line 19, in init_evaluate_model
    self._build_evaluate_model()
  File "C:\Users\User\Documents\machine_learning\CNN_deep_learning\week4\style_swap\style_swap_tensorflow\models\style_swap_model.py", line 58, in _build_evaluate_model
    self.generated = self._inverse_net(self.swaped_tensor)
  File "C:\Users\User\Documents\machine_learning\CNN_deep_learning\week4\style_swap\style_swap_tensorflow\models\style_swap_model.py", line 143, in _inverse_net
    weights_regularizer=slim.l2_regularizer(self.config.weight_regulation_scale))
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\contrib\framework\python\ops\arg_scope.py", line 183, in func_with_args
    return func(*args, **current_args)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\contrib\layers\python\layers\layers.py", line 1049, in convolution
    outputs = layer.apply(inputs)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\layers\base.py", line 825, in apply
    return self.__call__(inputs, *args, **kwargs)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\layers\base.py", line 696, in __call__
    self.build(input_shapes)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\layers\convolutional.py", line 152, in build
    dtype=self.dtype)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\layers\base.py", line 546, in add_variable
    partitioner=partitioner)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\training\checkpointable.py", line 415, in _add_variable_with_custom_getter
    **kwargs_for_getter)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 1297, in get_variable
    constraint=constraint)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 1093, in get_variable
    constraint=constraint)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 431, in get_variable
    return custom_getter(**custom_getter_kwargs)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\contrib\layers\python\layers\layers.py", line 1611, in layer_variable_getter
    return _model_variable_getter(getter, *args, **kwargs)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\contrib\layers\python\layers\layers.py", line 1602, in _model_variable_getter
    use_resource=use_resource)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\contrib\framework\python\ops\arg_scope.py", line 183, in func_with_args
    return func(*args, **current_args)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\contrib\framework\python\ops\variables.py", line 291, in model_variable
    use_resource=use_resource)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\contrib\framework\python\ops\arg_scope.py", line 183, in func_with_args
    return func(*args, **current_args)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\contrib\framework\python\ops\variables.py", line 246, in variable
    use_resource=use_resource)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 408, in _true_getter
    use_resource=use_resource, constraint=constraint)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 800, in _get_single_variable
    use_resource=use_resource)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 2157, in variable
    use_resource=use_resource)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 2147, in <lambda>
    previous_getter = lambda **kwargs: default_variable_creator(None, **kwargs)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 2130, in default_variable_creator
    constraint=constraint)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\variables.py", line 235, in __init__
    constraint=constraint)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\variables.py", line 391, in _init_from_args
    self._snapshot = array_ops.identity(self._variable, name="read")
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\array_ops.py", line 142, in identity
    return gen_array_ops.identity(input, name=name)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\ops\gen_array_ops.py", line 3658, in identity
    "Identity", input=input, name=name)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper
    op_def=op_def)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 3290, in create_op
    op_def=op_def)
  File "C:\Users\User\Anaconda3\lib\site-packages\tensorflow\python\framework\ops.py", line 1654, in __init__
    self._traceback = self._graph._extract_stack()  # pylint: disable=protected-access

FailedPreconditionError (see above for traceback): Attempting to use uninitialized value inverse_net/conv1/Conv/biases
         [[Node: inverse_net/conv1/Conv/biases/read = Identity[T=DT_FLOAT, _class=["loc:@inverse_net/conv1/Conv/biases"], _device="/job:localhost/replica:0/task:0/device:CPU:0"](inverse_net/conv1/Conv/biases)]]

PS: Anaconda environment, python 3.5,

hgr215 commented 6 years ago

You should train the inverse net first. See the closed issues.