SystemErrorWang / White-box-Cartoonization

Official tensorflow implementation for CVPR2020 paper “Learning to Cartoonize Using White-box Cartoon Representations”
3.95k stars 737 forks source link

More contours #44

Open GustavoStahl opened 4 years ago

GustavoStahl commented 4 years ago

Is there a way to emphasize the subject contours? When comparing some inference results with a self dataset, the overall style was successfully extracted, but the contours where a little off. I've tried increasing the weight on texture loss, but the results weren't pleasing. Following there is an example.

no_contours-resize

SystemErrorWang commented 4 years ago

@GustavoStahl You can try to increase the weight of g_loss_gray (in the code) / Ltexture (in the paper), this may emphasize the contours to some extent. if this is not enough, you can try other methods such as sobel edge detection,HED,or even use Photoshop

GustavoStahl commented 3 years ago

I managed to solve the contour problem by gathering more cartoon images with contours, my current struggle is getting smoothed surfaces. When i increased g_loss_blur/d_loss_blur (Lsurface) and recon_loss (Lcontent) the results lost all the contours, then i tried only increasing g_loss_gray (Ltexture) to see it's behavior, but the output kept similar, with no effective changes on increasing or decreasing contours. Do you have any tip on how to achieve this?

SystemErrorWang commented 3 years ago

@GustavoStahl according to my experience, only increase g_loss_gray will generate results with more contours but also more noises. Mayby you can try to adjust the result by tuning the weight of last guided filter you can either change the hyper parameters of guided filter layer in 28th line of cartoonize.py, or get both network_out and final_out and do alpha-blending between them.

GustavoStahl commented 3 years ago

@SystemErrorWang I tried applying the guided filter on the input image (e.g.: gf(input, input)), since doing in the output will cause the contours to disappear, the results i got were either subtle or harsh. What worked very well is the bilateral filter from OpenCV, the problem is that it take too long.

Regarding hyperparametrs tuning on training, i decreased recon_loss (Lcontent) and increased g_loss_blur/d_loss_blur (Lsurface), which led to more real and less washed looking cartoon, is the last effect is related to the Lcontent?