Skip to content

About the Parsing net inference code #24

@kingsj0405

Description

@kingsj0405

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions