Oldpan / Deep-Painterly-Harmonization-Pytorch

Deep-Painterly-Harmonization-Pytorch
28 stars 4 forks source link

TypeError: integer argument expected, got float #2

Open Ianmcmill opened 5 years ago

Ianmcmill commented 5 years ago

Python 2.7.15rc1 Ubuntu 18.04 Cuda 9

Running with default args

python train.py
===> Using GPU to train
===> Loaing datasets
the image ndarray size is (682, 700, 3)
===> Initialize the image...
the image tensor size is torch.Size([1, 3, 682, 700])
===> Building the painterly model...
-----Setting up style layer-----
-----Setting up style layer-----
Traceback (most recent call last):
  File "train.py", line 205, in <module>
    content_image, mask_image, tmask_image)
  File "train.py", line 145, in run_painterly_transfer
    style_weight, content_weight, tv_weight)
  File "/home/castle/Deep-Painterly-Harmonization-Pytorch/model.py", line 182, in get_model_and_losses
    (math.floor(mask_image.shape[1] / 2), math.floor(mask_image.shape[0] / 2)))
TypeError: integer argument expected, got float
Oldpan commented 5 years ago

I think the reason is that, you are using python2.7 where the code 2/4 will be 0(will be 0.5 in python3.6). ... By the way, the code is a mess and I haven't found some time to perfect it. Hope you find the code helpful~