def compute_object_vanishing_gradient_and_loss(self, x, detections=None): detections_ = np.asarray([]) encoded_labels = preprocess_true_boxes(detections_, input_shape=self.model_img_size, anchors=self.anchors, num_classes=self.num_classes) return K.get_session().run( [self.object_vanishing_gradient, self.object_vanishing_loss], feed_dict={ self.encoded_labels[0]: encoded_labels[0], self.encoded_labels[1]: encoded_labels[1], self.encoded_labels[2]: encoded_labels[2], self.model.input: x })
def compute_object_mislabeling_gradient_and_loss(self, x, detections): detections_ = np.asarray([ detections[:, [-4, -3, -2, -1, 0]] if len(detections) > 0 else detections ]) encoded_labels = preprocess_true_boxes(detections_, input_shape=self.model_img_size, anchors=self.anchors, num_classes=self.num_classes) return K.get_session().run( [self.object_mislabeling_gradient, self.object_mislabeling_loss], feed_dict={ self.encoded_labels[0]: encoded_labels[0], self.encoded_labels[1]: encoded_labels[1], self.encoded_labels[2]: encoded_labels[2], self.model.input: x })
def compute_object_fabrication_gradient(self, x, detections=None): detections_ = np.asarray([]) encoded_labels = preprocess_true_boxes(detections_, input_shape=self.model_img_size, anchors=self.anchors, num_classes=self.num_classes) encoded_labels[0][..., 4] = 1 encoded_labels[1][..., 4] = 1 encoded_labels[2][..., 4] = 1 return K.get_session().run(self.object_fabrication_gradient, feed_dict={ self.encoded_labels[0]: encoded_labels[0], self.encoded_labels[1]: encoded_labels[1], self.encoded_labels[2]: encoded_labels[2], self.model.input: x })