Commit 02c38f26 authored by Yuxin Wu's avatar Yuxin Wu

Fix TF version of imagenet loader (fix #1085)

parent 78595e71
...@@ -8,7 +8,7 @@ following object detection / instance segmentation papers: ...@@ -8,7 +8,7 @@ following object detection / instance segmentation papers:
+ [Cascade R-CNN: Delving into High Quality Object Detection](https://arxiv.org/abs/1712.00726) + [Cascade R-CNN: Delving into High Quality Object Detection](https://arxiv.org/abs/1712.00726)
with the support of: with the support of:
+ Multi-GPU / distributed training, multi-GPU evaluation + Multi-GPU / multi-node distributed training, multi-GPU evaluation
+ Cross-GPU BatchNorm (aka Sync-BN, from [MegDet: A Large Mini-Batch Object Detector](https://arxiv.org/abs/1711.07240)) + Cross-GPU BatchNorm (aka Sync-BN, from [MegDet: A Large Mini-Batch Object Detector](https://arxiv.org/abs/1711.07240))
+ [Group Normalization](https://arxiv.org/abs/1803.08494) + [Group Normalization](https://arxiv.org/abs/1803.08494)
+ Training from scratch (from [Rethinking ImageNet Pre-training](https://arxiv.org/abs/1811.08883)) + Training from scratch (from [Rethinking ImageNet Pre-training](https://arxiv.org/abs/1811.08883))
...@@ -46,7 +46,7 @@ to `annotations/` as well. ...@@ -46,7 +46,7 @@ to `annotations/` as well.
## Usage ## Usage
### Train: ### Train:
On a single machine: To train on a single machine:
``` ```
./train.py --config \ ./train.py --config \
MODE_MASK=True MODE_FPN=True \ MODE_MASK=True MODE_FPN=True \
...@@ -82,7 +82,8 @@ All models are fine-tuned from ImageNet pre-trained R50/R101 models in ...@@ -82,7 +82,8 @@ All models are fine-tuned from ImageNet pre-trained R50/R101 models in
[tensorpack model zoo](http://models.tensorpack.com/FasterRCNN/), unless otherwise noted. [tensorpack model zoo](http://models.tensorpack.com/FasterRCNN/), unless otherwise noted.
All models are trained with 8 NVIDIA V100s, unless otherwise noted. All models are trained with 8 NVIDIA V100s, unless otherwise noted.
Performance in [Detectron](https://github.com/facebookresearch/Detectron/) can be roughly reproduced. Performance in [Detectron](https://github.com/facebookresearch/Detectron/) can
be approximately reproduced.
| Backbone | mAP<br/>(box;mask) | Detectron mAP <sup>[1](#ft1)</sup><br/> (box;mask) | Time (on 8 V100s) | Configurations <br/> (click to expand) | | Backbone | mAP<br/>(box;mask) | Detectron mAP <sup>[1](#ft1)</sup><br/> (box;mask) | Time (on 8 V100s) | Configurations <br/> (click to expand) |
| - | - | - | - | - | | - | - | - | - | - |
...@@ -108,8 +109,9 @@ Performance in [Detectron](https://github.com/facebookresearch/Detectron/) can b ...@@ -108,8 +109,9 @@ Performance in [Detectron](https://github.com/facebookresearch/Detectron/) can b
[R101FPN9xGNCasAugScratch]: http://models.tensorpack.com/FasterRCNN/COCO-R101FPN-MaskRCNN-ScratchGN.npz [R101FPN9xGNCasAugScratch]: http://models.tensorpack.com/FasterRCNN/COCO-R101FPN-MaskRCNN-ScratchGN.npz
<a id="ft1">1</a>: Numbers taken from [Detectron Model Zoo](https://github.com/facebookresearch/Detectron/blob/master/MODEL_ZOO.md). <a id="ft1">1</a>: Numbers taken from [Detectron Model Zoo](https://github.com/facebookresearch/Detectron/blob/master/MODEL_ZOO.md).
We compare models that have identical training & inference cost between the two implementations. However their numbers can be different due to many small implementation details. We compare models that have identical training & inference cost between the two implementations. Their numbers can be different due to many small implementation details.
For example, our FPN models are sometimes slightly worse in box AP, which is probably due to batch size. For example, our FPN models are sometimes slightly worse in box AP, which is
mainly due to batch size.
<a id="ft2">2</a>: Numbers taken from Table 5 in [Group Normalization](https://arxiv.org/abs/1803.08494) <a id="ft2">2</a>: Numbers taken from Table 5 in [Group Normalization](https://arxiv.org/abs/1803.08494)
......
...@@ -202,7 +202,7 @@ def fbresnet_mapper(isTrain): ...@@ -202,7 +202,7 @@ def fbresnet_mapper(isTrain):
return image return image
def lighting(image, std, eigval, eigvec): def lighting(image, std, eigval, eigvec):
v = tf.random_uniform(shape=[3]) * std * eigval v = tf.random_normal(shape=[3], stddev=std) * eigval
inc = tf.matmul(eigvec, tf.reshape(v, [3, 1])) inc = tf.matmul(eigvec, tf.reshape(v, [3, 1]))
image = tf.cast(tf.cast(image, tf.float32) + tf.reshape(inc, [3]), image.dtype) image = tf.cast(tf.cast(image, tf.float32) + tf.reshape(inc, [3]), image.dtype)
return image return image
......
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