• Zhuoran Liu's avatar
    Add TPU SavedModel exporter and refactor OD code (#6737) · 80444539
    Zhuoran Liu authored
    247226201  by ronnyvotel:
    
        Updating the visualization tools to accept unique_ids for color coding.
    
    --
    247067830  by Zhichao Lu:
    
        Add box_encodings_clip_range options for the convolutional box predictor (for TPU compatibility).
    
    --
    246888475  by Zhichao Lu:
    
        Remove unused _update_eval_steps function.
    
    --
    246163259  by lzc:
    
        Add a gather op that can handle ignore indices (which are "-1"s in this case).
    
    --
    246084944  by Zhichao Lu:
    
        Keras based implementation for SSD + MobilenetV2 + FPN.
    
    --
    245544227  by rathodv:
    
        Add batch_get_targets method to target assigner module to gather any groundtruth tensors based on the results of target assigner.
    
    --
    245540854  by rathodv:
    
        Update target assigner to return match tensor instead of a match object.
    
    --
    245434441  by Zhichao Lu:
    
        Add README for tpu_exporters package.
    
    --
    245381834  by lzc:
    
        Internal change.
    
    --
    245298983  by Zhichao Lu:
    
        Add conditional_shape_resizer to config_util
    
    --
    245134666  by Zhichao Lu:
    
        Adds ConditionalShapeResizer to the ImageResizer proto which enables resizing only if input image height or width is is greater or smaller than a certain size. Also enables specification of resize method in resize_to_{max, min}_dimension methods.
    
    --
    245093975  by Zhichao Lu:
    
        Exporting SavedModel for Object Detection TPU inference. (faster-rcnn)
    
    --
    245072421  by Zhichao Lu:
    
        Adds a new image resizing method "resize_to_max_dimension" which resizes images only if a dimension is greater than the maximum desired value while maintaining aspect ratio.
    
    --
    244946998  by lzc:
    
        Internal Changes.
    
    --
    244943693  by Zhichao Lu:
    
        Add a custom config to mobilenet v2 that makes it more detection friendly.
    
    --
    244754158  by derekjchow:
    
        Internal change.
    
    --
    244699875  by Zhichao Lu:
    
        Add check_range=False to box_list_ops.to_normalized_coordinates when training
        for instance segmentation.  This is consistent with other calls when training
        for object detection.  There could be wrongly annotated boxes in the dataset.
    
    --
    244507425  by rathodv:
    
        Support bfloat16 for ssd models.
    
    --
    244399982  by Zhichao Lu:
    
        Exporting SavedModel for Object Detection TPU inference. (ssd)
    
    --
    244209387  by Zhichao Lu:
    
        Internal change.
    
    --
    243922296  by rathodv:
    
        Change `raw_detection_scores` to contain softmax/sigmoid scores (not logits) for `raw_ detection_boxes`.
    
    --
    243883978  by Zhichao Lu:
    
        Add a sample fully conv config.
    
    --
    243369455  by Zhichao Lu:
    
        Fix regularization loss gap in Keras and Slim.
    
    --
    243292002  by lzc:
    
        Internal changes.
    
    --
    243097958  by Zhichao Lu:
    
        Exporting SavedModel for Object Detection TPU inference. (ssd model)
    
    --
    243007177  by Zhichao Lu:
    
        Exporting SavedModel for Object Detection TPU inference. (ssd model)
    
    --
    242776550  by Zhichao Lu:
    
        Make object detection pre-processing run on GPU.  tf.map_fn() uses
        TensorArrayV3 ops, which have no int32 GPU implementation.  Cast to int64,
        then cast back to int32.
    
    --
    242723128  by Zhichao Lu:
    
        Using sorted dictionaries for additional heads in non_max_suppression to ensure tensor order
    
    --
    242495311  by Zhichao Lu:
    
        Update documentation to reflect new TFLite examples repo location
    
    --
    242230527  by Zhichao Lu:
    
        Fix Dropout bugs for WeightSharedConvolutionalBoxPred.
    
    --
    242226573  by Zhichao Lu:
    
        Create Keras-based WeightSharedConvolutionalBoxPredictor.
    
    --
    241806074  by Zhichao Lu:
    
        Add inference in unit tests of TFX OD template.
    
    --
    241641498  by lzc:
    
        Internal change.
    
    --
    241637481  by Zhichao Lu:
    
        matmul_crop_and_resize(): Switch to dynamic shaping, so that not all dimensions are required to be known.
    
    --
    241429980  by Zhichao Lu:
    
        Internal change
    
    --
    241167237  by Zhichao Lu:
    
        Adds a faster_rcnn_inception_resnet_v2 Keras feature extractor, and updates the model builder to construct it.
    
    --
    241088616  by Zhichao Lu:
    
        Make it compatible with different dtype, e.g. float32, bfloat16, etc.
    
    --
    240897364  by lzc:
    
        Use image_np_expanded in object_detection_tutorial notebook.
    
    --
    240890393  by Zhichao Lu:
    
        Disable multicore inference for OD template as its not yet compatible.
    
    --
    240352168  by Zhichao Lu:
    
        Make SSDResnetV1FpnFeatureExtractor not protected to allow inheritance.
    
    --
    240351470  by lzc:
    
        Internal change.
    
    --
    239878928  by Zhichao Lu:
    
        Defines Keras box predictors for Faster RCNN and RFCN
    
    --
    239872103  by Zhichao Lu:
    
        Delete duplicated inputs in test.
    
    --
    239714273  by Zhichao Lu:
    
        Adding scope variable to all class heads
    
    --
    239698643  by Zhichao Lu:
    
        Create FPN feature extractor for object detection.
    
    --
    239696657  by Zhichao Lu:
    
        Internal Change.
    
    --
    239299404  by Zhichao Lu:
    
        Allows the faster rcnn meta-architecture to support Keras subcomponents
    
    --
    238502595  by Zhichao Lu:
    
        Lay the groundwork for symmetric quantization.
    
    --
    238496885  by Zhichao Lu:
    
        Add flexible_grid_anchor_generator
    
    --
    238138727  by lzc:
    
        Remove dead code.
    
        _USE_C_SHAPES has been forced True in TensorFlow releases since
        TensorFlow 1.9
        (https://github.com/tensorflow/tensorflow/commit/1d74a69443f741e69f9f52cb6bc2940b4d4ae3b7)
    
    --
    238123936  by rathodv:
    
        Add num_matched_groundtruth summary to target assigner in SSD.
    
    --
    238103345  by ronnyvotel:
    
        Raising error if input file pattern does not match any files.
        Also printing the number of evaluation images for coco metrics.
    
    --
    238044081  by Zhichao Lu:
    
        Fix docstring to state the correct dimensionality of `class_predictions_with_background`.
    
    --
    237920279  by Zhichao Lu:
    
        [XLA] Rework debug flags for dumping HLO.
    
        The following flags (usually passed via the XLA_FLAGS envvar) are removed:
    
          xla_dump_computations_to
          xla_dump_executions_to
          xla_dump_ir_to
          xla_dump_optimized_hlo_proto_to
          xla_dump_per_pass_hlo_proto_to
          xla_dump_unoptimized_hlo_proto_to
          xla_generate_hlo_graph
          xla_generate_hlo_text_to
          xla_hlo_dump_as_html
          xla_hlo_graph_path
          xla_log_hlo_text
    
        The following new flags are added:
    
          xla_dump_to
          xla_dump_hlo_module_re
          xla_dump_hlo_pass_re
          xla_dump_hlo_as_text
          xla_dump_hlo_as_proto
          xla_dump_hlo_as_dot
          xla_dump_hlo_as_url
          xla_dump_hlo_as_html
          xla_dump_ir
          xla_dump_hlo_snapshots
    
        The default is not to dump anything at all, but as soon as some dumping flag is
        specified, we enable the following defaults (most of which can be overridden).
    
         * dump to stdout (overridden by --xla_dump_to)
         * dump HLO modules at the very beginning and end of the optimization pipeline
         * don't dump between any HLO passes (overridden by --xla_dump_hlo_pass_re)
         * dump all HLO modules (overridden by --xla_dump_hlo_module_re)
         * dump in textual format (overridden by
           --xla_dump_hlo_as_{text,proto,dot,url,html}).
    
        For example, to dump optimized and unoptimized HLO text and protos to /tmp/foo,
        pass
    
          --xla_dump_to=/tmp/foo --xla_dump_hlo_as_text --xla_dump_hlo_as_proto
    
        For details on these flags' meanings, see xla.proto.
    
        The intent of this change is to make dumping both simpler to use and more
        powerful.
    
        For example:
    
         * Previously there was no way to dump the HLO module during the pass pipeline
           in HLO text format; the only option was --dump_per_pass_hlo_proto_to, which
           dumped in proto format.
    
           Now this is --xla_dump_pass_re=.* --xla_dump_hlo_as_text.  (In fact, the
           second flag is not necessary in this case, as dumping as text is the
           default.)
    
         * Previously there was no way to dump HLO as a graph before and after
           compilation; the only option was --xla_generate_hlo_graph, which would dump
           before/after every pass.
    
           Now this is --xla_dump_hlo_as_{dot,url,html} (depending on what format you
           want the graph in).
    
         * Previously, there was no coordination between the filenames written by the
           various flags, so info about one module might be dumped with various
           filename prefixes.  Now the filenames are consistent and all dumps from a
           particular module are next to each other.
    
        If you only specify some of these flags, we try to figure out what you wanted.
        For example:
    
         * --xla_dump_to implies --xla_dump_hlo_as_text unless you specify some
           other --xla_dump_as_* flag.
    
         * --xla_dump_hlo_as_text or --xla_dump_ir implies dumping to stdout unless you
           specify a different --xla_dump_to directory.  You can explicitly dump to
           stdout with --xla_dump_to=-.
    
        As part of this change, I simplified the debugging code in the HLO passes for
        dumping HLO modules.  Previously, many tests explicitly VLOG'ed the HLO module
        before, after, and sometimes during the pass.  I removed these VLOGs.  If you
        want dumps before/during/after an HLO pass, use --xla_dump_pass_re=<pass_name>.
    
    --
    237510043  by lzc:
    
        Internal Change.
    
    --
    237469515  by Zhichao Lu:
    
        Parameterize model_builder.build in inputs.py.
    
    --
    237293511  by rathodv:
    
        Remove multiclass_scores from tensor_dict in transform_data_fn always.
    
    --
    237260333  by ronnyvotel:
    
        Updating faster_rcnn_meta_arch to define prediction dictionary fields that are batched.
    
    --
    
    PiperOrigin-RevId: 247226201
    80444539
visualization_utils.py 42.3 KB