"examples/vscode:/vscode.git/clone" did not exist on "e573ae06e2bf5aa632d9d78ce3c4c1374741287d"
Commit 8ab3e7a0 authored by Menglong Zhu's avatar Menglong Zhu Committed by dreamdragon
Browse files

Add a second expected_loss_weights function using an alternative expectation...

Add a second expected_loss_weights function using an alternative expectation calculation compared to previous. Integrate this op into ssd_meta_arch and losses builder. Affects files that use losses_builder.build to handle the returning of an additional element.

PiperOrigin-RevId: 219190083
parent 77b2556e
...@@ -33,7 +33,7 @@ from lstm_object_detection import evaluator ...@@ -33,7 +33,7 @@ from lstm_object_detection import evaluator
from lstm_object_detection import model_builder from lstm_object_detection import model_builder
from lstm_object_detection import seq_dataset_builder from lstm_object_detection import seq_dataset_builder
from lstm_object_detection.utils import config_util from lstm_object_detection.utils import config_util
from google3.third_party.tensorflow_models.object_detection.utils import label_map_util from object_detection.utils import label_map_util
tf.logging.set_verbosity(tf.logging.INFO) tf.logging.set_verbosity(tf.logging.INFO)
flags = tf.app.flags flags = tf.app.flags
......
...@@ -23,11 +23,11 @@ DetectionModel. ...@@ -23,11 +23,11 @@ DetectionModel.
import logging import logging
import tensorflow as tf import tensorflow as tf
from lstm_object_detection.metrics import coco_evaluation_all_frames from lstm_object_detection.metrics import coco_evaluation_all_frames
from google3.third_party.tensorflow_models.object_detection import eval_util from object_detection import eval_util
from google3.third_party.tensorflow_models.object_detection.core import prefetcher from object_detection.core import prefetcher
from google3.third_party.tensorflow_models.object_detection.core import standard_fields as fields from object_detection.core import standard_fields as fields
from google3.third_party.tensorflow_models.object_detection.metrics import coco_evaluation from object_detection.metrics import coco_evaluation
from google3.third_party.tensorflow_models.object_detection.utils import object_detection_evaluation from object_detection.utils import object_detection_evaluation
# A dictionary of metric names to classes that implement the metric. The classes # A dictionary of metric names to classes that implement the metric. The classes
......
...@@ -23,11 +23,11 @@ See https://arxiv.org/abs/1711.06368 for details. ...@@ -23,11 +23,11 @@ See https://arxiv.org/abs/1711.06368 for details.
import re import re
import tensorflow as tf import tensorflow as tf
from google3.third_party.tensorflow_models.object_detection.core import box_list_ops from object_detection.core import box_list_ops
from google3.third_party.tensorflow_models.object_detection.core import standard_fields as fields from object_detection.core import standard_fields as fields
from google3.third_party.tensorflow_models.object_detection.meta_architectures import ssd_meta_arch from object_detection.meta_architectures import ssd_meta_arch
from google3.third_party.tensorflow_models.object_detection.utils import ops from object_detection.utils import ops
from google3.third_party.tensorflow_models.object_detection.utils import shape_utils from object_detection.utils import shape_utils
slim = tf.contrib.slim slim = tf.contrib.slim
......
...@@ -17,9 +17,9 @@ ...@@ -17,9 +17,9 @@
import tensorflow as tf import tensorflow as tf
from google3.third_party.tensorflow_models.object_detection.core import standard_fields from object_detection.core import standard_fields
from google3.third_party.tensorflow_models.object_detection.metrics import coco_evaluation from object_detection.metrics import coco_evaluation
from google3.third_party.tensorflow_models.object_detection.metrics import coco_tools from object_detection.metrics import coco_tools
class CocoEvaluationAllFrames(coco_evaluation.CocoDetectionEvaluator): class CocoEvaluationAllFrames(coco_evaluation.CocoDetectionEvaluator):
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
import numpy as np import numpy as np
import tensorflow as tf import tensorflow as tf
from lstm_object_detection.metrics import coco_evaluation_all_frames from lstm_object_detection.metrics import coco_evaluation_all_frames
from google3.third_party.tensorflow_models.object_detection.core import standard_fields from object_detection.core import standard_fields
class CocoEvaluationAllFramesTest(tf.test.TestCase): class CocoEvaluationAllFramesTest(tf.test.TestCase):
......
...@@ -16,17 +16,17 @@ ...@@ -16,17 +16,17 @@
"""A function to build a DetectionModel from configuration.""" """A function to build a DetectionModel from configuration."""
from lstm_object_detection.lstm import lstm_meta_arch from lstm_object_detection.lstm import lstm_meta_arch
from lstm_object_detection.models.lstm_ssd_mobilenet_v1_feature_extractor import LSTMMobileNetV1FeatureExtractor from lstm_object_detection.models.lstm_ssd_mobilenet_v1_feature_extractor import LSTMMobileNetV1FeatureExtractor
from google3.third_party.tensorflow_models.object_detection.builders import anchor_generator_builder from object_detection.builders import anchor_generator_builder
from google3.third_party.tensorflow_models.object_detection.builders import box_coder_builder from object_detection.builders import box_coder_builder
from google3.third_party.tensorflow_models.object_detection.builders import box_predictor_builder from object_detection.builders import box_predictor_builder
from google3.third_party.tensorflow_models.object_detection.builders import hyperparams_builder from object_detection.builders import hyperparams_builder
from google3.third_party.tensorflow_models.object_detection.builders import image_resizer_builder from object_detection.builders import image_resizer_builder
from google3.third_party.tensorflow_models.object_detection.builders import losses_builder from object_detection.builders import losses_builder
from google3.third_party.tensorflow_models.object_detection.builders import matcher_builder from object_detection.builders import matcher_builder
from google3.third_party.tensorflow_models.object_detection.builders import model_builder from object_detection.builders import model_builder
from google3.third_party.tensorflow_models.object_detection.builders import post_processing_builder from object_detection.builders import post_processing_builder
from google3.third_party.tensorflow_models.object_detection.builders import region_similarity_calculator_builder as sim_calc from object_detection.builders import region_similarity_calculator_builder as sim_calc
from google3.third_party.tensorflow_models.object_detection.core import target_assigner from object_detection.core import target_assigner
model_builder.SSD_FEATURE_EXTRACTOR_CLASS_MAP.update({ model_builder.SSD_FEATURE_EXTRACTOR_CLASS_MAP.update({
'lstm_mobilenet_v1': LSTMMobileNetV1FeatureExtractor, 'lstm_mobilenet_v1': LSTMMobileNetV1FeatureExtractor,
...@@ -125,7 +125,7 @@ def _build_lstm_model(ssd_config, lstm_config, is_training): ...@@ -125,7 +125,7 @@ def _build_lstm_model(ssd_config, lstm_config, is_training):
non_max_suppression_fn, score_conversion_fn = post_processing_builder.build( non_max_suppression_fn, score_conversion_fn = post_processing_builder.build(
ssd_config.post_processing) ssd_config.post_processing)
(classification_loss, localization_loss, classification_weight, (classification_loss, localization_loss, classification_weight,
localization_weight, miner, _) = losses_builder.build(ssd_config.loss) localization_weight, miner, _, _) = losses_builder.build(ssd_config.loss)
normalize_loss_by_num_matches = ssd_config.normalize_loss_by_num_matches normalize_loss_by_num_matches = ssd_config.normalize_loss_by_num_matches
encode_background_as_zeros = ssd_config.encode_background_as_zeros encode_background_as_zeros = ssd_config.encode_background_as_zeros
......
...@@ -20,7 +20,7 @@ from google.protobuf import text_format ...@@ -20,7 +20,7 @@ from google.protobuf import text_format
from lstm_object_detection import model_builder from lstm_object_detection import model_builder
from lstm_object_detection.lstm import lstm_meta_arch from lstm_object_detection.lstm import lstm_meta_arch
from lstm_object_detection.protos import pipeline_pb2 as internal_pipeline_pb2 from lstm_object_detection.protos import pipeline_pb2 as internal_pipeline_pb2
from google3.third_party.tensorflow_models.object_detection.protos import pipeline_pb2 from object_detection.protos import pipeline_pb2
class ModelBuilderTest(tf.test.TestCase): class ModelBuilderTest(tf.test.TestCase):
......
...@@ -20,10 +20,10 @@ from tensorflow.python.framework import ops as tf_ops ...@@ -20,10 +20,10 @@ from tensorflow.python.framework import ops as tf_ops
from lstm_object_detection.lstm import lstm_cells from lstm_object_detection.lstm import lstm_cells
from lstm_object_detection.lstm import lstm_meta_arch from lstm_object_detection.lstm import lstm_meta_arch
from lstm_object_detection.lstm import rnn_decoder from lstm_object_detection.lstm import rnn_decoder
from google3.third_party.tensorflow_models.object_detection.models import feature_map_generators from object_detection.models import feature_map_generators
from google3.third_party.tensorflow_models.object_detection.utils import context_manager from object_detection.utils import context_manager
from google3.third_party.tensorflow_models.object_detection.utils import ops from object_detection.utils import ops
from google3.third_party.tensorflow_models.object_detection.utils import shape_utils from object_detection.utils import shape_utils
from nets import mobilenet_v1 from nets import mobilenet_v1
slim = tf.contrib.slim slim = tf.contrib.slim
......
...@@ -19,7 +19,7 @@ import numpy as np ...@@ -19,7 +19,7 @@ import numpy as np
import tensorflow as tf import tensorflow as tf
from lstm_object_detection.models import lstm_ssd_mobilenet_v1_feature_extractor as feature_extactor from lstm_object_detection.models import lstm_ssd_mobilenet_v1_feature_extractor as feature_extactor
from google3.third_party.tensorflow_models.object_detection.models import ssd_feature_extractor_test from object_detection.models import ssd_feature_extractor_test
slim = tf.contrib.slim slim = tf.contrib.slim
......
...@@ -2,7 +2,7 @@ syntax = "proto2"; ...@@ -2,7 +2,7 @@ syntax = "proto2";
package lstm_object_detection.input_readers; package lstm_object_detection.input_readers;
import "third_party/tensorflow_models/object_detection/protos/input_reader.proto"; import "object_detection/protos/input_reader.proto";
message GoogleInputReader { message GoogleInputReader {
extend object_detection.protos.ExternalInputReader { extend object_detection.protos.ExternalInputReader {
......
...@@ -2,7 +2,7 @@ syntax = "proto2"; ...@@ -2,7 +2,7 @@ syntax = "proto2";
package object_detection.protos; package object_detection.protos;
import "third_party/tensorflow_models/object_detection/protos/pipeline.proto"; import "object_detection/protos/pipeline.proto";
extend TrainEvalPipelineConfig { extend TrainEvalPipelineConfig {
optional LstmModel lstm_model = 205743444; optional LstmModel lstm_model = 205743444;
......
...@@ -28,11 +28,11 @@ from google3.learning.brain.contrib.slim.data import parallel_reader ...@@ -28,11 +28,11 @@ from google3.learning.brain.contrib.slim.data import parallel_reader
from tensorflow.contrib.training.python.training import sequence_queueing_state_saver as sqss from tensorflow.contrib.training.python.training import sequence_queueing_state_saver as sqss
from lstm_object_detection import tf_sequence_example_decoder from lstm_object_detection import tf_sequence_example_decoder
from lstm_object_detection.protos import input_reader_google_pb2 from lstm_object_detection.protos import input_reader_google_pb2
from google3.third_party.tensorflow_models.object_detection.core import preprocessor from object_detection.core import preprocessor
from google3.third_party.tensorflow_models.object_detection.core import preprocessor_cache from object_detection.core import preprocessor_cache
from google3.third_party.tensorflow_models.object_detection.core import standard_fields as fields from object_detection.core import standard_fields as fields
from google3.third_party.tensorflow_models.object_detection.protos import input_reader_pb2 from object_detection.protos import input_reader_pb2
from google3.third_party.tensorflow_models.object_detection.utils import ops as util_ops from object_detection.utils import ops as util_ops
# TODO(yinxiao): Make the following variable into configurable proto. # TODO(yinxiao): Make the following variable into configurable proto.
# Padding size for the labeled objects in each frame. Here we assume each # Padding size for the labeled objects in each frame. Here we assume each
......
...@@ -25,11 +25,11 @@ from tensorflow.core.example import example_pb2 ...@@ -25,11 +25,11 @@ from tensorflow.core.example import example_pb2
from tensorflow.core.example import feature_pb2 from tensorflow.core.example import feature_pb2
from lstm_object_detection import seq_dataset_builder from lstm_object_detection import seq_dataset_builder
from lstm_object_detection.protos import pipeline_pb2 as internal_pipeline_pb2 from lstm_object_detection.protos import pipeline_pb2 as internal_pipeline_pb2
from google3.third_party.tensorflow_models.object_detection.builders import preprocessor_builder from object_detection.builders import preprocessor_builder
from google3.third_party.tensorflow_models.object_detection.core import standard_fields as fields from object_detection.core import standard_fields as fields
from google3.third_party.tensorflow_models.object_detection.protos import input_reader_pb2 from object_detection.protos import input_reader_pb2
from google3.third_party.tensorflow_models.object_detection.protos import pipeline_pb2 from object_detection.protos import pipeline_pb2
from google3.third_party.tensorflow_models.object_detection.protos import preprocessor_pb2 from object_detection.protos import preprocessor_pb2
class DatasetBuilderTest(parameterized.TestCase): class DatasetBuilderTest(parameterized.TestCase):
......
...@@ -22,8 +22,8 @@ tensorflow.SequenceExample, merge this decoder. ...@@ -22,8 +22,8 @@ tensorflow.SequenceExample, merge this decoder.
""" """
import tensorflow as tf import tensorflow as tf
from google3.learning.brain.contrib.slim.data import tfexample_decoder from google3.learning.brain.contrib.slim.data import tfexample_decoder
from google3.third_party.tensorflow_models.object_detection.core import data_decoder from object_detection.core import data_decoder
from google3.third_party.tensorflow_models.object_detection.core import standard_fields as fields from object_detection.core import standard_fields as fields
slim_example_decoder = tf.contrib.slim.tfexample_decoder slim_example_decoder = tf.contrib.slim.tfexample_decoder
......
...@@ -20,7 +20,7 @@ import tensorflow as tf ...@@ -20,7 +20,7 @@ import tensorflow as tf
from tensorflow.core.example import example_pb2 from tensorflow.core.example import example_pb2
from tensorflow.core.example import feature_pb2 from tensorflow.core.example import feature_pb2
from lstm_object_detection import tf_sequence_example_decoder from lstm_object_detection import tf_sequence_example_decoder
from google3.third_party.tensorflow_models.object_detection.core import standard_fields as fields from object_detection.core import standard_fields as fields
class TfSequenceExampleDecoderTest(tf.test.TestCase): class TfSequenceExampleDecoderTest(tf.test.TestCase):
......
...@@ -51,7 +51,7 @@ from lstm_object_detection import model_builder ...@@ -51,7 +51,7 @@ from lstm_object_detection import model_builder
from lstm_object_detection import seq_dataset_builder from lstm_object_detection import seq_dataset_builder
from lstm_object_detection import trainer from lstm_object_detection import trainer
from lstm_object_detection.utils import config_util from lstm_object_detection.utils import config_util
from google3.third_party.tensorflow_models.object_detection.builders import preprocessor_builder from object_detection.builders import preprocessor_builder
flags.DEFINE_string('master', '', 'Name of the TensorFlow master to use.') flags.DEFINE_string('master', '', 'Name of the TensorFlow master to use.')
flags.DEFINE_integer('task', 0, 'task id') flags.DEFINE_integer('task', 0, 'task id')
......
...@@ -23,10 +23,10 @@ import functools ...@@ -23,10 +23,10 @@ import functools
import tensorflow as tf import tensorflow as tf
from google3.pyglib import logging from google3.pyglib import logging
from google3.third_party.tensorflow_models.object_detection.builders import optimizer_builder from object_detection.builders import optimizer_builder
from google3.third_party.tensorflow_models.object_detection.core import standard_fields as fields from object_detection.core import standard_fields as fields
from google3.third_party.tensorflow_models.object_detection.utils import ops as util_ops from object_detection.utils import ops as util_ops
from google3.third_party.tensorflow_models.object_detection.utils import variables_helper from object_detection.utils import variables_helper
from deployment import model_deploy from deployment import model_deploy
slim = tf.contrib.slim slim = tf.contrib.slim
......
...@@ -24,8 +24,8 @@ import tensorflow as tf ...@@ -24,8 +24,8 @@ import tensorflow as tf
from google.protobuf import text_format from google.protobuf import text_format
from lstm_object_detection.protos import input_reader_google_pb2 # pylint: disable=unused-import from lstm_object_detection.protos import input_reader_google_pb2 # pylint: disable=unused-import
from lstm_object_detection.protos import pipeline_pb2 as internal_pipeline_pb2 from lstm_object_detection.protos import pipeline_pb2 as internal_pipeline_pb2
from google3.third_party.tensorflow_models.object_detection.protos import pipeline_pb2 from object_detection.protos import pipeline_pb2
from google3.third_party.tensorflow_models.object_detection.utils import config_util from object_detection.utils import config_util
def get_configs_from_pipeline_file(pipeline_config_path): def get_configs_from_pipeline_file(pipeline_config_path):
......
...@@ -25,7 +25,7 @@ import tensorflow as tf ...@@ -25,7 +25,7 @@ import tensorflow as tf
from google.protobuf import text_format from google.protobuf import text_format
from lstm_object_detection.protos import pipeline_pb2 as internal_pipeline_pb2 from lstm_object_detection.protos import pipeline_pb2 as internal_pipeline_pb2
from lstm_object_detection.utils import config_util from lstm_object_detection.utils import config_util
from google3.third_party.tensorflow_models.object_detection.protos import pipeline_pb2 from object_detection.protos import pipeline_pb2
def _write_config(config, config_path): def _write_config(config, config_path):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment