"...git@developer.sourcefind.cn:OpenDAS/mmdetection3d.git" did not exist on "d1b9ae40f336caa7c1fc4fbd866d734765a6b674"
Unverified Commit 493d7a2e authored by Qianli Scott Zhu's avatar Qianli Scott Zhu Committed by GitHub
Browse files

Fix resnet missing layers. (#4254)

* Fix resnet missing layers.

The official v1 model contains BN and Relu between input layer and
pooling.

* Remove the BN and Relu for V2.

After some discussion with team and refer to existing
implementation, those two layer seems to be only useful in V1.
In V2, the first unit of the block will have a projection, that
apply the BN and Relu for the shortcut. Adding a comment to make
this clear.

* Expand the comment section.

* Remove the pre-trained checkpoint since its broken right now.

Will restore it once we have new checkpoint generated.
parent 0344c550
...@@ -50,15 +50,6 @@ The model will begin training and will automatically evaluate itself on the vali ...@@ -50,15 +50,6 @@ The model will begin training and will automatically evaluate itself on the vali
Note that there are a number of other options you can specify, including `--model_dir` to choose where to store the model and `--resnet_size` to choose the model size (options include ResNet-18 through ResNet-200). See [`resnet.py`](resnet.py) for the full list of options. Note that there are a number of other options you can specify, including `--model_dir` to choose where to store the model and `--resnet_size` to choose the model size (options include ResNet-18 through ResNet-200). See [`resnet.py`](resnet.py) for the full list of options.
### Pre-trained model
You can download 190 MB pre-trained versions of ResNet-50 achieving 76.3% and 75.3% (respectively) top-1 single-crop accuracy here: [resnetv2_imagenet_checkpoint.tar.gz](http://download.tensorflow.org/models/official/resnetv2_imagenet_checkpoint.tar.gz), [resnetv1_imagenet_checkpoint.tar.gz](http://download.tensorflow.org/models/official/resnetv1_imagenet_checkpoint.tar.gz). Simply download and uncompress the file, and point the model to the extracted directory using the `--model_dir` flag.
Other versions and formats:
* [ResNet-v2-ImageNet Checkpoint](http://download.tensorflow.org/models/official/resnet_v2_imagenet_checkpoint.tar.gz)
* [ResNet-v2-ImageNet SavedModel](http://download.tensorflow.org/models/official/resnet_v2_imagenet_savedmodel.tar.gz)
* [ResNet-v1-ImageNet Checkpoint](http://download.tensorflow.org/models/official/resnet_v1_imagenet_checkpoint.tar.gz)
* [ResNet-v1-ImageNet SavedModel](http://download.tensorflow.org/models/official/resnet_v1_imagenet_savedmodel.tar.gz)
## Compute Devices ## Compute Devices
Training is accomplished using the DistributionStrategies API. (https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/distribute/README.md) Training is accomplished using the DistributionStrategies API. (https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/distribute/README.md)
......
...@@ -504,6 +504,14 @@ class Model(object): ...@@ -504,6 +504,14 @@ class Model(object):
strides=self.conv_stride, data_format=self.data_format) strides=self.conv_stride, data_format=self.data_format)
inputs = tf.identity(inputs, 'initial_conv') inputs = tf.identity(inputs, 'initial_conv')
# We do not include batch normalization or activation functions in V2
# for the initial conv1 because the first ResNet unit will perform these
# for both the shortcut and non-shortcut paths as part of the first
# block's projection. Cf. Appendix of [2].
if self.resnet_version == 1:
inputs = batch_norm(inputs, training, self.data_format)
inputs = tf.nn.relu(inputs)
if self.first_pool_size: if self.first_pool_size:
inputs = tf.layers.max_pooling2d( inputs = tf.layers.max_pooling2d(
inputs=inputs, pool_size=self.first_pool_size, inputs=inputs, pool_size=self.first_pool_size,
......
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