Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About the Parsing net inference code #24

Open
kingsj0405 opened this issue Apr 8, 2021 · 0 comments
Open

About the Parsing net inference code #24

kingsj0405 opened this issue Apr 8, 2021 · 0 comments

Comments

@kingsj0405
Copy link

kingsj0405 commented Apr 8, 2021

Hello.
Thank you for your great work.
I'm currently try to use Face Parsing net of Lin et al. method to get face and hairear segmentation map like following image.

3_0718_2_vis_pre_seg

But the output of network is not desirable...
(+) I get (256, 256, 3) segmentation map although input image is (512, 512, 3).

3_0718_2_vis_cur_seg

My code for getting network is as following:

def get_pretrained_face_parser(sess=None):
    graph_input_img = tf.placeholder(dtype=tf.float32)
    graph_facial_landmark = tf.placeholder(dtype=tf.float32, shape=[1, 68, 2])
    graph_face_parsing = Parsing(graph_input_img, graph_facial_landmark)
    graph = tf.get_default_graph()
    if not sess:
        sess = tf.Session()
        sess.run(tf.global_variables_initializer())
    # get variable list
    var_list = tf.trainable_variables()
    g_list = tf.global_variables()
    bn_moving_vars = [g for g in g_list if 'moving_mean' in g.name]
    bn_moving_vars += [g for g in g_list if 'moving_variance' in g.name]
    var_list +=bn_moving_vars
    parser_vars = [v for v in var_list if 'FaceParser' in v.name]
    # restore weight provided by Lin et al.
    saver_parser = tf.train.Saver(var_list=parser_vars)
    saver_parser.restore(sess, os.path.join('./training/pretrained_weights/parsing_net','faceparser_public'))
    return sess, graph, graph_face_parsing, graph_input_img, graph_facial_landmark

Also I use Preprocess function from preprocess/preprocess_utils.py. Is there some suggestion to utilize your code?

I already check #19
Have a nice day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant