1. 13 Nov, 2019 1 commit
    • Mark Sandler's avatar
      Merged commit includes the following changes: (#7800) · b968a6ce
      Mark Sandler authored
      280142968  by Zhichao Lu:
      
          Opensource MobilenetEdgeTPU + ssdlite into third-party object detection APIs on EdgeTPU.
      
      --
      280134001  by Zhichao Lu:
      
          Adds MobilenetEdgeTpu + ssdlite into internal object detection APIs on EdgeTPU.
      
      --
      278941778  by Zhichao Lu:
      
          Add support for fixed input shapes for 'encoded_image_string_tensor' and 'tf_example' inputs.
      
      --
      278933274  by Zhichao Lu:
      
            Adding fool proof check to avoid using 1x1 depthwise conv op.
      
      --
      278762192  by Zhichao Lu:
      
          Ensure correct number of iterations after training resumes.
      
      --
      278746440  by Zhichao Lu:
      
          Internal change.
      
      --
      278006953  by Zhichao Lu:
      
          Internal changes to tf.contrib symbols
      
      --
      278006330  by Zhichao Lu:
      
          Internal changes to tf.contrib symbols
      
      --
      277593959  by Zhichao Lu:
      
            Make the ssd_feature_extractor_test.py PY3 compatible. The "six.zip" will use "itertools.izip" in Python 2 and "zip" in Python 3.
      
      --
      277344551  by Zhichao Lu:
      
          Internal change.
      
      --
      277154953  by Zhichao Lu:
      
          Conditionally use keras based optimizers so that check-pointing works correctly.
          This change also enables summaries on TPU which were previously not enabled
          due to a bug.
      
      --
      277087572  by Zhichao Lu:
      
          Fix resizing boxes when using keep_aspect_ratio_rezier with padding.
      
      --
      275898543  by Zhichao Lu:
      
          Support label_map_proto as input in label_map_util.
      
      --
      275347137  by Zhichao Lu:
      
          Add force_no_resize flag in eval.proto which replaces
          the resize config with identity resizer. This is useful
          when we want to test at the original image resolution.
      
      --
      
      PiperOrigin-RevId: 280142968
      b968a6ce
  2. 17 Oct, 2019 1 commit
    • pkulzc's avatar
      Release MobileNet V3 models and SSDLite models with MobileNet V3 backbone. (#7678) · 0ba83cf0
      pkulzc authored
      * Merged commit includes the following changes:
      275131829  by Sergio Guadarrama:
      
          updates mobilenet/README.md to be github compatible adds V2+ reference to mobilenet_v1.md file and fixes invalid markdown
      
      --
      274908068  by Sergio Guadarrama:
      
          Opensource MobilenetV3 detection models.
      
      --
      274697808  by Sergio Guadarrama:
      
          Fixed cases where tf.TensorShape was constructed with float dimensions
      
          This is a prerequisite for making TensorShape and Dimension more strict
          about the types of their arguments.
      
      --
      273577462  by Sergio Guadarrama:
      
          Fixing `conv_defs['defaults']` override issue.
      
      --
      272801298  by Sergio Guadarrama:
      
          Adds links to trained models for Moblienet V3, adds a version of minimalistic mobilenet-v3 to the definitions.
      
      --
      268928503  by Sergio Guadarrama:
      
          Mobilenet v2 with group normalization.
      
      --
      263492735  by Sergio Guadarrama:
      
          Internal change
      
      260037126  by Sergio Guadarrama:
      
          Adds an option of using a custom depthwise operation in `expanded_conv`.
      
      --
      259997001  by Sergio Guadarrama:
      
          Explicitly mark Python binaries/tests with python_version = "PY2".
      
      --
      252697685  by Sergio Guadarrama:
      
          Internal change
      
      251918746  by Sergio Guadarrama:
      
          Internal change
      
      251909704  by Sergio Guadarrama:
      
          Mobilenet V3 backbone implementation.
      
      --
      247510236  by Sergio Guadarrama:
      
          Internal change
      
      246196802  by Sergio Guadarrama:
      
          Internal change
      
      246014539  by Sergio Guadarrama:
      
          Internal change
      
      245891435  by Sergio Guadarrama:
      
          Internal change
      
      245834925  by Sergio Guadarrama:
      
          n/a
      
      --
      
      PiperOrigin-RevId: 275131829
      
      * Merged commit includes the following changes:
      274959989  by Zhichao Lu:
      
          Update detection model zoo with MobilenetV3 SSD candidates.
      
      --
      274908068  by Zhichao Lu:
      
          Opensource MobilenetV3 detection models.
      
      --
      274695889  by richardmunoz:
      
          RandomPatchGaussian preprocessing step
      
          This step can be used during model training to randomly apply gaussian noise to a random image patch. Example addition to an Object Detection API pipeline config:
      
          train_config {
            ...
            data_augmentation_options {
              random_patch_gaussian {
                random_coef: 0.5
                min_patch_size: 1
                max_patch_size: 250
                min_gaussian_stddev: 0.0
                max_gaussian_stddev: 1.0
              }
            }
            ...
          }
      
      --
      274257872  by lzc:
      
          Internal change.
      
      --
      274114689  by Zhichao Lu:
      
          Pass native_resize flag to other FPN variants.
      
      --
      274112308  by lzc:
      
          Internal change.
      
      --
      274090763  by richardmunoz:
      
          Util function for getting a patch mask on an image for use with the Object Detection API
      
      --
      274069806  by Zhichao Lu:
      
          Adding functions which will help compute predictions and losses for CenterNet.
      
      --
      273860828  by lzc:
      
          Internal change.
      
      --
      273380069  by richardmunoz:
      
          RandomImageDownscaleToTargetPixels preprocessing step
      
          This step can be used during model training to randomly downscale an image to a random target number of pixels. If the image does not contain more than the target number of pixels, then downscaling is skipped. Example addition to an Object Detection API pipeline config:
      
          train_config {
            ...
            data_augmentation_options {
              random_downscale_to_target_pixels {
                random_coef: 0.5
                min_target_pixels: 300000
                max_target_pixels: 500000
              }
            }
            ...
          }
      
      --
      272987602  by Zhichao Lu:
      
          Avoid -inf when empty box list is passed.
      
      --
      272525836  by Zhichao Lu:
      
          Cleanup repeated resizing code in meta archs.
      
      --
      272458667  by richardmunoz:
      
          RandomJpegQuality preprocessing step
      
          This step can be used during model training to randomly encode the image into a jpeg with a random quality level. Example addition to an Object Detection API pipeline config:
      
          train_config {
            ...
            data_augmentation_options {
              random_jpeg_quality {
                random_coef: 0.5
                min_jpeg_quality: 80
                max_jpeg_quality: 100
              }
            }
            ...
          }
      
      --
      271412717  by Zhichao Lu:
      
          Enables TPU training with the V2 eager + tf.function Object Detection training loops.
      
      --
      270744153  by Zhichao Lu:
      
          Adding the offset and size target assigners for CenterNet.
      
      --
      269916081  by Zhichao Lu:
      
          Include basic installation in Object Detection API tutorial.
          Also:
           - Use TF2.0
           - Use saved_model
      
      --
      269376056  by Zhichao Lu:
      
          Fix to variable loading in RetinaNet w/ custom loops. (makes the code rely on the exact name scopes that are generated a little bit less)
      
      --
      269256251  by lzc:
      
          Add use_partitioned_nms field to config and update post_prossing_builder to honor that flag when building nms function.
      
      --
      268865295  by Zhichao Lu:
      
          Adding functionality for importing and merging back internal state of the metric.
      
      --
      268640984  by Zhichao Lu:
      
          Fix computation of gaussian sigma value to create CenterNet heatmap target.
      
      --
      267475576  by Zhichao Lu:
      
          Fix for exporter trying to export non-existent exponential moving averages.
      
      --
      267286768  by Zhichao Lu:
      
          Update mixed-precision policy.
      
      --
      266166879  by Zhichao Lu:
      
          Internal change
      
      265860884  by Zhichao Lu:
      
          Apply floor function to center coordinates when creating heatmap for CenterNet target.
      
      --
      265702749  by Zhichao Lu:
      
          Internal change
      
      --
      264241949  by ronnyvotel:
      
          Updating Faster R-CNN 'final_anchors' to be in normalized coordinates.
      
      --
      264175192  by lzc:
      
          Update model_fn to only read hparams if it is not None.
      
      --
      264159328  by Zhichao Lu:
      
          Modify nearest neighbor upsampling to eliminate a multiply operation. For quantized models, the multiply operation gets unnecessarily quantized and reduces accuracy (simple stacking would work in place of the broadcast op which doesn't require quantization). Also removes an unnecessary reshape op.
      
      --
      263668306  by Zhichao Lu:
      
          Add the option to use dynamic map_fn for batch NMS
      
      --
      263031163  by Zhichao Lu:
      
          Mark outside compilation for NMS as optional.
      
      --
      263024916  by Zhichao Lu:
      
          Add an ExperimentalModel meta arch for experimenting with new model types.
      
      --
      262655894  by Zhichao Lu:
      
          Add the center heatmap target assigner for CenterNet
      
      --
      262431036  by Zhichao Lu:
      
          Adding add_eval_dict to allow for evaluation on model_v2
      
      --
      262035351  by ronnyvotel:
      
          Removing any non-Tensor predictions from the third stage of Mask R-CNN.
      
      --
      261953416  by Zhichao Lu:
      
          Internal change.
      
      --
      261834966  by Zhichao Lu:
      
          Fix the NMS OOM issue on TPU by forcing NMS to run outside of TPU.
      
      --
      261775941  by Zhichao Lu:
      
          Make Keras InputLayer compatible with both TF 1.x and TF 2.0.
      
      --
      261775633  by Zhichao Lu:
      
          Visualize additional channels with ground-truth bounding boxes.
      
      --
      261768117  by lzc:
      
          Internal change.
      
      --
      261766773  by ronnyvotel:
      
          Exposing `return_raw_detections_during_predict` in Faster R-CNN Proto.
      
      --
      260975089  by ronnyvotel:
      
          Moving calculation of batched prediction tensor names after all tensors in prediction dictionary are created.
      
      --
      259816913  by ronnyvotel:
      
          Adding raw detection boxes and feature map indices to SSD
      
      --
      259791955  by Zhichao Lu:
      
          Added a flag to control the use partitioned_non_max_suppression.
      
      --
      259580475  by Zhichao Lu:
      
          Tweak quantization-aware training re-writer to support NasFpn model architecture.
      
      --
      259579943  by rathodv:
      
          Add a meta target assigner proto and builders in OD API.
      
      --
      259577741  by Zhichao Lu:
      
          Internal change.
      
      --
      259366315  by lzc:
      
          Internal change.
      
      --
      259344310  by ronnyvotel:
      
          Updating faster rcnn so that raw_detection_boxes from predict() are in normalized coordinates.
      
      --
      259338670  by Zhichao Lu:
      
          Add support for use_native_resize_op to more feature extractors. Use dynamic shapes when static shapes are not available.
      
      --
      259083543  by ronnyvotel:
      
          Updating/fixing documentation.
      
      --
      259078937  by rathodv:
      
          Add prediction fields for tensors returned from detection_model.predict.
      
      --
      259044601  by Zhichao Lu:
      
          Add protocol buffer and builders for temperature scaling calibration.
      
      --
      259036770  by lzc:
      
          Internal changes.
      
      --
      259006223  by ronnyvotel:
      
          Adding detection anchor indices to Faster R-CNN Config. This is useful when one wishes to associate final detections and the anchors (or pre-nms boxes) from which they originated.
      
      --
      258872501  by Zhichao Lu:
      
          Run the training pipeline of ssd + resnet_v1_50 + fpn with a checkpoint.
      
      --
      258840686  by ronnyvotel:
      
          Adding standard outputs to DetectionModel.predict(). This CL only updates Faster R-CNN. Other meta architectures will be updated in future CLs.
      
      --
      258672969  by lzc:
      
          Internal change.
      
      --
      258649494  by lzc:
      
          Internal changes.
      
      --
      258630321  by ronnyvotel:
      
          Fixing documentation in shape_utils.flatten_dimensions().
      
      --
      258468145  by Zhichao Lu:
      
          Add additional output tensors parameter to Postprocess op.
      
      --
      258099219  by Zhichao Lu:
      
          Internal changes
      
      --
      
      PiperOrigin-RevId: 274959989
      0ba83cf0
  3. 11 Oct, 2019 2 commits
  4. 09 Oct, 2019 1 commit
    • Pooya Davoodi's avatar
      Add Combined NMS (#6138) · 3980d2a1
      Pooya Davoodi authored
      * Updating python API to use CombinedNonMaxSuppresion TF operator
      
      1. Adds a unit test to test post_processing python API
      2. Currently sets clip_window to None as the kernel uses the default
         clip_window of [0,0,1,1]
      3. Added use_static_shapes to the API. In old API if
         use_static_shapes is true, then it pads/clips outputs to max_total_size, if
      specified. If not specified, it pads to num_classes*max_size_per_class.
       If use_static_shapes is false, it always pads/clips to max_total_size.
      
      Update unit test to account for clipped bouding boxes
      
      Changed the name to CombinedNonMaxSuppression based on feedback from Google
      
      Added additional parameters to combinedNMS python function. They are currently
      unused and required for networks like FasterRCNN and MaskRCNN
      
      * Delete selected_indices from API
      
      Because it was removed from CombinedNMS recently in the PR.
      
      * Improve doc of function combined_non_max_suppression
      
      * Enable CombinedNonMaxSuppression for first_stage_nms
      
      * fix bug
      
      * Ensure agnostic_nms is not used with combined_nms
      
      Remove redundant arguments from combined_nms
      
      * Fix pylint
      
      * Add checks for unsupported args
      
      * Fix pylint
      
      * Move combined_non_max_suppression to batch_multiclass_non_max_suppression
      
      Also rename combined_nms to use_combined_nms
      
      * Delete combined_nms for first_stage_nms because it does not work
      
      * Revert "Delete combined_nms for first_stage_nms because it does not work"
      
      This reverts commit 2a3cc5145f17cee630a67ddedd20e90c2920fa9f.
      
      * Use nmsed_additional_fields.get to avoid error
      
      * Merge combined_non_max_suppression with main nms function
      
      * Rename combined_nms for first stage nms
      
      * Improve  docs
      
      * Use assertListEqual for numpy arrays
      
      * Fix pylint errors
      
      * End comments with period
      3980d2a1
  5. 15 Jul, 2019 1 commit
    • pkulzc's avatar
      Object detection changes: (#7208) · fe748d4a
      pkulzc authored
      257914648  by lzc:
      
          Internal changes
      
      --
      257525973  by Zhichao Lu:
      
          Fixes bug that silently prevents checkpoints from loading when training w/ eager + functions. Also sets up scripts to run training.
      
      --
      257296614  by Zhichao Lu:
      
          Adding detection_features to model outputs
      
      --
      257234565  by Zhichao Lu:
      
          Fix wrong order of `classes_with_max_scores` in class-agnostic NMS caused by
          sorting in partitioned-NMS.
      
      --
      257232002  by ronnyvotel:
      
          Supporting `filter_nonoverlapping` option in np_box_list_ops.clip_to_window().
      
      --
      257198282  by Zhichao Lu:
      
          Adding the focal loss and l1 loss from the Objects as Points paper.
      
      --
      257089535  by Zhichao Lu:
      
          Create Keras based ssd + resnetv1 + fpn.
      
      --
      257087407  by Zhichao Lu:
      
          Make object_detection/data_decoders Python3-compatible.
      
      --
      257004582  by Zhichao Lu:
      
          Updates _decode_raw_data_into_masks_and_boxes to the latest binary masks-to-string encoding fo...
      fe748d4a
  6. 26 Jun, 2019 1 commit
  7. 31 May, 2019 1 commit
    • pkulzc's avatar
      Merged commit includes the following changes: (#6932) · 9bbf8015
      pkulzc authored
      250447559  by Zhichao Lu:
      
          Update expected files format for Instance Segmentation challenge:
          - add fields ImageWidth, ImageHeight and store the values per prediction
          - as mask, store only encoded image and assume its size is ImageWidth x ImageHeight
      
      --
      250402780  by rathodv:
      
          Fix failing Mask R-CNN TPU convergence test.
      
          Cast second stage prediction tensors from bfloat16 to float32 to prevent errors in third target assignment (Mask Prediction) - Concat with different types bfloat16 and bfloat32 isn't allowed.
      
      --
      250300240  by Zhichao Lu:
      
          Addion Open Images Challenge 2019 object detection and instance segmentation
          support into Estimator framework.
      
      --
      249944839  by rathodv:
      
          Modify exporter.py to add multiclass score nodes in exported inference graphs.
      
      --
      249935201  by rathodv:
      
          Modify postprocess methods to preserve multiclass scores after non max suppression.
      
      --
      249878079  by Zhichao Lu:
      
          This CL slightly refactors some Object Detection helper functions for data creation, evaluation, and groundtruth providing.
      
          This will allow the eager+function custom loops to share code with the existing estimator training loops.
      
          Concretely we make the following changes:
          1. In input creation we separate dataset-creation into top-level helpers, and allow it to optionally accept a pre-constructed model directly instead of always creating a model from the config just for feature preprocessing.
      
          2. In coco evaluation we split the update_op creation into its own function, which the custom loops will call directly.
      
          3. In model_lib we move groundtruth providing/ datastructure munging into a helper function
      
          4. For now we put an escape hatch in `_summarize_target_assignment` when executing in tf v2.0 behavior because the summary apis used only work w/ tf 1.x
      
      --
      249673507  by rathodv:
      
          Use explicit casts instead of tf.to_float and tf.to_int32 to avoid warnings.
      
      --
      249656006  by Zhichao Lu:
      
          Add named "raw_keypoint_locations" node that corresponds with the "raw_box_locations" node.
      
      --
      249651674  by rathodv:
      
          Keep proposal boxes in float format. MatMulCropAndResize can handle the type even when feature themselves are bfloat16s.
      
      --
      249568633  by rathodv:
      
          Support q > 1 in class agnostic NMS.
          Break post_processing_test.py into 3 separate files to avoid linter errors.
      
      --
      249535530  by rathodv:
      
          Update some deprecated arguments to tf ops.
      
      --
      249368223  by rathodv:
      
          Modify MatMulCropAndResize to use MultiLevelRoIAlign method and move the tests to spatial_transform_ops.py module.
      
          This cl establishes that CropAndResize and RoIAlign are equivalent and only differ in the sampling point grid within the boxes. CropAndResize uses a uniform size x size point grid such that the corner points exactly overlap box corners, while RoiAlign divides boxes into size x size cells and uses their centers as sampling points. In this cl, we switch MatMulCropAndResize to use the MultiLevelRoIAlign implementation with `align_corner` option as MultiLevelRoIAlign implementation is more memory efficient on TPU when compared to the original MatMulCropAndResize.
      
      --
      249337338  by chowdhery:
      
          Add class-agnostic non-max-suppression in post_processing
      
      --
      249139196  by Zhichao Lu:
      
          Fix positional argument bug in export_tflite_ssd_graph
      
      --
      249120219  by Zhichao Lu:
      
          Add evaluator for computing precision limited to a given recall range.
      
      --
      249030593  by Zhichao Lu:
      
          Evaluation util to run segmentation and detection challenge evaluation.
      
      --
      248554358  by Zhichao Lu:
      
          This change contains the auxiliary changes required for TF 2.0 style training with eager+functions+dist strat loops, but not the loops themselves.
      
          It includes:
          - Updates to shape usage to support both tensorshape v1 and tensorshape v2
          - A fix to FreezableBatchNorm to not override the `training` arg in call when `None` was passed to the constructor (Not an issue in the estimator loops but it was in the custom loops)
          - Puts some constants in init_scope so they work in eager + functions
          - Makes learning rate schedules return a callable in eager mode (required so they update when the global_step changes)
          - Makes DetectionModel a tf.module so it tracks variables (e.g. ones nested in layers)
          - Removes some references to `op.name` for some losses and replaces it w/ explicit names
          - A small part of the change to allow the coco evaluation metrics to work in eager mode
      
      --
      248271226  by rathodv:
      
          Add MultiLevel RoIAlign op.
      
      --
      248229103  by rathodv:
      
          Add functions to 1. pad features maps 2. ravel 5-D indices
      
      --
      248206769  by rathodv:
      
          Add utilities needed to introduce RoI Align op.
      
      --
      248177733  by pengchong:
      
          Internal changes
      
      --
      247742582  by Zhichao Lu:
      
          Open Images Challenge 2019 instance segmentation metric: part 2
      
      --
      247525401  by Zhichao Lu:
      
          Update comments on max_class_per_detection.
      
      --
      247520753  by rathodv:
      
          Add multilevel crop and resize operation that builds on top of matmul_crop_and_resize.
      
      --
      247391600  by Zhichao Lu:
      
          Open Images Challenge 2019 instance segmentation metric
      
      --
      247325813  by chowdhery:
      
          Quantized MobileNet v2 SSD FPNLite config with depth multiplier 0.75
      
      --
      
      PiperOrigin-RevId: 250447559
      9bbf8015
  8. 22 May, 2019 1 commit
    • 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
  9. 14 May, 2019 1 commit
  10. 23 Apr, 2019 1 commit
  11. 22 Apr, 2019 1 commit
  12. 17 Apr, 2019 1 commit
  13. 29 Mar, 2019 1 commit
  14. 07 Mar, 2019 1 commit
    • pkulzc's avatar
      Merged commit includes the following changes: (#6315) · 05584085
      pkulzc authored
      236813471  by lzc:
      
          Internal change.
      
      --
      236507310  by lzc:
      
          Fix preprocess.random_resize_method config type issue. The target height and width will be passed as "size" to tf.image.resize_images which only accepts integer.
      
      --
      236409989  by Zhichao Lu:
      
          Config export_to_tpu from function parameter instead of HParams for TPU inference.
      
      --
      236403186  by Zhichao Lu:
      
          Make graph file names optional arguments.
      
      --
      236237072  by Zhichao Lu:
      
          Minor bugfix for keyword args.
      
      --
      236209602  by Zhichao Lu:
      
          Add support for PartitionedVariable to get_variables_available_in_checkpoint.
      
      --
      235828658  by Zhichao Lu:
      
          Automatically stop evaluation jobs when training is finished.
      
      --
      235817964  by Zhichao Lu:
      
          Add an optional process_metrics_fn callback to eval_util, it gets called
          with evaluation results once each evaluation is complete.
      
      --
      235788721  by lzc:
      
          Fix yml file tf runtime version.
      
      --
      235262897  by Zhichao Lu:
      
          Add keypoint support to the random_pad_image preprocessor method.
      
      --
      235257380  by Zhichao Lu:
      
          Support InputDataFields.groundtruth_confidences in retain_groundtruth(), retain_groundtruth_with_positive_classes(), filter_groundtruth_with_crowd_boxes(), filter_groundtruth_with_nan_box_coordinates(), filter_unrecognized_classes().
      
      --
      235109188  by Zhichao Lu:
      
          Fix bug in pad_input_data_to_static_shapes for num_additional_channels > 0; make color-specific data augmentation only touch RGB channels.
      
      --
      235045010  by Zhichao Lu:
      
          Don't slice class_predictions_with_background when add_background_class is false.
      
      --
      235026189  by lzc:
      
          Fix import in g3doc.
      
      --
      234863426  by Zhichao Lu:
      
          Added fixes in exporter to allow writing a checkpoint to a specified temporary directory.
      
      --
      234671886  by lzc:
      
          Internal Change.
      
      --
      234630803  by rathodv:
      
          Internal Change.
      
      --
      233985896  by Zhichao Lu:
      
          Add Neumann optimizer to object detection.
      
      --
      233560911  by Zhichao Lu:
      
          Add NAS-FPN object detection with Resnet and Mobilenet v2.
      
      --
      233513536  by Zhichao Lu:
      
          Export TPU compatible object detection model
      
      --
      233495772  by lzc:
      
          Internal change.
      
      --
      233453557  by Zhichao Lu:
      
          Create Keras-based SSD+MobilenetV1 for object detection.
      
      --
      233220074  by lzc:
      
          Update release notes date.
      
      --
      233165761  by Zhichao Lu:
      
          Support depth_multiplier and min_depth in _SSDResnetV1FpnFeatureExtractor.
      
      --
      233160046  by lzc:
      
          Internal change.
      
      --
      232926599  by Zhichao Lu:
      
          [tf.data] Switching tf.data functions to use `defun`, providing an escape hatch to continue using the legacy `Defun`.
      
          There are subtle differences between the implementation of `defun` and `Defun` (such as resources handling or control flow) and it is possible that input pipelines that use control flow or resources in their functions might be affected by this change. To migrate majority of existing pipelines to the recommended way of creating functions in TF 2.0 world, while allowing (a small number of) existing pipelines to continue relying on the deprecated behavior, this CL provides an escape hatch.
      
          If your input pipeline is affected by this CL, it should apply the escape hatch by replacing `foo.map(...)` with `foo.map_with_legacy_function(...)`.
      
      --
      232891621  by Zhichao Lu:
      
          Modify faster_rcnn meta architecture to normalize raw detections.
      
      --
      232875817  by Zhichao Lu:
      
          Make calibration a post-processing step.
      
          Specifically:
          - Move the calibration config from pipeline.proto --> post_processing.proto
          - Edit post_processing_builder.py to return a calibration function. If no calibration config is provided, it None.
          - Edit SSD and FasterRCNN meta architectures to optionally call the calibration function on detection scores after score conversion and before NMS.
      
      --
      232704481  by Zhichao Lu:
      
          Edit calibration builder to build a function that will be used within a detection model's `postprocess` method, after score conversion and before non-maxima suppression.
      
          Specific Edits:
          - The returned function now accepts class_predictions_with_background as its argument instead of detection_scores and detection_classes.
          - Class-specific calibration was temporarily removed, as it requires more significant refactoring. Will be added later.
      
      --
      232615379  by Zhichao Lu:
      
          Internal change
      
      --
      232483345  by ronnyvotel:
      
          Making the use of bfloat16 restricted to TPUs.
      
      --
      232399572  by Zhichao Lu:
      
          Edit calibration builder and proto to support class-agnostic calibration.
      
          Specifically:
          - Edit calibration protos to include path to relevant label map if required for class-specific calibration. Previously, label maps were inferred from other parts of the pipeline proto; this allows all information required by the builder stay within the calibration proto and remove extraneous information from being passed with class-agnostic calibration.
          - Add class-agnostic protos to the calibration config.
      
          Note that the proto supports sigmoid and linear interpolation parameters, but the builder currently only supports linear interpolation.
      
      --
      231613048  by Zhichao Lu:
      
          Add calibration builder for applying calibration transformations from output of object detection models.
      
          Specifically:
          - Add calibration proto to support sigmoid and isotonic regression (stepwise function) calibration.
          - Add a builder to support calibration from isotonic regression outputs.
      
      --
      231519786  by lzc:
      
          model_builder test refactor.
          - removed proto text boilerplate in each test case and let them call a create_default_proto function instead.
          - consolidated all separate ssd model creation tests into one.
          - consolidated all separate faster rcnn model creation tests into one.
          - used parameterized test for testing mask rcnn models and use_matmul_crop_and_resize
          - added all failures test.
      
      --
      231448169  by Zhichao Lu:
      
          Return static shape as a constant tensor.
      
      --
      231423126  by lzc:
      
          Add a release note for OID v4 models.
      
      --
      231401941  by Zhichao Lu:
      
          Adding correct labelmap for the models trained on Open Images V4 (*oid_v4
          config suffix).
      
      --
      231320357  by Zhichao Lu:
      
          Add scope to Nearest Neighbor Resize op so that it stays in the same name scope as the original resize ops.
      
      --
      231257699  by Zhichao Lu:
      
          Switch to using preserve_aspect_ratio in tf.image.resize_images rather than using a custom implementation.
      
      --
      231247368  by rathodv:
      
          Internal change.
      
      --
      231004874  by lzc:
      
          Update documentations to use tf 1.12 for object detection API.
      
      --
      230999911  by rathodv:
      
          Use tf.batch_gather instead of ops.batch_gather
      
      --
      230999720  by huizhongc:
      
          Fix weight equalization test in ops_test.
      
      --
      230984728  by rathodv:
      
          Internal update.
      
      --
      230929019  by lzc:
      
          Add an option to replace preprocess operation with placeholder for ssd feature extractor.
      
      --
      230845266  by lzc:
      
          Require tensorflow version 1.12 for object detection API and rename keras_applications to keras_models
      
      --
      230392064  by lzc:
      
          Add RetinaNet 101 checkpoint trained on OID v4 to detection model zoo.
      
      --
      230014128  by derekjchow:
      
          This file was re-located below the tensorflow/lite/g3doc/convert
      
      --
      229941449  by lzc:
      
          Update SSD mobilenet v2 quantized model download path.
      
      --
      229843662  by lzc:
      
          Add an option to use native resize tf op in fpn top-down feature map generation.
      
      --
      229636034  by rathodv:
      
          Add deprecation notice to a few old parameters in train.proto
      
      --
      228959078  by derekjchow:
      
          Remove duplicate elif case in _check_and_convert_legacy_input_config_key
      
      --
      228749719  by rathodv:
      
          Minor refactoring to make exporter's `build_detection_graph` method public.
      
      --
      228573828  by rathodv:
      
          Mofity model.postprocess to return raw detections and raw scores.
      
          Modify, post-process methods in core/model.py and the meta architectures to export raw detection (without any non-max suppression) and raw multiclass score logits for those detections.
      
      --
      228420670  by Zhichao Lu:
      
          Add shims for custom architectures for object detection models.
      
      --
      228241692  by Zhichao Lu:
      
          Fix the comment on "losses_mask" in "Loss" class.
      
      --
      228223810  by Zhichao Lu:
      
          Support other_heads' predictions in WeightSharedConvolutionalBoxPredictor. Also remove a few unused parameters and fix a couple of comments in convolutional_box_predictor.py.
      
      --
      228200588  by Zhichao Lu:
      
          Add Expected Calibration Error and an evaluator that calculates the metric for object detections.
      
      --
      228167740  by lzc:
      
          Add option to use bounded activations in FPN top-down feature map generation.
      
      --
      227767700  by rathodv:
      
          Internal.
      
      --
      226295236  by Zhichao Lu:
      
          Add Open Image V4 Resnet101-FPN training config to third_party
      
      --
      226254842  by Zhichao Lu:
      
          Fix typo in documentation.
      
      --
      225833971  by Zhichao Lu:
      
          Option to have no resizer in object detection model.
      
      --
      225824890  by lzc:
      
          Fixes p3 compatibility for model_lib.py
      
      --
      225760897  by menglong:
      
          normalizer should be at least 1.
      
      --
      225559842  by menglong:
      
          Add extra logic filtering unrecognized classes.
      
      --
      225379421  by lzc:
      
          Add faster_rcnn_inception_resnet_v2_atrous_oid_v4 config to third_party
      
      --
      225368337  by Zhichao Lu:
      
          Add extra logic filtering unrecognized classes.
      
      --
      225341095  by Zhichao Lu:
      
          Adding Open Images V4 models to OD API model zoo and corresponding configs to the
          configs.
      
      --
      225218450  by menglong:
      
          Add extra logic filtering unrecognized classes.
      
      --
      225057591  by Zhichao Lu:
      
          Internal change.
      
      --
      224895417  by rathodv:
      
          Internal change.
      
      --
      224209282  by Zhichao Lu:
      
          Add two data augmentations to object detection: (1) Self-concat (2) Absolute pads.
      
      --
      224073762  by Zhichao Lu:
      
          Do not create tf.constant until _generate() is actually called in the object detector.
      
      --
      
      PiperOrigin-RevId: 236813471
      05584085
  15. 21 Feb, 2019 2 commits
  16. 11 Feb, 2019 1 commit
  17. 10 Feb, 2019 1 commit
  18. 19 Jan, 2019 1 commit
  19. 11 Jan, 2019 1 commit
  20. 04 Jan, 2019 1 commit
  21. 02 Jan, 2019 1 commit
  22. 18 Dec, 2018 1 commit
  23. 30 Nov, 2018 1 commit
    • Zhichao Lu's avatar
      Merged commit includes the following changes: · a1337e01
      Zhichao Lu authored
      223075771  by lzc:
      
          Bring in external fixes.
      
      --
      222919755  by ronnyvotel:
      
          Bug fix in faster r-cnn model builder. Was previously using `inplace_batchnorm_update` for `reuse_weights`.
      
      --
      222885680  by Zhichao Lu:
      
          Use the result_dict_for_batched_example in models_lib
          Also fixes the visualization size on when eval is on GPU
      
      --
      222883648  by Zhichao Lu:
      
          Fix _unmatched_class_label for the _add_background_class == False case in ssd_meta_arch.py.
      
      --
      222836663  by Zhichao Lu:
      
          Adding support for visualizing grayscale images. Without this change, the images are black-red instead of grayscale.
      
      --
      222501978  by Zhichao Lu:
      
          Fix a bug that caused convert_to_grayscale flag not to be respected.
      
      --
      222432846  by richardmunoz:
      
          Fix mapping of groundtruth_confidences from shape [num_boxes] to [num_boxes, num_classes] when the input contains the groundtruth_confidences field.
      
      --
      221725755  by richardmunoz:
      
          Internal change.
      
      --
      221458536  by Zhichao Lu:
      
          Fix saver defer build bug in object detection train codepath.
      
      --
      221391590  by Zhichao Lu:
      
          Add support for group normalization in the object detection API. Just adding MobileNet-v1 SSD currently. This may serve as a road map for other models that wish to support group normalization as an option.
      
      --
      221367993  by Zhichao Lu:
      
          Bug fixes (1) Make RandomPadImage work, (2) Fix keep_checkpoint_every_n_hours.
      
      --
      221266403  by rathodv:
      
          Use detection boxes as proposals to compute correct mask loss in eval jobs.
      
      --
      220845934  by lzc:
      
          Internal change.
      
      --
      220778850  by Zhichao Lu:
      
          Incorporating existing metrics into Estimator framework.
          Should restore:
          -oid_challenge_detection_metrics
          -pascal_voc_detection_metrics
          -weighted_pascal_voc_detection_metrics
          -pascal_voc_instance_segmentation_metrics
          -weighted_pascal_voc_instance_segmentation_metrics
          -oid_V2_detection_metrics
      
      --
      220370391  by alirezafathi:
      
          Adding precision and recall to the metrics.
      
      --
      220321268  by Zhichao Lu:
      
          Allow the option of setting max_examples_to_draw to zero.
      
      --
      220193337  by Zhichao Lu:
      
          This CL fixes a bug where the Keras convolutional box predictor was applying heads in the non-deterministic dict order. The consequence of this bug was that variables were created in non-deterministic orders. This in turn led different workers in a multi-gpu training setup to have slightly different graphs which had variables assigned to mismatched parameter servers. As a result, roughly half of all workers were unable to initialize and did no work, and training time was slowed down approximately 2x.
      
      --
      220136508  by huizhongc:
      
          Add weight equalization loss to SSD meta arch.
      
      --
      220125875  by pengchong:
      
          Rename label_scores to label_weights
      
      --
      219730108  by Zhichao Lu:
      
          Add description of detection_keypoints in postprocessed_tensors to docstring.
      
      --
      219577519  by pengchong:
      
          Support parsing the class confidences and training using them.
      
      --
      219547611  by lzc:
      
          Stop using static shapes in GPU eval jobs.
      
      --
      219536476  by Zhichao Lu:
      
          Migrate TensorFlow Lite out of tensorflow/contrib
      
          This change moves //tensorflow/contrib/lite to //tensorflow/lite in preparation
          for TensorFlow 2.0's deprecation of contrib/. If you refer to TF Lite build
          targets or headers, you will need to update them manually. If you use TF Lite
          from the TensorFlow python package, "tf.contrib.lite" now points to "tf.lite".
          Please update your imports as soon as possible.
      
          For more details, see https://groups.google.com/a/tensorflow.org/forum/#!topic/tflite/iIIXOTOFvwQ
      
          @angersson and @aselle are conducting this migration. Please contact them if
          you have any further questions.
      
      --
      219190083  by Zhichao Lu:
      
          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.
      
      --
      218924451  by pengchong:
      
          Add a new way to assign training targets using groundtruth confidences.
      
      --
      218760524  by chowdhery:
      
          Modify export script to add option for regular NMS in TFLite post-processing op.
      
      --
      
      PiperOrigin-RevId: 223075771
      a1337e01
  24. 27 Nov, 2018 1 commit
  25. 21 Nov, 2018 1 commit
  26. 20 Nov, 2018 1 commit
    • Vyas Adhikari's avatar
      Update running_pets.md · e0320a19
      Vyas Adhikari authored
      Another error appears when an incompatible version of Tensorboard is installed. Need to ensure Tensorboard is 1.9 as well
      e0320a19
  27. 19 Nov, 2018 2 commits
  28. 11 Nov, 2018 1 commit
  29. 02 Nov, 2018 1 commit
    • pkulzc's avatar
      Minor fixes for object detection (#5613) · 31ae57eb
      pkulzc authored
      * Internal change.
      
      PiperOrigin-RevId: 213914693
      
      * Add original_image_spatial_shape tensor in input dictionary to store shape of the original input image
      
      PiperOrigin-RevId: 214018767
      
      * Remove "groundtruth_confidences" from decoders use "groundtruth_weights" to indicate label confidence.
      
      This also solves a bug that only surfaced now - random crop routines in core/preprocessor.py did not correctly handle "groundtruth_weight" tensors returned by the decoders.
      
      PiperOrigin-RevId: 214091843
      
      * Update CocoMaskEvaluator to allow for a batch of image info, rather than a single image.
      
      PiperOrigin-RevId: 214295305
      
      * Adding the option to be able to summarize gradients.
      
      PiperOrigin-RevId: 214310875
      
      * Adds FasterRCNN inference on CPU
      
      1. Adds a flag use_static_shapes_for_eval to restrict to the ops that guarantees static shape.
      2. No filtering of overlapping anchors while clipping the anchors when use_static_shapes_for_eval is set to True.
      3. Adds test for faster_rcnn_meta_arch for predict and postprocess in inference mode for first and second stages.
      
      PiperOrigin-RevId: 214329565
      
      * Fix model_lib eval_spec_names assignment (integer->string).
      
      PiperOrigin-RevId: 214335461
      
      * Refactor Mask HEAD to optionally upsample after applying convolutions on ROI crops.
      
      PiperOrigin-RevId: 214338440
      
      * Uses final_exporter_name as exporter_name for the first eval spec for backward compatibility.
      
      PiperOrigin-RevId: 214522032
      
      * Add reshaped `mask_predictions` tensor to the prediction dictionary in `_predict_third_stage` method to allow computing mask loss in eval job.
      
      PiperOrigin-RevId: 214620716
      
      * Add support for fully conv training to fpn.
      
      PiperOrigin-RevId: 214626274
      
      * Fix the proprocess() function in Resnet v1 to make it work for any number of input channels.
      
      Note: If the #channels != 3, this will simply skip the mean subtraction in preprocess() function.
      PiperOrigin-RevId: 214635428
      
      * Wrap result_dict_for_single_example in eval_util to run for batched examples.
      
      PiperOrigin-RevId: 214678514
      
      * Adds PNASNet-based (ImageNet model) feature extractor for SSD.
      
      PiperOrigin-RevId: 214988331
      
      * Update documentation
      
      PiperOrigin-RevId: 215243502
      
      * Correct index used to compute number of groundtruth/detection boxes in COCOMaskEvaluator.
      
      Due to an incorrect indexing in cl/214295305 only the first detection mask and first groundtruth mask for a given image are fed to the COCO Mask evaluation library. Since groundtruth masks are arranged in no particular order, the first and highest scoring detection mask (detection masks are ordered by score) won't match the the first and only groundtruth retained in all cases. This is I think why mask evaluation metrics do not get better than ~11 mAP. Note that this code path is only active when using model_main.py binary for evaluation.
      
      This change fixes the indices and modifies an existing test case to cover it.
      
      PiperOrigin-RevId: 215275936
      
      * Fixing grayscale_image_resizer to accept mask as input.
      
      PiperOrigin-RevId: 215345836
      
      * Add an option not to clip groundtruth boxes during preprocessing. Clipping boxes adversely affects training for partially occluded or large objects, especially for fully conv models. Clipping already occurs during postprocessing, and should not occur during training.
      
      PiperOrigin-RevId: 215613379
      
      * Always return recalls and precisions with length equal to the number of classes.
      
      The previous behavior of ObjectDetectionEvaluation was somewhat dangerous: when no groundtruth boxes were present, the lists of per-class precisions and recalls were simply truncated. Unless you were aware of this phenomenon (and consulted the `num_gt_instances_per_class` vector) it was difficult to associate each metric with each class.
      
      PiperOrigin-RevId: 215633711
      
      * Expose the box feature node in SSD.
      
      PiperOrigin-RevId: 215653316
      
      * Fix ssd mobilenet v2 _CONV_DEFS overwriting issue.
      
      PiperOrigin-RevId: 215654160
      
      * More documentation updates
      
      PiperOrigin-RevId: 215656580
      
      * Add pooling + residual option in multi_resolution_feature_maps. It adds an average pooling and a residual layer between feature maps with matching depth. Designed to be used with WeightSharedBoxPredictor.
      
      PiperOrigin-RevId: 215665619
      
      * Only call create_modificed_mobilenet_config on init if use_depthwise is true.
      
      PiperOrigin-RevId: 215784290
      
      * Only call create_modificed_mobilenet_config on init if use_depthwise is true.
      
      PiperOrigin-RevId: 215837524
      
      * Don't prune keypoints if clip_boxes is false.
      
      PiperOrigin-RevId: 216187642
      
      * Makes sure "key" field exists in the result dictionary.
      
      PiperOrigin-RevId: 216456543
      
      * Add add_background_class parameter to allow disabling the inclusion of a background class.
      
      PiperOrigin-RevId: 216567612
      
      * Update expected_classification_loss_under_sampling to better account for expected sampling.
      
      PiperOrigin-RevId: 216712287
      
      * Let the evaluation receive a evaluation class in its constructor.
      
      PiperOrigin-RevId: 216769374
      
      * This CL adds model building & training support for end-to-end Keras-based SSD models. If a Keras feature extractor's name is specified in the model config (e.g. 'ssd_mobilenet_v2_keras'), the model will use that feature extractor and a corresponding Keras-based box predictor.
      
      This CL makes sure regularization losses & batch norm updates work correctly when training models that have Keras-based components. It also updates the default hyperparameter settings of the keras-based mobilenetV2 (when not overriding hyperparams) to more closely match the legacy Slim training scope.
      
      PiperOrigin-RevId: 216938707
      
      * Adding the ability in the coco evaluator to indicate whether an image has been annotated. For a non-annotated image, detections and groundtruth are not supplied.
      
      PiperOrigin-RevId: 217316342
      
      * Release the 8k minival dataset ids for MSCOCO, used in Huang et al. "Speed/accuracy trade-offs for modern convolutional object detectors" (https://arxiv.org/abs/1611.10012)
      
      PiperOrigin-RevId: 217549353
      
      * Exposes weighted_sigmoid_focal loss for faster rcnn classifier
      
      PiperOrigin-RevId: 217601740
      
      * Add detection_features to output nodes. The shape of the feature is [batch_size, max_detections, depth].
      
      PiperOrigin-RevId: 217629905
      
      * FPN uses a custom NN resize op for TPU-compatibility. Replace this op with the Tensorflow version at export time for TFLite-compatibility.
      
      PiperOrigin-RevId: 217721184
      
      * Compute `num_groundtruth_boxes` in inputs.tranform_input_data_fn after data augmentation instead of decoders.
      
      PiperOrigin-RevId: 217733432
      
      * 1. Stop gradients from flowing into groundtruth masks with zero paddings.
      2. Normalize pixelwise cross entropy loss across the whole batch.
      
      PiperOrigin-RevId: 217735114
      
      * Optimize Input pipeline for Mask R-CNN on TPU with blfoat16: improve the step time from:
      1663.6 ms -> 1184.2 ms, about 28.8% improvement.
      
      PiperOrigin-RevId: 217748833
      
      * Fixes to export a TPU compatible model
      
      Adds nodes to each of the output tensor. Also increments the value of class labels by 1.
      
      PiperOrigin-RevId: 217856760
      
      * API changes:
       - change the interface of target assigner to return per-class weights.
       - change the interface of classification loss to take per-class weights.
      
      PiperOrigin-RevId: 217968393
      
      * Add an option to override pipeline config in export_saved_model using command line arg
      
      PiperOrigin-RevId: 218429292
      
      * Include Quantized trained MobileNet V2 SSD and FaceSsd in model zoo.
      
      PiperOrigin-RevId: 218530947
      
      * Write final config to disk in `train` mode only.
      
      PiperOrigin-RevId: 218735512
      31ae57eb
  30. 30 Sep, 2018 1 commit
  31. 25 Sep, 2018 1 commit
    • pkulzc's avatar
      Update slim and fix minor issue in object detection (#5354) · f505cecd
      pkulzc authored
      * Merged commit includes the following changes:
      213899768  by Sergio Guadarrama:
      
          Fixes #3819.
      
      --
      213493831  by Sergio Guadarrama:
      
          Internal change
      
      212057654  by Sergio Guadarrama:
      
          Internal change
      
      210747685  by Sergio Guadarrama:
      
          For FPN, when use_depthwise is set to true, use slightly modified mobilenet v1 config.
      
      --
      210128931  by Sergio Guadarrama:
      
          Allow user-defined current_step in NASNet.
      
      --
      209092664  by Sergio Guadarrama:
      
          Add quantized fine-tuning / training / eval and export to slim image classifier binaries.
      
      --
      207651347  by Sergio Guadarrama:
      
          Update mobilenet v1 docs to include revised tflite models.
      
      --
      207165245  by Sergio Guadarrama:
      
          Internal change
      
      207095064  by Sergio Guadarrama:
      
          Internal change
      
      PiperOrigin-RevId: 213899768
      
      * Update model_lib.py to fix eval_spec name issue.
      f505cecd
  32. 23 Sep, 2018 1 commit
  33. 21 Sep, 2018 3 commits
    • pkulzc's avatar
      Minor fixes for object detection. · 1f484095
      pkulzc authored
      214018767  by Zhichao Lu:
      
          Add original_image_spatial_shape tensor in input dictionary to store shape of the original input image
      
      --
      213914693  by lzc:
      
          Internal change.
      
      --
      213872175  by Zhichao Lu:
      
          This CL adds a Keras-based mobilenet_v2 feature extractor for object detection models.
      
          As part of this CL, we use the Keras mobilenet_v2 application's keyword argument layer injection API to allow the generated network to support the object detection hyperparameters.
      
      --
      213848499  by Zhichao Lu:
      
          Replace tf.image.resize_nearest_neighbor with tf.image.resize_images. tf.image.resize_nearest_neighbor only supports 4-D tensors but masks is a 3-D tensor.
      
      --
      213758622  by lzc:
      
          Internal change.
      
      --
      
      PiperOrigin-RevId: 214018767
      1f484095
    • pkulzc's avatar
      Release iNaturalist Species-trained models, refactor of evaluation, box... · 99256cf4
      pkulzc authored
      Release iNaturalist Species-trained models, refactor of evaluation, box predictor for object detection. (#5289)
      
      * Merged commit includes the following changes:
      212389173  by Zhichao Lu:
      
          1. Replace tf.boolean_mask with tf.where
      
      --
      212282646  by Zhichao Lu:
      
          1. Fix a typo in model_builder.py and add a test to cover it.
      
      --
      212142989  by Zhichao Lu:
      
          Only resize masks in meta architecture if it has not already been resized in the input pipeline.
      
      --
      212136935  by Zhichao Lu:
      
          Choose matmul or native crop_and_resize in the model builder instead of faster r-cnn meta architecture.
      
      --
      211907984  by Zhichao Lu:
      
          Make eval input reader repeated field and update config util to handle this field.
      
      --
      211858098  by Zhichao Lu:
      
          Change the implementation of merge_boxes_with_multiple_labels.
      
      --
      211843915  by Zhichao Lu:
      
          Add Mobilenet v2 + FPN support.
      
      --
      211655076  by Zhichao Lu:
      
          Bug fix for generic keys in config overrides
      
          In generic configuration overrides, we had a duplicate entry for train_input_config and we were missing the eval_input_config and eval_config.
      
          This change also introduces testing for all config overrides.
      
      --
      211157501  by Zhichao Lu:
      
          Make the locally-modified conv defs a copy.
      
          So that it doesn't modify MobileNet conv defs globally for other code that
          transitively imports this package.
      
      --
      211112813  by Zhichao Lu:
      
          Refactoring visualization tools for Estimator's eval_metric_ops. This will make it easier for future models to take advantage of a single interface and mechanics.
      
      --
      211109571  by Zhichao Lu:
      
          A test decorator.
      
      --
      210747685  by Zhichao Lu:
      
          For FPN, when use_depthwise is set to true, use slightly modified mobilenet v1 config.
      
      --
      210723882  by Zhichao Lu:
      
          Integrating the losses mask into the meta architectures. When providing groundtruth, one can optionally specify annotation information (i.e. which images are labeled vs. unlabeled). For any image that is unlabeled, there is no loss accumulation.
      
      --
      210673675  by Zhichao Lu:
      
          Internal change.
      
      --
      210546590  by Zhichao Lu:
      
          Internal change.
      
      --
      210529752  by Zhichao Lu:
      
          Support batched inputs with ops.matmul_crop_and_resize.
      
          With this change the new inputs are images of shape [batch, heigh, width, depth] and boxes of shape [batch, num_boxes, 4]. The output tensor is of the shape [batch, num_boxes, crop_height, crop_width, depth].
      
      --
      210485912  by Zhichao Lu:
      
          Fix TensorFlow version check in object_detection_tutorial.ipynb
      
      --
      210484076  by Zhichao Lu:
      
          Reduce TPU memory required for single image matmul_crop_and_resize.
      
          Using tf.einsum eliminates intermediate tensors, tiling and expansion. for an image of size [40, 40, 1024] and boxes of shape [300, 4] HBM memory usage goes down from 3.52G to 1.67G.
      
      --
      210468361  by Zhichao Lu:
      
          Remove PositiveAnchorLossCDF/NegativeAnchorLossCDF to resolve "Main thread is not in main loop error" issue in local training.
      
      --
      210100253  by Zhichao Lu:
      
          Pooling pyramid feature maps: add option to replace max pool with convolution layers.
      
      --
      209995842  by Zhichao Lu:
      
          Fix a bug which prevents variable sharing in Faster RCNN.
      
      --
      209965526  by Zhichao Lu:
      
          Add support for enabling export_to_tpu through the estimator.
      
      --
      209946440  by Zhichao Lu:
      
          Replace deprecated tf.train.Supervisor with tf.train.MonitoredSession. MonitoredSession also takes away the hassle of starting queue runners.
      
      --
      209888003  by Zhichao Lu:
      
          Implement function to handle data where source_id is not set.
      
          If the field source_id is found to be the empty string for any image during runtime, it will be replaced with a random string. This avoids hash-collisions on dataset where many examples do not have source_id set. Those hash-collisions have unintended site effects and may lead to bugs in the detection pipeline.
      
      --
      209842134  by Zhichao Lu:
      
          Converting loss mask into multiplier, rather than using it as a boolean mask (which changes tensor shape). This is necessary, since other utilities (e.g. hard example miner) require a loss matrix with the same dimensions as the original prediction tensor.
      
      --
      209768066  by Zhichao Lu:
      
          Adding ability to remove loss computation from specific images in a batch, via an optional boolean mask.
      
      --
      209722556  by Zhichao Lu:
      
          Remove dead code.
      
          (_USE_C_API was flipped to True by default in TensorFlow 1.8)
      
      --
      209701861  by Zhichao Lu:
      
          This CL cleans-up some tf.Example creation snippets, by reusing the convenient tf.train.Feature building functions in dataset_util.
      
      --
      209697893  by Zhichao Lu:
      
          Do not overwrite num_epoch for eval input. This leads to errors in some cases.
      
      --
      209694652  by Zhichao Lu:
      
          Sample boxes by jittering around the currently given boxes.
      
      --
      209550300  by Zhichao Lu:
      
          `create_category_index_from_labelmap()` function now accepts `use_display_name` parameter.
          Also added create_categories_from_labelmap function for convenience
      
      --
      209490273  by Zhichao Lu:
      
          Check result_dict type before accessing image_id via key.
      
      --
      209442529  by Zhichao Lu:
      
          Introducing the capability to sample examples for evaluation. This makes it easy to specify one full epoch of evaluation, or a subset (e.g. sample 1 of every N examples).
      
      --
      208941150  by Zhichao Lu:
      
          Adding the capability of exporting the results in json format.
      
      --
      208888798  by Zhichao Lu:
      
          Fixes wrong dictionary key for num_det_boxes_per_image.
      
      --
      208873549  by Zhichao Lu:
      
          Reduce the number of HLO ops created by matmul_crop_and_resize.
      
          Do not unroll along the channels dimension. Instead, transpose the input image dimensions, apply tf.matmul and transpose back.
      
          The number of HLO instructions for 1024 channels reduce from 12368 to 110.
      
      --
      208844315  by Zhichao Lu:
      
          Add an option to use tf.non_maximal_supression_padded in SSD post-process
      
      --
      208731380  by Zhichao Lu:
      
          Add field in box_predictor config to enable mask prediction and update builders accordingly.
      
      --
      208699405  by Zhichao Lu:
      
          This CL creates a keras-based multi-resolution feature map extractor.
      
      --
      208557208  by Zhichao Lu:
      
          Add TPU tests for Faster R-CNN Meta arch.
      
          * Tests that two_stage_predict and total_loss tests run successfully on TPU.
          * Small mods to multiclass_non_max_suppression to preserve static shapes.
      
      --
      208499278  by Zhichao Lu:
      
          This CL makes sure the Keras convolutional box predictor & head layers apply activation layers *after* normalization (as opposed to before).
      
      --
      208391694  by Zhichao Lu:
      
          Updating visualization tool to produce multiple evaluation images.
      
      --
      208275961  by Zhichao Lu:
      
          This CL adds a Keras version of the Convolutional Box Predictor, as well as more general infrastructure for making Keras Prediction heads & Keras box predictors.
      
      --
      208275585  by Zhichao Lu:
      
          This CL enables the Keras layer hyperparameter object to build a dedicated activation layer, and to disable activation by default in the op layer construction kwargs.
      
          This is necessary because in most cases the normalization layer must be applied before the activation layer. So, in Keras models we must set the convolution activation in a dedicated layer after normalization is applied, rather than setting it in the convolution layer construction args.
      
      --
      208263792  by Zhichao Lu:
      
          Add a new SSD mask meta arch that can predict masks for SSD models.
          Changes including:
           - overwrite loss function to add mask loss computation.
           - update ssd_meta_arch to handle masks if predicted in predict and postprocessing.
      
      --
      208000218  by Zhichao Lu:
      
          Make FasterRCNN choose static shape operations only in training mode.
      
      --
      207997797  by Zhichao Lu:
      
          Add static boolean_mask op to box_list_ops.py and use that in faster_rcnn_meta_arch.py to support use_static_shapes option.
      
      --
      207993460  by Zhichao Lu:
      
          Include FGVC detection models in model zoo.
      
      --
      207971213  by Zhichao Lu:
      
          remove the restriction to run tf.nn.top_k op on CPU
      
      --
      207961187  by Zhichao Lu:
      
          Build the first stage NMS function in the model builder and pass it to FasterRCNN meta arch.
      
      --
      207960608  by Zhichao Lu:
      
          Internal Change.
      
      --
      207927015  by Zhichao Lu:
      
          Have an option to use the TPU compatible NMS op cl/206673787, in the batch_multiclass_non_max_suppression function. On setting pad_to_max_output_size to true, the output nmsed boxes are padded to be of length max_size_per_class.
      
          This can be used in first stage Region Proposal Network in FasterRCNN model by setting the first_stage_nms_pad_to_max_proposals field to true in config proto.
      
      --
      207809668  by Zhichao Lu:
      
          Add option to use depthwise separable conv instead of conv2d in FPN and WeightSharedBoxPredictor. More specifically, there are two related configs:
          - SsdFeatureExtractor.use_depthwise
          - WeightSharedConvolutionalBoxPredictor.use_depthwise
      
      --
      207808651  by Zhichao Lu:
      
          Fix the static balanced positive negative sampler's TPU tests
      
      --
      207798658  by Zhichao Lu:
      
          Fixes a post-refactoring bug where the pre-prediction convolution layers in the convolutional box predictor are ignored.
      
      --
      207796470  by Zhichao Lu:
      
          Make slim endpoints visible in FasterRCNNMetaArch.
      
      --
      207787053  by Zhichao Lu:
      
          Refactor ssd_meta_arch so that the target assigner instance is passed into the SSDMetaArch constructor rather than constructed inside.
      
      --
      
      PiperOrigin-RevId: 212389173
      
      * Fix detection model zoo typo.
      
      * Modify tf example decoder to handle label maps with either `display_name` or `name` fields seamlessly.
      
      Currently, tf example decoder uses only `name` field to look up ids for class text field present in the data. This change uses both `display_name` and `name` fields in the label map to fetch ids for class text.
      
      PiperOrigin-RevId: 212672223
      
      * Modify create_coco_tf_record tool to write out class text instead of class labels.
      
      PiperOrigin-RevId: 212679112
      
      * Fix detection model zoo typo.
      
      PiperOrigin-RevId: 212715692
      
      * Adding the following two optional flags to WeightSharedConvolutionalBoxHead:
      1) In the box head, apply clipping to box encodings in the box head.
      2) In the class head, apply sigmoid to class predictions at inference time.
      
      PiperOrigin-RevId: 212723242
      
      * Support class confidences in merge boxes with multiple labels.
      
      PiperOrigin-RevId: 212884998
      
      * Creates multiple eval specs for object detection.
      
      PiperOrigin-RevId: 212894556
      
      * Set batch_norm on last layer in Mask Head to None.
      
      PiperOrigin-RevId: 213030087
      
      * Enable bfloat16 training for object detection models.
      
      PiperOrigin-RevId: 213053547
      
      * Skip padding op when unnecessary.
      
      PiperOrigin-RevId: 213065869
      
      * Modify `Matchers` to use groundtruth weights before performing matching.
      
      Groundtruth weights tensor is used to indicate padding in groundtruth box tensor. It is handled in `TargetAssigner` by creating appropriate classification and regression target weights based on the groundtruth box each anchor matches to. However, options such as `force_match_all_rows` in `ArgmaxMatcher` force certain anchors to match to groundtruth boxes that are just paddings thereby reducing the number of anchors that could otherwise match to real groundtruth boxes.
      
      For single stage models like SSD the effect of this is negligible as there are two orders of magnitude more anchors than the number of padded groundtruth boxes. But for Faster R-CNN and Mask R-CNN where there are only 300 anchors in the second stage, a significant number of these match to groundtruth paddings reducing the number of anchors regressing to real groundtruth boxes degrading the performance severely.
      
      Therefore, this change introduces an additional boolean argument `valid_rows` to `Matcher.match` methods and the implementations now ignore such padded groudtruth boxes during matching.
      
      PiperOrigin-RevId: 213345395
      
      * Add release note for iNaturalist Species trained models.
      
      PiperOrigin-RevId: 213347179
      
      * Fix the bug of uninitialized gt_is_crowd_list variable.
      
      PiperOrigin-RevId: 213364858
      
      * ...text exposed to open source public git repo...
      
      PiperOrigin-RevId: 213554260
      99256cf4
    • Feynman Liang's avatar
      20da786b
  34. 19 Sep, 2018 1 commit
  35. 27 Aug, 2018 1 commit