// Generated by the protocol buffer compiler.  DO NOT EDIT!
// source: object_detection/protos/region_similarity_calculator.proto

#include "object_detection/protos/region_similarity_calculator.pb.h"

#include <algorithm>

#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/extension_set.h>
#include <google/protobuf/wire_format_lite.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>

PROTOBUF_PRAGMA_INIT_SEG

namespace _pb = ::PROTOBUF_NAMESPACE_ID;
namespace _pbi = _pb::internal;

namespace object_detection {
namespace protos {
PROTOBUF_CONSTEXPR RegionSimilarityCalculator::RegionSimilarityCalculator(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_.region_similarity_)*/{}
  , /*decltype(_impl_._cached_size_)*/{}
  , /*decltype(_impl_._oneof_case_)*/{}} {}
struct RegionSimilarityCalculatorDefaultTypeInternal {
  PROTOBUF_CONSTEXPR RegionSimilarityCalculatorDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~RegionSimilarityCalculatorDefaultTypeInternal() {}
  union {
    RegionSimilarityCalculator _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 RegionSimilarityCalculatorDefaultTypeInternal _RegionSimilarityCalculator_default_instance_;
PROTOBUF_CONSTEXPR NegSqDistSimilarity::NegSqDistSimilarity(
    ::_pbi::ConstantInitialized) {}
struct NegSqDistSimilarityDefaultTypeInternal {
  PROTOBUF_CONSTEXPR NegSqDistSimilarityDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~NegSqDistSimilarityDefaultTypeInternal() {}
  union {
    NegSqDistSimilarity _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 NegSqDistSimilarityDefaultTypeInternal _NegSqDistSimilarity_default_instance_;
PROTOBUF_CONSTEXPR IouSimilarity::IouSimilarity(
    ::_pbi::ConstantInitialized) {}
struct IouSimilarityDefaultTypeInternal {
  PROTOBUF_CONSTEXPR IouSimilarityDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~IouSimilarityDefaultTypeInternal() {}
  union {
    IouSimilarity _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 IouSimilarityDefaultTypeInternal _IouSimilarity_default_instance_;
PROTOBUF_CONSTEXPR IoaSimilarity::IoaSimilarity(
    ::_pbi::ConstantInitialized) {}
struct IoaSimilarityDefaultTypeInternal {
  PROTOBUF_CONSTEXPR IoaSimilarityDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~IoaSimilarityDefaultTypeInternal() {}
  union {
    IoaSimilarity _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 IoaSimilarityDefaultTypeInternal _IoaSimilarity_default_instance_;
PROTOBUF_CONSTEXPR ThresholdedIouSimilarity::ThresholdedIouSimilarity(
    ::_pbi::ConstantInitialized): _impl_{
    /*decltype(_impl_._has_bits_)*/{}
  , /*decltype(_impl_._cached_size_)*/{}
  , /*decltype(_impl_.iou_threshold_)*/0.5f} {}
struct ThresholdedIouSimilarityDefaultTypeInternal {
  PROTOBUF_CONSTEXPR ThresholdedIouSimilarityDefaultTypeInternal()
      : _instance(::_pbi::ConstantInitialized{}) {}
  ~ThresholdedIouSimilarityDefaultTypeInternal() {}
  union {
    ThresholdedIouSimilarity _instance;
  };
};
PROTOBUF_ATTRIBUTE_NO_DESTROY PROTOBUF_CONSTINIT PROTOBUF_ATTRIBUTE_INIT_PRIORITY1 ThresholdedIouSimilarityDefaultTypeInternal _ThresholdedIouSimilarity_default_instance_;
}  // namespace protos
}  // namespace object_detection
static ::_pb::Metadata file_level_metadata_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto[5];
static constexpr ::_pb::EnumDescriptor const** file_level_enum_descriptors_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto = nullptr;
static constexpr ::_pb::ServiceDescriptor const** file_level_service_descriptors_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto = nullptr;

const uint32_t TableStruct_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto::offsets[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::RegionSimilarityCalculator, _internal_metadata_),
  ~0u,  // no _extensions_
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::RegionSimilarityCalculator, _impl_._oneof_case_[0]),
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  ::_pbi::kInvalidFieldOffsetTag,
  ::_pbi::kInvalidFieldOffsetTag,
  ::_pbi::kInvalidFieldOffsetTag,
  ::_pbi::kInvalidFieldOffsetTag,
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::RegionSimilarityCalculator, _impl_.region_similarity_),
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::NegSqDistSimilarity, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::IouSimilarity, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  ~0u,  // no _has_bits_
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::IoaSimilarity, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::ThresholdedIouSimilarity, _impl_._has_bits_),
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::ThresholdedIouSimilarity, _internal_metadata_),
  ~0u,  // no _extensions_
  ~0u,  // no _oneof_case_
  ~0u,  // no _weak_field_map_
  ~0u,  // no _inlined_string_donated_
  PROTOBUF_FIELD_OFFSET(::object_detection::protos::ThresholdedIouSimilarity, _impl_.iou_threshold_),
  0,
};
static const ::_pbi::MigrationSchema schemas[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) = {
  { 0, -1, -1, sizeof(::object_detection::protos::RegionSimilarityCalculator)},
  { 11, -1, -1, sizeof(::object_detection::protos::NegSqDistSimilarity)},
  { 17, -1, -1, sizeof(::object_detection::protos::IouSimilarity)},
  { 23, -1, -1, sizeof(::object_detection::protos::IoaSimilarity)},
  { 29, 36, -1, sizeof(::object_detection::protos::ThresholdedIouSimilarity)},
};

static const ::_pb::Message* const file_default_instances[] = {
  &::object_detection::protos::_RegionSimilarityCalculator_default_instance_._instance,
  &::object_detection::protos::_NegSqDistSimilarity_default_instance_._instance,
  &::object_detection::protos::_IouSimilarity_default_instance_._instance,
  &::object_detection::protos::_IoaSimilarity_default_instance_._instance,
  &::object_detection::protos::_ThresholdedIouSimilarity_default_instance_._instance,
};

const char descriptor_table_protodef_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto[] PROTOBUF_SECTION_VARIABLE(protodesc_cold) =
  "\n:object_detection/protos/region_similar"
  "ity_calculator.proto\022\027object_detection.p"
  "rotos\"\336\002\n\032RegionSimilarityCalculator\022N\n\026"
  "neg_sq_dist_similarity\030\001 \001(\0132,.object_de"
  "tection.protos.NegSqDistSimilarityH\000\022@\n\016"
  "iou_similarity\030\002 \001(\0132&.object_detection."
  "protos.IouSimilarityH\000\022@\n\016ioa_similarity"
  "\030\003 \001(\0132&.object_detection.protos.IoaSimi"
  "larityH\000\022W\n\032thresholded_iou_similarity\030\004"
  " \001(\01321.object_detection.protos.Threshold"
  "edIouSimilarityH\000B\023\n\021region_similarity\"\025"
  "\n\023NegSqDistSimilarity\"\017\n\rIouSimilarity\"\017"
  "\n\rIoaSimilarity\"6\n\030ThresholdedIouSimilar"
  "ity\022\032\n\riou_threshold\030\001 \001(\002:\0030.5"
  ;
static ::_pbi::once_flag descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_once;
const ::_pbi::DescriptorTable descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto = {
    false, false, 551, descriptor_table_protodef_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto,
    "object_detection/protos/region_similarity_calculator.proto",
    &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_once, nullptr, 0, 5,
    schemas, file_default_instances, TableStruct_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto::offsets,
    file_level_metadata_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto, file_level_enum_descriptors_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto,
    file_level_service_descriptors_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto,
};
PROTOBUF_ATTRIBUTE_WEAK const ::_pbi::DescriptorTable* descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_getter() {
  return &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto;
}

// Force running AddDescriptors() at dynamic initialization time.
PROTOBUF_ATTRIBUTE_INIT_PRIORITY2 static ::_pbi::AddDescriptorsRunner dynamic_init_dummy_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto(&descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto);
namespace object_detection {
namespace protos {

// ===================================================================

class RegionSimilarityCalculator::_Internal {
 public:
  static const ::object_detection::protos::NegSqDistSimilarity& neg_sq_dist_similarity(const RegionSimilarityCalculator* msg);
  static const ::object_detection::protos::IouSimilarity& iou_similarity(const RegionSimilarityCalculator* msg);
  static const ::object_detection::protos::IoaSimilarity& ioa_similarity(const RegionSimilarityCalculator* msg);
  static const ::object_detection::protos::ThresholdedIouSimilarity& thresholded_iou_similarity(const RegionSimilarityCalculator* msg);
};

const ::object_detection::protos::NegSqDistSimilarity&
RegionSimilarityCalculator::_Internal::neg_sq_dist_similarity(const RegionSimilarityCalculator* msg) {
  return *msg->_impl_.region_similarity_.neg_sq_dist_similarity_;
}
const ::object_detection::protos::IouSimilarity&
RegionSimilarityCalculator::_Internal::iou_similarity(const RegionSimilarityCalculator* msg) {
  return *msg->_impl_.region_similarity_.iou_similarity_;
}
const ::object_detection::protos::IoaSimilarity&
RegionSimilarityCalculator::_Internal::ioa_similarity(const RegionSimilarityCalculator* msg) {
  return *msg->_impl_.region_similarity_.ioa_similarity_;
}
const ::object_detection::protos::ThresholdedIouSimilarity&
RegionSimilarityCalculator::_Internal::thresholded_iou_similarity(const RegionSimilarityCalculator* msg) {
  return *msg->_impl_.region_similarity_.thresholded_iou_similarity_;
}
void RegionSimilarityCalculator::set_allocated_neg_sq_dist_similarity(::object_detection::protos::NegSqDistSimilarity* neg_sq_dist_similarity) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_region_similarity();
  if (neg_sq_dist_similarity) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(neg_sq_dist_similarity);
    if (message_arena != submessage_arena) {
      neg_sq_dist_similarity = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, neg_sq_dist_similarity, submessage_arena);
    }
    set_has_neg_sq_dist_similarity();
    _impl_.region_similarity_.neg_sq_dist_similarity_ = neg_sq_dist_similarity;
  }
  // @@protoc_insertion_point(field_set_allocated:object_detection.protos.RegionSimilarityCalculator.neg_sq_dist_similarity)
}
void RegionSimilarityCalculator::set_allocated_iou_similarity(::object_detection::protos::IouSimilarity* iou_similarity) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_region_similarity();
  if (iou_similarity) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(iou_similarity);
    if (message_arena != submessage_arena) {
      iou_similarity = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, iou_similarity, submessage_arena);
    }
    set_has_iou_similarity();
    _impl_.region_similarity_.iou_similarity_ = iou_similarity;
  }
  // @@protoc_insertion_point(field_set_allocated:object_detection.protos.RegionSimilarityCalculator.iou_similarity)
}
void RegionSimilarityCalculator::set_allocated_ioa_similarity(::object_detection::protos::IoaSimilarity* ioa_similarity) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_region_similarity();
  if (ioa_similarity) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(ioa_similarity);
    if (message_arena != submessage_arena) {
      ioa_similarity = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, ioa_similarity, submessage_arena);
    }
    set_has_ioa_similarity();
    _impl_.region_similarity_.ioa_similarity_ = ioa_similarity;
  }
  // @@protoc_insertion_point(field_set_allocated:object_detection.protos.RegionSimilarityCalculator.ioa_similarity)
}
void RegionSimilarityCalculator::set_allocated_thresholded_iou_similarity(::object_detection::protos::ThresholdedIouSimilarity* thresholded_iou_similarity) {
  ::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaForAllocation();
  clear_region_similarity();
  if (thresholded_iou_similarity) {
    ::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena =
      ::PROTOBUF_NAMESPACE_ID::Arena::InternalGetOwningArena(thresholded_iou_similarity);
    if (message_arena != submessage_arena) {
      thresholded_iou_similarity = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
          message_arena, thresholded_iou_similarity, submessage_arena);
    }
    set_has_thresholded_iou_similarity();
    _impl_.region_similarity_.thresholded_iou_similarity_ = thresholded_iou_similarity;
  }
  // @@protoc_insertion_point(field_set_allocated:object_detection.protos.RegionSimilarityCalculator.thresholded_iou_similarity)
}
RegionSimilarityCalculator::RegionSimilarityCalculator(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:object_detection.protos.RegionSimilarityCalculator)
}
RegionSimilarityCalculator::RegionSimilarityCalculator(const RegionSimilarityCalculator& from)
  : ::PROTOBUF_NAMESPACE_ID::Message() {
  RegionSimilarityCalculator* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_.region_similarity_){}
    , /*decltype(_impl_._cached_size_)*/{}
    , /*decltype(_impl_._oneof_case_)*/{}};

  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  clear_has_region_similarity();
  switch (from.region_similarity_case()) {
    case kNegSqDistSimilarity: {
      _this->_internal_mutable_neg_sq_dist_similarity()->::object_detection::protos::NegSqDistSimilarity::MergeFrom(
          from._internal_neg_sq_dist_similarity());
      break;
    }
    case kIouSimilarity: {
      _this->_internal_mutable_iou_similarity()->::object_detection::protos::IouSimilarity::MergeFrom(
          from._internal_iou_similarity());
      break;
    }
    case kIoaSimilarity: {
      _this->_internal_mutable_ioa_similarity()->::object_detection::protos::IoaSimilarity::MergeFrom(
          from._internal_ioa_similarity());
      break;
    }
    case kThresholdedIouSimilarity: {
      _this->_internal_mutable_thresholded_iou_similarity()->::object_detection::protos::ThresholdedIouSimilarity::MergeFrom(
          from._internal_thresholded_iou_similarity());
      break;
    }
    case REGION_SIMILARITY_NOT_SET: {
      break;
    }
  }
  // @@protoc_insertion_point(copy_constructor:object_detection.protos.RegionSimilarityCalculator)
}

inline void RegionSimilarityCalculator::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_.region_similarity_){}
    , /*decltype(_impl_._cached_size_)*/{}
    , /*decltype(_impl_._oneof_case_)*/{}
  };
  clear_has_region_similarity();
}

RegionSimilarityCalculator::~RegionSimilarityCalculator() {
  // @@protoc_insertion_point(destructor:object_detection.protos.RegionSimilarityCalculator)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void RegionSimilarityCalculator::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
  if (has_region_similarity()) {
    clear_region_similarity();
  }
}

void RegionSimilarityCalculator::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

void RegionSimilarityCalculator::clear_region_similarity() {
// @@protoc_insertion_point(one_of_clear_start:object_detection.protos.RegionSimilarityCalculator)
  switch (region_similarity_case()) {
    case kNegSqDistSimilarity: {
      if (GetArenaForAllocation() == nullptr) {
        delete _impl_.region_similarity_.neg_sq_dist_similarity_;
      }
      break;
    }
    case kIouSimilarity: {
      if (GetArenaForAllocation() == nullptr) {
        delete _impl_.region_similarity_.iou_similarity_;
      }
      break;
    }
    case kIoaSimilarity: {
      if (GetArenaForAllocation() == nullptr) {
        delete _impl_.region_similarity_.ioa_similarity_;
      }
      break;
    }
    case kThresholdedIouSimilarity: {
      if (GetArenaForAllocation() == nullptr) {
        delete _impl_.region_similarity_.thresholded_iou_similarity_;
      }
      break;
    }
    case REGION_SIMILARITY_NOT_SET: {
      break;
    }
  }
  _impl_._oneof_case_[0] = REGION_SIMILARITY_NOT_SET;
}


void RegionSimilarityCalculator::Clear() {
// @@protoc_insertion_point(message_clear_start:object_detection.protos.RegionSimilarityCalculator)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  clear_region_similarity();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* RegionSimilarityCalculator::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // .object_detection.protos.NegSqDistSimilarity neg_sq_dist_similarity = 1;
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 10)) {
          ptr = ctx->ParseMessage(_internal_mutable_neg_sq_dist_similarity(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .object_detection.protos.IouSimilarity iou_similarity = 2;
      case 2:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 18)) {
          ptr = ctx->ParseMessage(_internal_mutable_iou_similarity(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .object_detection.protos.IoaSimilarity ioa_similarity = 3;
      case 3:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 26)) {
          ptr = ctx->ParseMessage(_internal_mutable_ioa_similarity(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      // .object_detection.protos.ThresholdedIouSimilarity thresholded_iou_similarity = 4;
      case 4:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 34)) {
          ptr = ctx->ParseMessage(_internal_mutable_thresholded_iou_similarity(), ptr);
          CHK_(ptr);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* RegionSimilarityCalculator::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:object_detection.protos.RegionSimilarityCalculator)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  switch (region_similarity_case()) {
    case kNegSqDistSimilarity: {
      target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
        InternalWriteMessage(1, _Internal::neg_sq_dist_similarity(this),
          _Internal::neg_sq_dist_similarity(this).GetCachedSize(), target, stream);
      break;
    }
    case kIouSimilarity: {
      target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
        InternalWriteMessage(2, _Internal::iou_similarity(this),
          _Internal::iou_similarity(this).GetCachedSize(), target, stream);
      break;
    }
    case kIoaSimilarity: {
      target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
        InternalWriteMessage(3, _Internal::ioa_similarity(this),
          _Internal::ioa_similarity(this).GetCachedSize(), target, stream);
      break;
    }
    case kThresholdedIouSimilarity: {
      target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::
        InternalWriteMessage(4, _Internal::thresholded_iou_similarity(this),
          _Internal::thresholded_iou_similarity(this).GetCachedSize(), target, stream);
      break;
    }
    default: ;
  }
  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:object_detection.protos.RegionSimilarityCalculator)
  return target;
}

size_t RegionSimilarityCalculator::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:object_detection.protos.RegionSimilarityCalculator)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  switch (region_similarity_case()) {
    // .object_detection.protos.NegSqDistSimilarity neg_sq_dist_similarity = 1;
    case kNegSqDistSimilarity: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *_impl_.region_similarity_.neg_sq_dist_similarity_);
      break;
    }
    // .object_detection.protos.IouSimilarity iou_similarity = 2;
    case kIouSimilarity: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *_impl_.region_similarity_.iou_similarity_);
      break;
    }
    // .object_detection.protos.IoaSimilarity ioa_similarity = 3;
    case kIoaSimilarity: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *_impl_.region_similarity_.ioa_similarity_);
      break;
    }
    // .object_detection.protos.ThresholdedIouSimilarity thresholded_iou_similarity = 4;
    case kThresholdedIouSimilarity: {
      total_size += 1 +
        ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::MessageSize(
          *_impl_.region_similarity_.thresholded_iou_similarity_);
      break;
    }
    case REGION_SIMILARITY_NOT_SET: {
      break;
    }
  }
  return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}

const ::PROTOBUF_NAMESPACE_ID::Message::ClassData RegionSimilarityCalculator::_class_data_ = {
    ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
    RegionSimilarityCalculator::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*RegionSimilarityCalculator::GetClassData() const { return &_class_data_; }


void RegionSimilarityCalculator::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
  auto* const _this = static_cast<RegionSimilarityCalculator*>(&to_msg);
  auto& from = static_cast<const RegionSimilarityCalculator&>(from_msg);
  // @@protoc_insertion_point(class_specific_merge_from_start:object_detection.protos.RegionSimilarityCalculator)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  switch (from.region_similarity_case()) {
    case kNegSqDistSimilarity: {
      _this->_internal_mutable_neg_sq_dist_similarity()->::object_detection::protos::NegSqDistSimilarity::MergeFrom(
          from._internal_neg_sq_dist_similarity());
      break;
    }
    case kIouSimilarity: {
      _this->_internal_mutable_iou_similarity()->::object_detection::protos::IouSimilarity::MergeFrom(
          from._internal_iou_similarity());
      break;
    }
    case kIoaSimilarity: {
      _this->_internal_mutable_ioa_similarity()->::object_detection::protos::IoaSimilarity::MergeFrom(
          from._internal_ioa_similarity());
      break;
    }
    case kThresholdedIouSimilarity: {
      _this->_internal_mutable_thresholded_iou_similarity()->::object_detection::protos::ThresholdedIouSimilarity::MergeFrom(
          from._internal_thresholded_iou_similarity());
      break;
    }
    case REGION_SIMILARITY_NOT_SET: {
      break;
    }
  }
  _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

void RegionSimilarityCalculator::CopyFrom(const RegionSimilarityCalculator& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:object_detection.protos.RegionSimilarityCalculator)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool RegionSimilarityCalculator::IsInitialized() const {
  return true;
}

void RegionSimilarityCalculator::InternalSwap(RegionSimilarityCalculator* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_impl_.region_similarity_, other->_impl_.region_similarity_);
  swap(_impl_._oneof_case_[0], other->_impl_._oneof_case_[0]);
}

::PROTOBUF_NAMESPACE_ID::Metadata RegionSimilarityCalculator::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_getter, &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_once,
      file_level_metadata_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto[0]);
}

// ===================================================================

class NegSqDistSimilarity::_Internal {
 public:
};

NegSqDistSimilarity::NegSqDistSimilarity(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase(arena, is_message_owned) {
  // @@protoc_insertion_point(arena_constructor:object_detection.protos.NegSqDistSimilarity)
}
NegSqDistSimilarity::NegSqDistSimilarity(const NegSqDistSimilarity& from)
  : ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase() {
  NegSqDistSimilarity* const _this = this; (void)_this;
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:object_detection.protos.NegSqDistSimilarity)
}





const ::PROTOBUF_NAMESPACE_ID::Message::ClassData NegSqDistSimilarity::_class_data_ = {
    ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyImpl,
    ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl,
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*NegSqDistSimilarity::GetClassData() const { return &_class_data_; }







::PROTOBUF_NAMESPACE_ID::Metadata NegSqDistSimilarity::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_getter, &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_once,
      file_level_metadata_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto[1]);
}

// ===================================================================

class IouSimilarity::_Internal {
 public:
};

IouSimilarity::IouSimilarity(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase(arena, is_message_owned) {
  // @@protoc_insertion_point(arena_constructor:object_detection.protos.IouSimilarity)
}
IouSimilarity::IouSimilarity(const IouSimilarity& from)
  : ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase() {
  IouSimilarity* const _this = this; (void)_this;
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:object_detection.protos.IouSimilarity)
}





const ::PROTOBUF_NAMESPACE_ID::Message::ClassData IouSimilarity::_class_data_ = {
    ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyImpl,
    ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl,
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*IouSimilarity::GetClassData() const { return &_class_data_; }







::PROTOBUF_NAMESPACE_ID::Metadata IouSimilarity::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_getter, &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_once,
      file_level_metadata_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto[2]);
}

// ===================================================================

class IoaSimilarity::_Internal {
 public:
};

IoaSimilarity::IoaSimilarity(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase(arena, is_message_owned) {
  // @@protoc_insertion_point(arena_constructor:object_detection.protos.IoaSimilarity)
}
IoaSimilarity::IoaSimilarity(const IoaSimilarity& from)
  : ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase() {
  IoaSimilarity* const _this = this; (void)_this;
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  // @@protoc_insertion_point(copy_constructor:object_detection.protos.IoaSimilarity)
}





const ::PROTOBUF_NAMESPACE_ID::Message::ClassData IoaSimilarity::_class_data_ = {
    ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::CopyImpl,
    ::PROTOBUF_NAMESPACE_ID::internal::ZeroFieldsBase::MergeImpl,
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*IoaSimilarity::GetClassData() const { return &_class_data_; }







::PROTOBUF_NAMESPACE_ID::Metadata IoaSimilarity::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_getter, &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_once,
      file_level_metadata_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto[3]);
}

// ===================================================================

class ThresholdedIouSimilarity::_Internal {
 public:
  using HasBits = decltype(std::declval<ThresholdedIouSimilarity>()._impl_._has_bits_);
  static void set_has_iou_threshold(HasBits* has_bits) {
    (*has_bits)[0] |= 1u;
  }
};

ThresholdedIouSimilarity::ThresholdedIouSimilarity(::PROTOBUF_NAMESPACE_ID::Arena* arena,
                         bool is_message_owned)
  : ::PROTOBUF_NAMESPACE_ID::Message(arena, is_message_owned) {
  SharedCtor(arena, is_message_owned);
  // @@protoc_insertion_point(arena_constructor:object_detection.protos.ThresholdedIouSimilarity)
}
ThresholdedIouSimilarity::ThresholdedIouSimilarity(const ThresholdedIouSimilarity& from)
  : ::PROTOBUF_NAMESPACE_ID::Message() {
  ThresholdedIouSimilarity* const _this = this; (void)_this;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){from._impl_._has_bits_}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.iou_threshold_){}};

  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  _this->_impl_.iou_threshold_ = from._impl_.iou_threshold_;
  // @@protoc_insertion_point(copy_constructor:object_detection.protos.ThresholdedIouSimilarity)
}

inline void ThresholdedIouSimilarity::SharedCtor(
    ::_pb::Arena* arena, bool is_message_owned) {
  (void)arena;
  (void)is_message_owned;
  new (&_impl_) Impl_{
      decltype(_impl_._has_bits_){}
    , /*decltype(_impl_._cached_size_)*/{}
    , decltype(_impl_.iou_threshold_){0.5f}
  };
}

ThresholdedIouSimilarity::~ThresholdedIouSimilarity() {
  // @@protoc_insertion_point(destructor:object_detection.protos.ThresholdedIouSimilarity)
  if (auto *arena = _internal_metadata_.DeleteReturnArena<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>()) {
  (void)arena;
    return;
  }
  SharedDtor();
}

inline void ThresholdedIouSimilarity::SharedDtor() {
  GOOGLE_DCHECK(GetArenaForAllocation() == nullptr);
}

void ThresholdedIouSimilarity::SetCachedSize(int size) const {
  _impl_._cached_size_.Set(size);
}

void ThresholdedIouSimilarity::Clear() {
// @@protoc_insertion_point(message_clear_start:object_detection.protos.ThresholdedIouSimilarity)
  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  _impl_.iou_threshold_ = 0.5f;
  _impl_._has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

const char* ThresholdedIouSimilarity::_InternalParse(const char* ptr, ::_pbi::ParseContext* ctx) {
#define CHK_(x) if (PROTOBUF_PREDICT_FALSE(!(x))) goto failure
  _Internal::HasBits has_bits{};
  while (!ctx->Done(&ptr)) {
    uint32_t tag;
    ptr = ::_pbi::ReadTag(ptr, &tag);
    switch (tag >> 3) {
      // optional float iou_threshold = 1 [default = 0.5];
      case 1:
        if (PROTOBUF_PREDICT_TRUE(static_cast<uint8_t>(tag) == 13)) {
          _Internal::set_has_iou_threshold(&has_bits);
          _impl_.iou_threshold_ = ::PROTOBUF_NAMESPACE_ID::internal::UnalignedLoad<float>(ptr);
          ptr += sizeof(float);
        } else
          goto handle_unusual;
        continue;
      default:
        goto handle_unusual;
    }  // switch
  handle_unusual:
    if ((tag == 0) || ((tag & 7) == 4)) {
      CHK_(ptr);
      ctx->SetLastTag(tag);
      goto message_done;
    }
    ptr = UnknownFieldParse(
        tag,
        _internal_metadata_.mutable_unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(),
        ptr, ctx);
    CHK_(ptr != nullptr);
  }  // while
message_done:
  _impl_._has_bits_.Or(has_bits);
  return ptr;
failure:
  ptr = nullptr;
  goto message_done;
#undef CHK_
}

uint8_t* ThresholdedIouSimilarity::_InternalSerialize(
    uint8_t* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:object_detection.protos.ThresholdedIouSimilarity)
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _impl_._has_bits_[0];
  // optional float iou_threshold = 1 [default = 0.5];
  if (cached_has_bits & 0x00000001u) {
    target = stream->EnsureSpace(target);
    target = ::_pbi::WireFormatLite::WriteFloatToArray(1, this->_internal_iou_threshold(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::_pbi::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:object_detection.protos.ThresholdedIouSimilarity)
  return target;
}

size_t ThresholdedIouSimilarity::ByteSizeLong() const {
// @@protoc_insertion_point(message_byte_size_start:object_detection.protos.ThresholdedIouSimilarity)
  size_t total_size = 0;

  uint32_t cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  // optional float iou_threshold = 1 [default = 0.5];
  cached_has_bits = _impl_._has_bits_[0];
  if (cached_has_bits & 0x00000001u) {
    total_size += 1 + 4;
  }

  return MaybeComputeUnknownFieldsSize(total_size, &_impl_._cached_size_);
}

const ::PROTOBUF_NAMESPACE_ID::Message::ClassData ThresholdedIouSimilarity::_class_data_ = {
    ::PROTOBUF_NAMESPACE_ID::Message::CopyWithSourceCheck,
    ThresholdedIouSimilarity::MergeImpl
};
const ::PROTOBUF_NAMESPACE_ID::Message::ClassData*ThresholdedIouSimilarity::GetClassData() const { return &_class_data_; }


void ThresholdedIouSimilarity::MergeImpl(::PROTOBUF_NAMESPACE_ID::Message& to_msg, const ::PROTOBUF_NAMESPACE_ID::Message& from_msg) {
  auto* const _this = static_cast<ThresholdedIouSimilarity*>(&to_msg);
  auto& from = static_cast<const ThresholdedIouSimilarity&>(from_msg);
  // @@protoc_insertion_point(class_specific_merge_from_start:object_detection.protos.ThresholdedIouSimilarity)
  GOOGLE_DCHECK_NE(&from, _this);
  uint32_t cached_has_bits = 0;
  (void) cached_has_bits;

  if (from._internal_has_iou_threshold()) {
    _this->_internal_set_iou_threshold(from._internal_iou_threshold());
  }
  _this->_internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
}

void ThresholdedIouSimilarity::CopyFrom(const ThresholdedIouSimilarity& from) {
// @@protoc_insertion_point(class_specific_copy_from_start:object_detection.protos.ThresholdedIouSimilarity)
  if (&from == this) return;
  Clear();
  MergeFrom(from);
}

bool ThresholdedIouSimilarity::IsInitialized() const {
  return true;
}

void ThresholdedIouSimilarity::InternalSwap(ThresholdedIouSimilarity* other) {
  using std::swap;
  _internal_metadata_.InternalSwap(&other->_internal_metadata_);
  swap(_impl_._has_bits_[0], other->_impl_._has_bits_[0]);
  swap(_impl_.iou_threshold_, other->_impl_.iou_threshold_);
}

::PROTOBUF_NAMESPACE_ID::Metadata ThresholdedIouSimilarity::GetMetadata() const {
  return ::_pbi::AssignDescriptors(
      &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_getter, &descriptor_table_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto_once,
      file_level_metadata_object_5fdetection_2fprotos_2fregion_5fsimilarity_5fcalculator_2eproto[4]);
}

// @@protoc_insertion_point(namespace_scope)
}  // namespace protos
}  // namespace object_detection
PROTOBUF_NAMESPACE_OPEN
template<> PROTOBUF_NOINLINE ::object_detection::protos::RegionSimilarityCalculator*
Arena::CreateMaybeMessage< ::object_detection::protos::RegionSimilarityCalculator >(Arena* arena) {
  return Arena::CreateMessageInternal< ::object_detection::protos::RegionSimilarityCalculator >(arena);
}
template<> PROTOBUF_NOINLINE ::object_detection::protos::NegSqDistSimilarity*
Arena::CreateMaybeMessage< ::object_detection::protos::NegSqDistSimilarity >(Arena* arena) {
  return Arena::CreateMessageInternal< ::object_detection::protos::NegSqDistSimilarity >(arena);
}
template<> PROTOBUF_NOINLINE ::object_detection::protos::IouSimilarity*
Arena::CreateMaybeMessage< ::object_detection::protos::IouSimilarity >(Arena* arena) {
  return Arena::CreateMessageInternal< ::object_detection::protos::IouSimilarity >(arena);
}
template<> PROTOBUF_NOINLINE ::object_detection::protos::IoaSimilarity*
Arena::CreateMaybeMessage< ::object_detection::protos::IoaSimilarity >(Arena* arena) {
  return Arena::CreateMessageInternal< ::object_detection::protos::IoaSimilarity >(arena);
}
template<> PROTOBUF_NOINLINE ::object_detection::protos::ThresholdedIouSimilarity*
Arena::CreateMaybeMessage< ::object_detection::protos::ThresholdedIouSimilarity >(Arena* arena) {
  return Arena::CreateMessageInternal< ::object_detection::protos::ThresholdedIouSimilarity >(arena);
}
PROTOBUF_NAMESPACE_CLOSE

// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
