Exemple #1
0
    def _test_on_W300(self, model):
        tf_record_utility = TFRecordUtility(self.num_landmark)

        lbl_arr_challenging, img_arr_challenging = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=IbugConf.tf_test_path_challenging,
            number_of_records=IbugConf.orig_number_of_test_challenging,
            only_label=False)

        nme_ch, fr_ch, auc_ch, mae_yaw_ch, mae_pitch_ch, mae_roll_ch = self._calculate_errors(model, W300Conf.number_of_all_sample_challenging,
            img_arr_challenging, lbl_arr_challenging)

        lbl_arr_challenging = np.array(lbl_arr_challenging)
        img_arr_challenging = np.array(img_arr_challenging)

        print('nme_ch: ', str(nme_ch), 'fr_ch: ', str(fr_ch), 'auc_ch: ', str(auc_ch))
        print('mae_yaw: ', str(mae_yaw_ch), 'mae_pitch: ', str(mae_pitch_ch), 'mae_roll: ', str(mae_roll_ch))

        lbl_arr_common, img_arr_common = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=IbugConf.tf_test_path_common,
            number_of_records=IbugConf.orig_number_of_test_common,
            only_label=False)

        lbl_arr_full, img_arr_full = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=IbugConf.tf_test_path_full,
            number_of_records=IbugConf.orig_number_of_test_full,
            only_label=False)


        lbl_arr_common = np.array(lbl_arr_common)
        img_arr_common = np.array(img_arr_common)

        lbl_arr_full = np.array(lbl_arr_full)
        img_arr_full = np.array(img_arr_full)


        nme_c, fr_c, auc_c, mae_yaw_c, mae_pitch_c, mae_roll_c = self._calculate_errors(model,
                                                                                        W300Conf.number_of_all_sample_common,
                                                                                        img_arr_common, lbl_arr_common)
        print('nme_c: ', str(nme_c), 'fr_c: ', str(fr_c), 'auc_c: ', str(auc_c))
        print('mae_yaw: ', str(mae_yaw_c), 'mae_pitch: ', str(mae_pitch_c), 'mae_roll: ', str(mae_roll_c))

        nme_f, fr_f, auc_f, mae_yaw_f, mae_pitch_f, mae_roll_f = self._calculate_errors(model,
                                                                                        W300Conf.number_of_all_sample_full,
                                                                                        img_arr_full, lbl_arr_full)
        print('nme_f: ', str(nme_f), 'fr_f: ', str(fr_f), 'auc_f: ', str(auc_f))
        print('mae_yaw: ', str(mae_yaw_f), 'mae_pitch: ', str(mae_pitch_f), 'mae_roll: ', str(mae_roll_f))

        result_str = "-------------------------_test_on_W300------------------------------------" + '\n\r' \
                     'nme_ch: ', str(nme_ch), 'fr_ch: ', str(fr_ch), 'auc_ch: ', str(auc_ch) + '\n\r' \
                     'mae_yaw: ', str(mae_yaw_ch), 'mae_pitch: ', str(mae_pitch_ch), 'mae_roll: ', str(mae_roll_ch) + '\n\r' \
                     'nme_c: ', str(nme_c), 'fr_c: ', str(fr_c), 'auc_c: ', str(auc_c) + '\n\r' \
                     'mae_yaw: ', str(mae_yaw_c), 'mae_pitch: ', str(mae_pitch_c), 'mae_roll: ', str(mae_roll_c) + '\n\r' \
                     'nme_f: ', str(nme_f), 'fr_f: ', str(fr_f), 'auc_f: ', str(auc_f) + '\n\r' \
                     'mae_yaw: ', str(mae_yaw_f), 'mae_pitch: ', str(mae_pitch_f), 'mae_roll: ', str(mae_roll_f)
        return str(result_str)
Exemple #2
0
    def _test_on_W300(self, model):
        tf_record_utility = TFRecordUtility(self.output_len)
        lbl_arr_challenging, img_arr_challenging = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=W300Conf.tf_challenging,
            number_of_records=W300Conf.number_of_all_sample_challenging,
            only_label=False)
        lbl_arr_common, img_arr_common = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=W300Conf.tf_common,
            number_of_records=W300Conf.number_of_all_sample_common,
            only_label=False)
        lbl_arr_full, img_arr_full = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=W300Conf.tf_full,
            number_of_records=W300Conf.number_of_all_sample_full,
            only_label=False)

        lbl_arr_challenging = np.array(lbl_arr_challenging)
        img_arr_challenging = np.array(img_arr_challenging)

        lbl_arr_common = np.array(lbl_arr_common)
        img_arr_common = np.array(img_arr_common)

        lbl_arr_full = np.array(lbl_arr_full)
        img_arr_full = np.array(img_arr_full)

        nme_ch, fr_ch, auc_ch = self._calculate_errors(
            model, W300Conf.number_of_all_sample_challenging,
            img_arr_challenging, lbl_arr_challenging)
        print('nme_ch: ', str(nme_ch), 'fr_ch: ', str(fr_ch), 'auc_ch: ',
              str(auc_ch))

        nme_c, fr_c, auc_c = self._calculate_errors(
            model, W300Conf.number_of_all_sample_common, img_arr_common,
            lbl_arr_common)
        print('nme_c: ', str(nme_c), 'fr_c: ', str(fr_c), 'auc_c: ',
              str(auc_c))

        nme_f, fr_f, auc_f = self._calculate_errors(
            model, W300Conf.number_of_all_sample_full, img_arr_full,
            lbl_arr_full)
        print('nme_f: ', str(nme_f), 'fr_f: ', str(fr_f), 'auc_f: ',
              str(auc_f))
Exemple #3
0
    def _test_on_COFW(self, model):
        tf_record_utility = TFRecordUtility(self.output_len)
        lbl_arr_total, img_arr_total = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=CofwConf.tf_test_path,
            number_of_records=CofwConf.orig_number_of_test,
            only_label=False)
        lbl_arr_total = np.array(lbl_arr_total)
        img_arr_total = np.array(img_arr_total)

        nme, fr, auc, = self._calculate_errors(model,
                                               CofwConf.orig_number_of_test,
                                               img_arr_total, lbl_arr_total)
        print('nme: ', str(nme), 'fr: ', str(fr), 'auc: ', str(auc))
        print("-------------------------------------------------------------")
Exemple #4
0
    def _test_on_COFW(self, model):
        tf_record_utility = TFRecordUtility(self.output_len)
        lbl_arr_total, img_arr_total = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=CofwConf.tf_test_path,
            number_of_records=CofwConf.orig_number_of_test,
            only_label=False)
        lbl_arr_total = np.array(lbl_arr_total)
        img_arr_total = np.array(img_arr_total)

        nme, fr, auc, mae_yaw, mae_pitch, mae_roll = self._calculate_errors(model,
                                                                            CofwConf.orig_number_of_test,
                                                                            img_arr_total, lbl_arr_total)

        result_str = "-------------------------_test_on_COFW------------------------------------" + '\n\r' \
                     + 'nme: ', str(nme), 'fr: ', str(fr), 'auc: ', str(auc) + '\n\r' \
                     + 'mae_yaw: ', str(mae_yaw), 'mae_pitch: ', str(mae_pitch), 'mae_roll: ', str(mae_roll)

        print('nme: ', str(nme), 'fr: ', str(fr), 'auc: ', str(auc))
        print('mae_yaw: ', str(mae_yaw), 'mae_pitch: ', str(mae_pitch), 'mae_roll: ', str(mae_roll))
        print("-------------------------------------------------------------")

        return result_str
Exemple #5
0
    def _test_on_WFLW(self, model):
        tf_record_utility = TFRecordUtility(self.num_landmark)

        result_str = ''

        # lbl_arr_total, img_arr_total = tf_record_utility.retrieve_tf_record_test_set(
        #     tfrecord_filename=WflwConf.tf_test_path,
        #     number_of_records=WflwConf.orig_number_of_test,
        #     only_label=False)
        # nme, fr, auc, mae_yaw, mae_pitch, mae_roll = self._calculate_errors(detect, model, WflwConf.orig_number_of_test,
        #                                                                     img_arr_total, lbl_arr_total)

        # result_str += "\n\r\n\r-------------------------_test_on_WFLW:total------------------------------------" + '\n\r' \
        #              + 'nme: ', str(nme), 'fr: ', str(fr), 'auc: ', str(auc) + '\n\r' \
        #              + 'mae_yaw: ', str(mae_yaw), 'mae_pitch: ', str(mae_pitch), 'mae_roll: ', str(mae_roll)
        #
        # print('nme: ', str(nme), 'fr: ', str(fr), 'auc: ', str(auc))
        # print('mae_yaw: ', str(mae_yaw), 'mae_pitch: ', str(mae_pitch), 'mae_roll: ', str(mae_roll))
        # print("-------------------------------------------------------------")
        #
        lbl_arr_largepose, img_arr_largepose = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=WflwConf.tf_test_path_largepose,
            number_of_records=WflwConf.orig_of_all_test_largepose,
            only_label=False)
        nme, fr, auc, mae_yaw, mae_pitch, mae_roll = self._calculate_errors(model, WflwConf.orig_of_all_test_largepose,
                                                                            img_arr_largepose, lbl_arr_largepose)
        result_str += '\n\r\n\r-------------------------_test_on_WFLW: largepose------------------------------------nme: '\
                      + str(nme)+'fr: ' + str(fr) + 'auc: '+ str(auc) + '\n\r' + 'mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '\
                      + str(mae_pitch)+ 'mae_roll: '+ str(mae_roll)
        print('nme: '+ str(nme)+ 'fr: ' + str(fr)+ 'auc: '+ str(auc))
        print('mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '+ str(mae_pitch)+ 'mae_roll: '+ str(mae_roll))
        print("-------------------------------------------------------------")


        lbl_arr_occlusion, img_arr_occlusion = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=WflwConf.tf_test_path_occlusion,
            number_of_records=WflwConf.orig_of_all_test_occlusion,
            only_label=False)
        nme, fr, auc, mae_yaw, mae_pitch, mae_roll = self._calculate_errors(model, WflwConf.orig_of_all_test_occlusion,
                                                                            img_arr_occlusion, lbl_arr_occlusion)
        result_str += '\n\r\n\r-------------------------_test_on_WFLW _occlusion------------------------------------'+ '\n\r' \
                      + 'nme: '+ str(nme)+ 'fr: '+ str(fr)+ 'auc: '+ str(auc) + '\n\r' \
                      + 'mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '+ str(mae_pitch)+ 'mae_roll: '+ str(mae_roll)

        print('nme: '+ str(nme)+ 'fr: '+ str(fr)+ 'auc: '+ str(auc))
        print('mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '+ str(mae_pitch)+ 'mae_roll: '+ str(mae_roll))
        print("-------------------------------------------------------------")


        lbl_arr_makeup, img_arr_makeup = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=WflwConf.tf_test_path_makeup,
            number_of_records=WflwConf.orig_of_all_test_makeup,
            only_label=False)
        nme, fr, auc, mae_yaw, mae_pitch, mae_roll = self._calculate_errors(model, WflwConf.orig_of_all_test_makeup,
                                                                            img_arr_makeup, lbl_arr_makeup)
        result_str += '\n\r\n\r-------------------------_test_on_WFLW_makeup------------------------------------' + '\n\r' \
                      + 'nme: '+ str(nme)+ 'fr: '+ str(fr)+ 'auc: '+ str(auc) + '\n\r' \
                      + 'mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '+ str(mae_pitch)+ 'mae_roll: '+ str(mae_roll)
        print('nme: '+ str(nme)+ 'fr: '+ str(fr)+ 'auc: '+ str(auc))
        print('mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '+ str(mae_pitch)+ 'mae_roll: '+ str(mae_roll))
        print("-------------------------------------------------------------")

        lbl_arr_expression, img_arr_expression = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=WflwConf.tf_test_path_expression,
            number_of_records=WflwConf.orig_of_all_test_expression,
            only_label=False)
        nme, fr, auc, mae_yaw, mae_pitch, mae_roll = self._calculate_errors(model, WflwConf.orig_of_all_test_expression,
                                                                            img_arr_expression, lbl_arr_expression)
        result_str += '\n\r\n\r-------------------------_test_on_WFLW_expression------------------------------------' + '\n\r' \
                      + 'nme: '+ str(nme)+ 'fr: '+ str(fr)+ 'auc: '+ str(auc) + '\n\r' \
                      + 'mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '+ str(mae_pitch)+ 'mae_roll: '+ str(mae_roll)
        print('nme: '+ str(nme)+ 'fr: '+ str(fr)+ 'auc: '+ str(auc))
        print('mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '+ str(mae_pitch)+ 'mae_roll: '+ str(mae_roll))
        print("-------------------------------------------------------------")


        lbl_arr_illumination, img_arr_illumination = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=WflwConf.tf_test_path_illumination,
            number_of_records=WflwConf.orig_of_all_test_illumination,
            only_label=False)
        nme, fr, auc, mae_yaw, mae_pitch, mae_roll = self._calculate_errors(model, WflwConf.orig_of_all_test_illumination,
                                                                            img_arr_illumination, lbl_arr_illumination)

        result_str += '\n\r\n\r-------------------------_test_on_WFLW _illumination ------------------------------------' + '\n\r' \
                      + 'nme: '+ str(nme)+ 'fr: '+ str(fr)+ 'auc: '+ str(auc) + '\n\r' \
                      + 'mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '+ str(mae_pitch)+ 'mae_roll: '+ str(mae_roll)

        print('nme: '+ str(nme)+ 'fr: '+ str(fr)+ 'auc: '+ str(auc))
        print('mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '+ str(mae_pitch) + 'mae_roll: ' + str(mae_roll))
        print("-------------------------------------------------------------")

        lbl_arr_blur, img_arr_blur = tf_record_utility.retrieve_tf_record_test_set(
            tfrecord_filename=WflwConf.tf_test_path_blur,
            number_of_records=WflwConf.orig_of_all_test_blur,
            only_label=False)
        nme, fr, auc, mae_yaw, mae_pitch, mae_roll = self._calculate_errors(model, WflwConf.orig_of_all_test_blur,
                                                                            img_arr_blur, lbl_arr_blur)

        result_str += '\n\r\n\r-------------------------_test_on_WFLW_blur------------------------------------' + '\n\r' \
                      + 'nme: '+ str(nme)+ 'fr: '+ str(fr)+ 'auc: '+ str(auc) + '\n\r' \
                      + 'mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '+ str(mae_pitch)+ 'mae_roll: '+ str(mae_roll)

        print('nme: '+ str(nme)+ 'fr: '+ str(fr)+ 'auc: '+ str(auc))
        print('mae_yaw: '+ str(mae_yaw)+ 'mae_pitch: '+ str(mae_pitch)+ 'mae_roll: '+ str(mae_roll))
        print("-------------------------------------------------------------")

        return result_str