當前位置: 首頁>>代碼示例>>Python>>正文


Python losses_pb2.Loss方法代碼示例

本文整理匯總了Python中object_detection.protos.losses_pb2.Loss方法的典型用法代碼示例。如果您正苦於以下問題:Python losses_pb2.Loss方法的具體用法?Python losses_pb2.Loss怎麽用?Python losses_pb2.Loss使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在object_detection.protos.losses_pb2的用法示例。


在下文中一共展示了losses_pb2.Loss方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_build_weighted_l2_localization_loss

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_weighted_l2_localization_loss(self):
    losses_text_proto = """
      localization_loss {
        weighted_l2 {
        }
      }
      classification_loss {
        weighted_softmax {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    _, localization_loss, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(localization_loss,
                               losses.WeightedL2LocalizationLoss)) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:18,代碼來源:losses_builder_test.py

示例2: test_build_weighted_smooth_l1_localization_loss

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_weighted_smooth_l1_localization_loss(self):
    losses_text_proto = """
      localization_loss {
        weighted_smooth_l1 {
        }
      }
      classification_loss {
        weighted_softmax {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    _, localization_loss, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(localization_loss,
                               losses.WeightedSmoothL1LocalizationLoss)) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:18,代碼來源:losses_builder_test.py

示例3: test_anchorwise_output

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_anchorwise_output(self):
    losses_text_proto = """
      localization_loss {
        weighted_smooth_l1 {
          anchorwise_output: true
        }
      }
      classification_loss {
        weighted_softmax {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    _, localization_loss, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(localization_loss,
                               losses.WeightedSmoothL1LocalizationLoss))
    predictions = tf.constant([[[0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0]]])
    targets = tf.constant([[[0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0]]])
    weights = tf.constant([[1.0, 1.0]])
    loss = localization_loss(predictions, targets, weights=weights)
    self.assertEqual(loss.shape, [1, 2]) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:24,代碼來源:losses_builder_test.py

示例4: test_build_weighted_sigmoid_classification_loss

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_weighted_sigmoid_classification_loss(self):
    losses_text_proto = """
      classification_loss {
        weighted_sigmoid {
        }
      }
      localization_loss {
        weighted_l2 {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    classification_loss, _, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(classification_loss,
                               losses.WeightedSigmoidClassificationLoss)) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:18,代碼來源:losses_builder_test.py

示例5: test_build_weighted_softmax_classification_loss

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_weighted_softmax_classification_loss(self):
    losses_text_proto = """
      classification_loss {
        weighted_softmax {
        }
      }
      localization_loss {
        weighted_l2 {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    classification_loss, _, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(classification_loss,
                               losses.WeightedSoftmaxClassificationLoss)) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:18,代碼來源:losses_builder_test.py

示例6: test_build_bootstrapped_sigmoid_classification_loss

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_bootstrapped_sigmoid_classification_loss(self):
    losses_text_proto = """
      classification_loss {
        bootstrapped_sigmoid {
          alpha: 0.5
        }
      }
      localization_loss {
        weighted_l2 {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    classification_loss, _, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(classification_loss,
                               losses.BootstrappedSigmoidClassificationLoss)) 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:19,代碼來源:losses_builder_test.py

示例7: test_build_hard_example_miner_for_classification_loss

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_hard_example_miner_for_classification_loss(self):
    losses_text_proto = """
      localization_loss {
        weighted_l2 {
        }
      }
      classification_loss {
        weighted_softmax {
        }
      }
      hard_example_miner {
        loss_type: CLASSIFICATION
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    _, _, _, _, hard_example_miner = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(hard_example_miner, losses.HardExampleMiner))
    self.assertEqual(hard_example_miner._loss_type, 'cls') 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:21,代碼來源:losses_builder_test.py

示例8: test_build_hard_example_miner_for_localization_loss

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_hard_example_miner_for_localization_loss(self):
    losses_text_proto = """
      localization_loss {
        weighted_l2 {
        }
      }
      classification_loss {
        weighted_softmax {
        }
      }
      hard_example_miner {
        loss_type: LOCALIZATION
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    _, _, _, _, hard_example_miner = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(hard_example_miner, losses.HardExampleMiner))
    self.assertEqual(hard_example_miner._loss_type, 'loc') 
開發者ID:ringringyi,項目名稱:DOTA_models,代碼行數:21,代碼來源:losses_builder_test.py

示例9: test_build_weighted_l2_localization_loss

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_weighted_l2_localization_loss(self):
    losses_text_proto = """
      localization_loss {
        weighted_l2 {
        }
      }
      classification_loss {
        weighted_softmax {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    _, localization_loss, _, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(localization_loss,
                               losses.WeightedL2LocalizationLoss)) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:18,代碼來源:losses_builder_test.py

示例10: test_build_weighted_smooth_l1_localization_loss_non_default_delta

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_weighted_smooth_l1_localization_loss_non_default_delta(self):
    losses_text_proto = """
      localization_loss {
        weighted_smooth_l1 {
          delta: 0.1
        }
      }
      classification_loss {
        weighted_softmax {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    _, localization_loss, _, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(localization_loss,
                               losses.WeightedSmoothL1LocalizationLoss))
    self.assertAlmostEqual(localization_loss._delta, 0.1) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:20,代碼來源:losses_builder_test.py

示例11: test_build_weighted_iou_localization_loss

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_weighted_iou_localization_loss(self):
    losses_text_proto = """
      localization_loss {
        weighted_iou {
        }
      }
      classification_loss {
        weighted_softmax {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    _, localization_loss, _, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(localization_loss,
                               losses.WeightedIOULocalizationLoss)) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:18,代碼來源:losses_builder_test.py

示例12: test_anchorwise_output

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_anchorwise_output(self):
    losses_text_proto = """
      localization_loss {
        weighted_smooth_l1 {
        }
      }
      classification_loss {
        weighted_softmax {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    _, localization_loss, _, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(localization_loss,
                               losses.WeightedSmoothL1LocalizationLoss))
    predictions = tf.constant([[[0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0]]])
    targets = tf.constant([[[0.0, 0.0, 1.0, 1.0], [0.0, 0.0, 1.0, 1.0]]])
    weights = tf.constant([[1.0, 1.0]])
    loss = localization_loss(predictions, targets, weights=weights)
    self.assertEqual(loss.shape, [1, 2]) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:23,代碼來源:losses_builder_test.py

示例13: test_build_weighted_sigmoid_classification_loss

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_weighted_sigmoid_classification_loss(self):
    losses_text_proto = """
      classification_loss {
        weighted_sigmoid {
        }
      }
      localization_loss {
        weighted_l2 {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    classification_loss, _, _, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(classification_loss,
                               losses.WeightedSigmoidClassificationLoss)) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:18,代碼來源:losses_builder_test.py

示例14: test_build_weighted_sigmoid_focal_loss_non_default

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_weighted_sigmoid_focal_loss_non_default(self):
    losses_text_proto = """
      classification_loss {
        weighted_sigmoid_focal {
          alpha: 0.25
          gamma: 3.0
        }
      }
      localization_loss {
        weighted_l2 {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    classification_loss, _, _, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(classification_loss,
                               losses.SigmoidFocalClassificationLoss))
    self.assertAlmostEqual(classification_loss._alpha, 0.25)
    self.assertAlmostEqual(classification_loss._gamma, 3.0) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:22,代碼來源:losses_builder_test.py

示例15: test_build_weighted_softmax_classification_loss

# 需要導入模塊: from object_detection.protos import losses_pb2 [as 別名]
# 或者: from object_detection.protos.losses_pb2 import Loss [as 別名]
def test_build_weighted_softmax_classification_loss(self):
    losses_text_proto = """
      classification_loss {
        weighted_softmax {
        }
      }
      localization_loss {
        weighted_l2 {
        }
      }
    """
    losses_proto = losses_pb2.Loss()
    text_format.Merge(losses_text_proto, losses_proto)
    classification_loss, _, _, _, _, _ = losses_builder.build(losses_proto)
    self.assertTrue(isinstance(classification_loss,
                               losses.WeightedSoftmaxClassificationLoss)) 
開發者ID:ahmetozlu,項目名稱:vehicle_counting_tensorflow,代碼行數:18,代碼來源:losses_builder_test.py


注:本文中的object_detection.protos.losses_pb2.Loss方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。