oldpan / deep-painterly-harmonization-pytorch Goto Github PK
View Code? Open in Web Editor NEWDeep-Painterly-Harmonization-Pytorch
Deep-Painterly-Harmonization-Pytorch
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
Hi, @Oldpan
Firstly, im very appreciate for sharing this useful pytorch version of 'Deep-Painterly-Harmonization-Pytorch'.
However, the original paper mentioned 'Independent Mapping' in the first pass, which did not use in this repo?
I cannot run this demo for now, so, im confused that, without the 'Independent Mapping', it still can generate reasonable results in the first pass comparing with the results shown in original paper?
从您的blog慕名而来,想学习一下直方图loss的计算方式... 可是发现您的代码里面这一块好像还有问题...
想咨询一下直方图loss的具体实现过程,看您是准备在hook中计算loss...这是为什么呢?
python train.py give me
True
===> 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-----
-----Setting up content layer-----
-----Setting up style layer-----
-----Setting up style layer-----
-----Setting up style layer-----
===> Optimizer running...
Traceback (most recent call last):
File "train.py", line 209, in
content_image, mask_image, tmask_image)
File "train.py", line 200, in run_painterly_transfer
optimizer.step(closure)
File "/home/tchaton/virtualenvs/labelbox/lib/python3.6/site-packages/torch/optim/lbfgs.py", line 103, in step
orig_loss = closure()
File "train.py", line 178, in closure
loss.backward()
File "/home/tchaton/virtualenvs/labelbox/lib/python3.6/site-packages/torch/tensor.py", line 93, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "/home/tchaton/virtualenvs/labelbox/lib/python3.6/site-packages/torch/autograd/init.py", line 90, in backward
allow_unreachable=True) # allow_unreachable flag
File "/home/tchaton/projects/original/Deep-Painterly-Harmonization-Pytorch/model.py", line 118, in style_hook
'grad_input:{} is not matchable with mask:{}'.format(grad_input[0].shape, self.mask.shape)
AssertionError: grad_input:torch.Size([1, 128, 170, 175]) is not matchable with mask:torch.Size([1, 1, 170, 175])
There seems to be something wrong in the loss function.The results are very poor.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.