kvfrans / deepcolor

Automatic coloring and shading of manga-style lineart, using Tensorflow + cGANs
http://color.kvfrans.com
553 stars 86 forks source link

I have a question about data process "main.imageblur()" +1 #8

Open dev6969 opened 6 years ago

dev6969 commented 6 years ago

thank you for sharing!!!!!!!!!

I get a question while implementing the code and ask. Is it ok to use it without a deep copy?

test in python3

my test cord this

def imageblur(img, sampling=False):
    if sampling:
        cimg = cimg * 0.3 + np.ones_like(cimg) * 0.7 * 255
    else:
        for i in range(30):
            randx = randint(0,205)
            randy = randint(0,205)
            cimg[randx:randx+50, randy:randy+50] = 255
    return cv2.blur(cimg,(100,100))
img = get_img(path)
img_b = imageblur(img)
nvc = np.concatenate((img,img_b),axis=1)
cv2.imshow("TEST",nvc)

and result ...

2018-10-22 00-36-34

my test cord_2_add deep copy this

def imageblur(img, sampling=False):
    cimg = copy.deepcopy(img) #Add deep copy
    if sampling:
        cimg = cimg * 0.3 + np.ones_like(cimg) * 0.7 * 255
    else:
        for i in range(30):
            randx = randint(0,205)
            randy = randint(0,205)
            cimg[randx:randx+50, randy:randy+50] = 255
    return cv2.blur(cimg,(100,100))
img = get_img(path)
img_b = imageblur(img)
nvc = np.concatenate((img,img_b),axis=1)
cv2.imshow("TEST",nvc)

and result 2018-10-22 00-35-59

And one more why expand edge image dims in placeholder set dim 1 I am curious as to whether it should be expanded

            batch_edge = np.expand_dims(batch_edge, 3)

Thank you again for sharing. !!