White-box-Cartoonization icon indicating copy to clipboard operation
White-box-Cartoonization copied to clipboard

More contours

Open GustavoStahl opened this issue 5 years ago • 4 comments

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

GustavoStahl avatar Sep 05 '20 14:09 GustavoStahl

@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

SystemErrorWang avatar Sep 07 '20 15:09 SystemErrorWang

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?

GustavoStahl avatar Oct 21 '20 20:10 GustavoStahl

@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.

SystemErrorWang avatar Oct 22 '20 03:10 SystemErrorWang

@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?

GustavoStahl avatar Oct 23 '20 00:10 GustavoStahl