If you have questions or bugs , this issue may help you a lot
I have solved all the problems and get the right picture. There are few bugs:
The model need four inputs: ori_img, makeup_img, ori_img's parsing,makeup_img's parsing. Well you can get the parsing in /faceutils/mask/main.py, after you get the right parsing, dimension bug will be solved The fucking idiot point is, run /faceutils/mask/main.py can not get the right parsing map!!! The value of the mask is wrong, in /makeuploader/dataset.py ,9 13 are lips, but /faceutils/mask/main.py regard 7 9 are lips!!!! So here is my suggestion: The original map is # mapper = [0, 1, 2, 3, 4, 5, 0, 11, 12, 0, 6, 8, 7, 9, 13, 0, 0, 10, 0] # lip_class = [7,9]# face_class = [1,6] # eyes_class = [4,5], you can change it as mapper = [0, 4, 2, 3, 1, 6, 0, 11, 12, 0, 8, 0, 13, 9, 10, 0, 0, 0, 0] .Then you can get the right mask.
The gt parsing in mtdataset is like this:
and if you dont change the mapper you will get:
which is absolutely wrong, and if you change the mapper as i suggest you can get:
The color code is as follow: import numpy as np import matplotlib.pyplot as plt from PIL import Image import os
root='/data/BeautyREC/imgs/makeup_imgs_seg' image='0d384dbbcc121ca5049c423f81c26e6a.png'
image_save='/data/BeautyREC/show_pre1.png' img = Image.open(os.path.join(root,image)) img=np.asarray(img)
color_map = { 7: [0, 0, 0], # 黑色 2: [0, 0, 0], # 黑色 11: [0, 0, 0], # 黑色 9: [255, 0, 0], # 红色 13: [255, 0, 0],# 红色 4: [0, 0, 128], # 深蓝色 8: [0, 0, 128], # 深蓝色 10: [0, 191, 255], # 浅蓝色 6: [0, 128, 0], # 绿色 1: [0, 128, 0] # 绿色 }
colored_image = np.zeros((img.shape[0], img.shape[1], 3), dtype=np.uint8)
for key, color in color_map.items(): colored_image[img == key] = color
image = Image.fromarray(colored_image) image.save(image_save)
well there is still a bug is that the user can't wear glasses, cause the class of glass will overlap the class of eyes,then the model will not find the eye and go wrong. Im looking for a way to view glass as skin and preserve the eye label
how can i test my own data?
MrPetrichor:I follow ur method to solve problem.But the result also is terrible. For exp, the background color is wrong.
MrPetrichor:I follow ur method to solve problem.But the result also is terrible. For exp, the background color is wrong.
When you test the picture above, can you get the right result like i showed? If you get the right result on the test picture but get wrong background in your own picture, maybe the model performance on your picture is determined to be wrong. If you want to test your own data, you can change the dataset code and read your own picture first. Then you should get your own data's mask like i showed above. Last you should transfer your own data and data's mask into the model.
Great solution.
But I also get bad resuts.
When I tried to use test.py to test the results after training, test.py couldn't generate test images and the result folder was empty