STYLEGAN ADA2 implemenation on melanoma dataset

106 Views Asked by At

I went through your article titled "Training StyleGAN2 ADA with a custom dataset" and try to reproduce it on my own dataset of melanoma skin cancer. I resized all the images to 1024*1024 and followed all the steps you mentioned in your article. After running the python train.py file I am getting the following errors:

Traceback (most recent call last):
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/framework/ops.py", line 2380, in get_attr
    c_api.TF_OperationGetAttrValueProto(self._c_op, name, buf)
tensorflow.python.framework.errors_impl.InvalidArgumentError: Operation 'Train_gpu0/Augment_1/transform/ImageProjectiveTransformV2' has no attr named '_XlaCompile'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/gradients_util.py", line 345, in _MaybeCompile
    xla_compile = op.get_attr("_XlaCompile")

  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/framework/ops.py", line 2384, in get_attr
    raise ValueError(str(e))
ValueError: Operation 'Train_gpu0/Augment_1/transform/ImageProjectiveTransformV2' has no attr named '_XlaCompile'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "train.py", line 645, in <module>
    main()
  File "train.py", line 637, in main
    run_training(**vars(args))

  File "train.py", line 522, in run_training
    training_loop.training_loop(**training_options)
  File "/content/drive/MyDrive/colab-sg2-ada/stylegan2-ada/training/training_loop.py", line 188, in training_loop
    terms = dnnlib.util.call_func_by_name(G=G_gpu, D=D_gpu, aug=aug, fake_labels=fake_labels, real_images=real_images_var, real_labels=real_labels_var, **loss_args)

  File "/content/drive/MyDrive/colab-sg2-ada/stylegan2-ada/dnnlib/util.py", line 281, in call_func_by_name
    return func_obj(*args, **kwargs)
  File "/content/drive/MyDrive/colab-sg2-ada/stylegan2-ada/training/loss.py", line 117, in stylegan2
    r1_grads = tf.gradients(tf.reduce_sum(D_real.scores), [real_images])[0]

  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/gradients_impl.py", line 158, in gradients
    unconnected_gradients)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/gradients_util.py", line 679, in _GradientsHelper
    lambda: grad_fn(op, *out_grads))
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/gradients_util.py", line 350, in _MaybeCompile
    return grad_fn()  # Exit early
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/gradients_util.py", line 679, in <lambda>
    lambda: grad_fn(op, *out_grads))

  File "/tensorflow-1.15.2/python3.7/tensorflow_core/contrib/image/python/ops/image_ops.py", line 420, in _image_projective_transform_grad
    transforms = flat_transforms_to_matrices(transforms=transforms)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/contrib/image/python/ops/image_ops.py", line 362, in flat_transforms_to_matrices
    [transforms, array_ops.ones([num_transforms, 1])], axis=1),
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/array_ops.py", line 2560, in ones
    output = _constant_if_small(one, shape, dtype, name)

  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/array_ops.py", line 2295, in _constant_if_small
    if np.prod(shape) < 1000:
  File "<__array_function__ internals>", line 6, in prod
  File "/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py", line 3052, in prod
    keepdims=keepdims, initial=initial, where=where)

  File "/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py", line 86, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/framework/ops.py", line 736, in __array__
    " array.".format(self.name))

**NotImplementedError: Cannot convert a symbolic Tensor 
(Train_gpu0/Loss_R1/gradients/Train_gpu0/Augment_1/transform/ImageProjectiveTransformV2_grad/flat_transforms_to_matrices/strided_slice:0) to a numpy array.**

Anyone Please help me in this regard, I shall be highly thankful to you.

0

There are 0 best solutions below