def compare()

in source/simulate/face_compare.py [0:0]


    def compare(self):
        image_pair_names = [
            ['test_1_source.jpg', 'test_1_target.jpg'],
        ]

        for [source_image_name, target_image_name] in image_pair_names:
            source_full_path = os.path.join(self._face_compare_pairs_root_dir, source_image_name)
            target_full_path = os.path.join(self._face_compare_pairs_root_dir, target_image_name)
            print('Test image {} (source), {} (target):'.format(source_full_path, target_full_path))

            # Step 1: read image and execute base64 encoding
            source_image_base64_enc = self.get_base64_encoding(source_full_path)
            target_image_base64_enc = self.get_base64_encoding(target_full_path)

            # Step 2: send request to backend
            request_body = {
                "timestamp": str(time.time()),
                "request_id": 1242322,
                "source_image": source_image_base64_enc,
                "target_image": target_image_base64_enc
            }

            t1 = time.time()
            response = requests.post(self._face_compare_url, data=json.dumps(request_body))
            t2 = time.time()
            print('Time cost = {}'.format(t2 - t1))

            # Step 3: visualization
            response = json.loads(response.text)
            print('Response = {}'.format(response))

            image_1 = cv2.imread(source_full_path, cv2.IMREAD_COLOR)
            image_2 = cv2.imread(target_full_path, cv2.IMREAD_COLOR)
            self.visualize(image_1, image_2, response)