BabyGAN icon indicating copy to clipboard operation
BabyGAN copied to clipboard

File "/content/BabyGAN/encoder/perceptual_model.py", line 242, in set_reference_images

Open Terkea opened this issue 3 years ago • 1 comments

Using TensorFlow backend.
WARNING:tensorflow:From <string>:364: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
2021-06-24 22:42:13.076041: W tensorflow/core/common_runtime/bfc_allocator.cc:305] Garbage collection: deallocate free memory regions (i.e., allocations) so that we can re-allocate a larger region to avoid OOM due to memory fragmentation. If you see this message frequently, you are running near the threshold of the available device memory and re-allocation may incur great performance overhead. You may try smaller batch sizes to observe the performance impact. Set TF_ENABLE_GPU_GARBAGE_COLLECTION=false if you'd like to disable this feature.
WARNING:tensorflow:From /tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
  0% 0/1 [00:00<?, ?it/s]WARNING:tensorflow:From /tensorflow-1.15.2/python3.7/keras/backend/tensorflow_backend.py:422: The name tf.global_variables is deprecated. Please use tf.compat.v1.global_variables instead.

WARNING:tensorflow:From /tensorflow-1.15.2/python3.7/keras/backend/tensorflow_backend.py:431: The name tf.is_variable_initialized is deprecated. Please use tf.compat.v1.is_variable_initialized instead.

WARNING:tensorflow:From /tensorflow-1.15.2/python3.7/keras/backend/tensorflow_backend.py:438: The name tf.variables_initializer is deprecated. Please use tf.compat.v1.variables_initializer instead.

Loading mask masks/father_01.png
Exception in mask handling for masks/mother_02.png
Traceback (most recent call last):
  File "/content/BabyGAN/encoder/perceptual_model.py", line 242, in set_reference_images
    imask = (255*mask).astype('uint8')
TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'
Loading ResNet Model:
  0% 0/1 [00:01<?, ?it/s]
Traceback (most recent call last):
  File "encode_images.py", line 242, in <module>
    main()
  File "encode_images.py", line 154, in main
    ff_model = load_model(args.load_resnet)
  File "/tensorflow-1.15.2/python3.7/keras/engine/saving.py", line 492, in load_wrapper
    return load_function(*args, **kwargs)
  File "/tensorflow-1.15.2/python3.7/keras/engine/saving.py", line 584, in load_model
    model = _deserialize_model(h5dict, custom_objects, compile)
  File "/tensorflow-1.15.2/python3.7/keras/engine/saving.py", line 273, in _deserialize_model
    model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-17-8e574cbe69ad> in <module>()
     19 with dnnlib.util.open_url(URL_FFHQ, cache_dir=config.cache_dir) as f:
     20     generator_network, discriminator_network, Gs_network = pickle.load(f)
---> 21 generator = Generator(Gs_network, batch_size=1, randomize_noise=False)
     22 model_scale = int(2*(math.log(1024,2)-1))
     23 

8 frames
/tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/variable_scope.py in _get_single_variable(self, name, shape, dtype, initializer, regularizer, partition_info, reuse, trainable, collections, caching_device, validate_shape, use_resource, constraint, synchronization, aggregation)
    866         tb = [x for x in tb if "tensorflow/python" not in x[0]][:5]
    867         raise ValueError("%s Originally defined at:\n\n%s" %
--> 868                          (err_msg, "".join(traceback.format_list(tb))))
    869       found_var = self._vars[name]
    870       if not shape.is_compatible_with(found_var.get_shape()):

ValueError: Variable learnable_dlatents already exists, disallowed. Did you mean to set reuse=True or reuse=tf.AUTO_REUSE in VarScope? Originally defined at:

  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/framework/ops.py", line 1748, in __init__
    self._traceback = tf_stack.extract_stack()
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal
    op_def=op_def)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/framework/ops.py", line 3357, in create_op
    attrs, op_def, compute_device)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/util/deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper
    op_def=op_def)

Terkea avatar Jun 24 '21 22:06 Terkea

Hi, I have the same problem, is there anyone who has fixed the bug? Thanks in advance.

tianye2856 avatar Jul 29 '21 08:07 tianye2856