Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: float() argument must be a string or number #9

Open
vjtrost88 opened this issue May 21, 2019 · 2 comments
Open

TypeError: float() argument must be a string or number #9

vjtrost88 opened this issue May 21, 2019 · 2 comments

Comments

@vjtrost88
Copy link

I finally got the directory tree into the format the h5tool.py script was expecting. Now when I try to run it, I get the following error:

$ python h5tool.py create_celeba_hq 123456.h5 dirA/ dirB/
Loading CelebA data from dirA/
(202599, 5, 2)
Loading CelebA-HQ deltas from dirB/


Worker thread caught an exception:
Traceback (most recent call last):
  File "h5tool.py", line 97, in run
    result = func(*args)
  File "h5tool.py", line 146, in task_func
    return process_func(prepared)

  File "h5tool.py", line 556, in process_func
    img = np.pad(np.float32(img), ((pad[1], pad[3]), (pad[0], pad[2]), (0, 0)), 'reflect')
TypeError: float() argument must be a string or a number

Traceback (most recent call last):
  File "h5tool.py", line 695, in <module>
    execute_cmdline(sys.argv)
  File "h5tool.py", line 690, in execute_cmdline
    func(**vars(args))
  File "h5tool.py", line 596, in create_celeba_hq
    for orig_fn, aimg64, aimg128, aimg256, aimg512, aimg1024 in pool.process_items_concurrently(fields['idx'], process_func=process_func, max_items_in_flight=num_tasks):
  File "h5tool.py", line 161, in process_items_concurrently
    for res in retire_result(): yield res
  File "h5tool.py", line 149, in retire_result
    processed, (prepared, idx) = self.get_result(task_func)
  File "h5tool.py", line 126, in get_result
    raise result.type, result.value
TypeError: float() argument must be a string or a number

It seems that img object is of type 'JpegImageFile' but I'm not familiar with how Numpy works with those.
My python version is 2.7.15.
Can anyone help me resolve this? Thanks!

@zhengziqiang
Copy link

I have the same problem with you, have you solved this problem? @vjtrost88

@zhengziqiang
Copy link

I solved this problem, and I used the wrong img_celeba.zip. It should been downloaded from https://drive.google.com/drive/folders/0B7EVK8r0v71peklHb0pGdDl6R28

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants