def test_compare(self):
     print('test_compare')
     argv = [os.path.join('data/', self.pretrained_model_name),
             'data/images/Anthony_Hopkins_0001.jpg',
             'data/images/Anthony_Hopkins_0002.jpg' ]
     args = compare.parse_arguments(argv)
     compare.main(args)
Exemplo n.º 2
0
def init():
    global authorized_image_embeddings, pnet, rnet, onet, args, eval_graph

    model_location = './outputs/20180402-114759.pb'
    authorized_pictures = ['./outputs/IMG_9820.JPG',
                           './outputs/IMG_9822.JPG',
                           './outputs/ktXdtHO.JPG']

    argv = [model_location]
    for pic in authorized_pictures:
        argv.append(pic)
    args = compare.parse_arguments(argv)

    print('Creating networks and loading parameters')
    with tf.Graph().as_default():
        sess = tf.Session()
        with sess.as_default():
            pnet, rnet, onet = align.detect_face.create_mtcnn(sess, None)

    authorized_images = load_and_align_data(args.image_files, args.image_size, args.margin)
    with tf.Graph().as_default():
        with tf.Session() as sess:
            # Load the model
            facenet.load_model(args.model)
            eval_graph = tf.get_default_graph()

            images_placeholder = tf.get_default_graph().get_tensor_by_name("input:0")
            embeddings = tf.get_default_graph().get_tensor_by_name("embeddings:0")
            phase_train_placeholder = tf.get_default_graph().get_tensor_by_name("phase_train:0")

            # Run forward pass to calculate embeddings
            feed_dict = {images_placeholder: authorized_images, phase_train_placeholder: False}
            authorized_image_embeddings = sess.run(embeddings, feed_dict=feed_dict)
Exemplo n.º 3
0
 def test_compare(self):
     argv = [
         '../data/model/20160620-173927/model.ckpt-500000',
         '../data/images/Anthony_Hopkins_0001.png',
         '../data/images/Anthony_Hopkins_0002.png'
     ]
     args = compare.parse_arguments(argv)
     compare.main(args)
Exemplo n.º 4
0
 def test_compare(self):
     argv = [
         os.path.join('data/', self.pretrained_model_name),
         'data/images/Anthony_Hopkins_0001.jpg',
         'data/images/Anthony_Hopkins_0002.jpg'
     ]
     args = compare.parse_arguments(argv)
     compare.main(args)
Exemplo n.º 5
0
 def test_compare(self):
     argv = ['../data/model/20161030-023650/',
             'model-20161030-023650.meta',
             'model-20161030-023650.ckpt-80000',
             '../data/images/Anthony_Hopkins_0001.jpg',
             '../data/images/Anthony_Hopkins_0002.jpg' ]
     args = compare.parse_arguments(argv)
     compare.main(args)
Exemplo n.º 6
0
 def test_compare(self):
     argv = ['../data/model/20161030-023650/',
             'model-20161030-023650.meta',
             'model-20161030-023650.ckpt-80000',
             '../data/images/Anthony_Hopkins_0001.jpg',
             '../data/images/Anthony_Hopkins_0002.jpg' ]
     args = compare.parse_arguments(argv)
     compare.main(args)
Exemplo n.º 7
0
 def compare2():
     sys.argv[1:] = [e1.get(), e2.get()]
     dist, time1 = compare.main(compare.parse_arguments(sys.argv[1:]))
     if dist < 1:
         var3.set(dist)
         var4.set("判断为同一个人脸")
     else:
         var3.set(dist)
         var4.set("判断为不是同一个人脸")
     var5.set(time1)
Exemplo n.º 8
0
def init():
    global authorized_image_embeddings, pnet, rnet, onet, args, eval_graph

    model_location = "C:\\Users\\typollak\\Documents\\Hackathon2018-20180723T192115Z-001\\Hackathon2018\\facenet\\src\\VGGFace2\\20180402-114759.pb"
    authorized_pictures = [
        'C:\\Users\\typollak\\Documents\\Hackathon2018-20180723T192115Z-001\\Hackathon2018\\facenet\\src\\pics\\IMG_9822.JPG'
    ]

    argv = [model_location]
    for pic in authorized_pictures:
        argv.append(pic)
    args = compare.parse_arguments(argv)

    print('Creating networks and loading parameters')
    with tf.Graph().as_default():
        gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=.3)
        sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options,
                                                log_device_placement=False))
        with sess.as_default():
            pnet, rnet, onet = align.detect_face.create_mtcnn(sess, None)

    authorized_images = load_and_align_data(args.image_files, args.image_size,
                                            args.margin)
    with tf.Graph().as_default():
        with tf.Session() as sess:
            # Load the model
            facenet.load_model(args.model)
            eval_graph = tf.get_default_graph()

            images_placeholder = tf.get_default_graph().get_tensor_by_name(
                "input:0")
            embeddings = tf.get_default_graph().get_tensor_by_name(
                "embeddings:0")
            phase_train_placeholder = tf.get_default_graph(
            ).get_tensor_by_name("phase_train:0")

            # Run forward pass to calculate embeddings
            feed_dict = {
                images_placeholder: authorized_images,
                phase_train_placeholder: False
            }
            authorized_image_embeddings = sess.run(embeddings,
                                                   feed_dict=feed_dict)
    args.image_files.append("input")
Exemplo n.º 9
0
 def test_compare(self):
     argv = ['../data/model/20160620-173927/model.ckpt-500000', 
             '../data/images/Anthony_Hopkins_0001.png',
             '../data/images/Anthony_Hopkins_0002.png' ]
     args = compare.parse_arguments(argv)
     compare.main(args)