DCGAN-tensorflow icon indicating copy to clipboard operation
DCGAN-tensorflow copied to clipboard

Got error using my own data

Open ComputerMystery opened this issue 8 years ago • 12 comments

Traceback (most recent call last): File "/home/sal/Downloads/pycharm-community-2016.2.3/helpers/pydev/pydevd.py", line 1580, in globals = debugger.run(setup['file'], None, None, is_module) File "/home/sal/Downloads/pycharm-community-2016.2.3/helpers/pydev/pydevd.py", line 964, in run pydev_imports.execfile(file, globals, locals) # execute the script File "/home/sal/PycharmProjects/ReID/GANReID/main.py", line 96, in tf.app.run() File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/app.py", line 30, in run sys.exit(main(sys.argv[:1] + flags_passthrough)) File "/home/sal/PycharmProjects/ReID/GANReID/main.py", line 76, in main sample_dir=FLAGS.sample_dir) File "/home/sal/PycharmProjects/ReID/GANReID/model.py", line 75, in init self.build_model() File "/home/sal/PycharmProjects/ReID/GANReID/model.py", line 107, in build_model self.G = self.generator(self.z) File "/home/sal/PycharmProjects/ReID/GANReID/model.py", line 359, in generator self.z_, [-1, s_h16, s_w16, self.gf_dim * 8]) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 1991, in reshape name=name) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 573, in apply_op _Attr(op_def, input_arg.type_attr)) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 60, in _SatisfiesTypeConstraint ", ".join(dtypes.as_dtype(x).name for x in allowed_list))) TypeError: DataType float32 for attr 'Tshape' not in list of allowed values: int32, int64

ComputerMystery avatar Feb 10 '17 12:02 ComputerMystery

Any help will be appreciated

ComputerMystery avatar Feb 10 '17 12:02 ComputerMystery

in the model.py seems exits a bug that this part below returns a float for reshape but reshape just accept int32. Need to convert

def conv_out_size_same(size, stride): return math.ceil(float(size) / float(stride))

ComputerMystery avatar Feb 11 '17 00:02 ComputerMystery

It works now!

ComputerMystery avatar Feb 11 '17 00:02 ComputerMystery

@ComputerMystery , Do you fix the error?

mittlin avatar Feb 13 '17 01:02 mittlin

@mittlin Already fixed . Just forced type convert to int for the returndef conv_out_size_same(size, stride): return int(math.ceil(float(size) / float(stride)))

ComputerMystery avatar Feb 13 '17 15:02 ComputerMystery

@ComputerMystery ,thanks

mittlin avatar Feb 16 '17 08:02 mittlin

Thanks for the suggestions. I applied the suggested change (def conv_out_size_same(size, stride): return int(math.ceil(float(size) / float(stride)))); but still getting the following error.

/python2.7/site-packages/PIL/Image.py", line 2651, in fromarray raise TypeError("Cannot handle this data type") TypeError: Cannot handle this data type

Please let me know if you have any suggestion for this error. THANK YOU!

maz369 avatar Sep 27 '19 21:09 maz369

@maz369 Hello? Have you solved the problem?

Boyle-Coffee avatar Nov 16 '19 04:11 Boyle-Coffee

I have a similar problem

/lib/python3.6/site-packages/PIL/Image.py", line 2647, in fromarray raise TypeError("Cannot handle this data type") TypeError: Cannot handle this data type

ioridev avatar Nov 19 '19 20:11 ioridev

I have a similar problem

/lib/python3.6/site-packages/PIL/Image.py", line 2647, in fromarray raise TypeError("Cannot handle this data type") TypeError: Cannot handle this data type

hi, may i ask if you have solved this problem?

hjumper avatar Feb 25 '22 14:02 hjumper

收到。

GraceYYJ avatar Feb 25 '22 14:02 GraceYYJ

您好:       来信我已收到,我会尽快回复的。

lihh1023 avatar Feb 25 '22 14:02 lihh1023