@@ -20,58 +20,12 @@ prerequisites.
20
20
$ git clone https://github.com/tensorflow/models.git
21
21
$ cd models
22
22
$ pip3 install -r official/requirements.txt
23
+ $ export PYTHONPATH=$( pwd)
23
24
```
24
25
25
26
## Preparing Dataset
26
- ### Download and extract COCO dataset
27
27
``` bash
28
- $ sudo apt update
29
- $ sudo apt install unzip aria2 -y
30
-
31
- $ export DATA_DIR=< path-to-store-tfrecords>
32
- $ aria2c -j 8 -Z \
33
- http://images.cocodataset.org/annotations/annotations_trainval2017.zip \
34
- http://images.cocodataset.org/annotations/panoptic_annotations_trainval2017.zip \
35
- http://images.cocodataset.org/zips/train2017.zip \
36
- http://images.cocodataset.org/zips/val2017.zip \
37
- --dir=$DATA_DIR ;
38
-
39
- $ unzip $DATA_DIR /" *" .zip -d $DATA_DIR ;
40
- $ mkdir $DATA_DIR /zips && mv $DATA_DIR /* .zip $DATA_DIR /zips;
41
- $ unzip $DATA_DIR /annotations/panoptic_train2017.zip -d $DATA_DIR
42
- $ unzip $DATA_DIR /annotations/panoptic_val2017.zip -d $DATA_DIR
43
- ```
44
-
45
- ### Create TFrecords
46
- ``` bash
47
- $ cd official/vision/beta/data
48
-
49
- $ python3 create_coco_tf_record.py \
50
- --logtostderr \
51
- --image_dir=" $DATA_DIR /val2017" \
52
- --object_annotations_file=" $DATA_DIR /annotations/instances_val2017.json" \
53
- --output_file_prefix=" $DATA_DIR /tfrecords/val" \
54
- --panoptic_annotations_file=" $DATA_DIR /annotations/panoptic_val2017.json" \
55
- --panoptic_masks_dir=" $DATA_DIR /panoptic_val2017" \
56
- --num_shards=8 \
57
- --include_masks \
58
- --include_panoptic_masks
59
-
60
-
61
- $ python3 create_coco_tf_record.py \
62
- --logtostderr \
63
- --image_dir=" $DATA_DIR /train2017" \
64
- --object_annotations_file=" $DATA_DIR /annotations/instances_train2017.json" \
65
- --output_file_prefix=" $DATA_DIR /tfrecords/train" \
66
- --panoptic_annotations_file=" $DATA_DIR /annotations/panoptic_train2017.json" \
67
- --panoptic_masks_dir=" $DATA_DIR /panoptic_train2017" \
68
- --num_shards=32 \
69
- --include_masks \
70
- --include_panoptic_masks
71
- ```
72
- ### Upload tfrecords to a Google Cloud Storage Bucket
73
- ``` bash
74
- $ gsutil -m cp -r " $DATA_DIR /tfrecords" gs://< bucket-details>
28
+ $ ./official/vision/beta/data/process_coco_panoptic.sh < path-to-data-directory>
75
29
```
76
30
77
31
## Launch Training
@@ -82,9 +36,9 @@ $ export ANNOTATION_FILE="gs://<path-to-coco-annotation-json>"
82
36
$ export TRAIN_DATA=" gs://<path-to-train-data>"
83
37
$ export EVAL_DATA=" gs://<path-to-eval-data>"
84
38
$ export OVERRIDES=" task.validation_data.input_path=${EVAL_DATA} ,\
85
- task.train_data.input_path=${TRAIN_DATA} ,\
86
- task.annotation_file=${ANNOTATION_FILE} ,\
87
- runtime.distribution_strategy=tpu"
39
+ task.train_data.input_path=${TRAIN_DATA} ,\
40
+ task.annotation_file=${ANNOTATION_FILE} ,\
41
+ runtime.distribution_strategy=tpu"
88
42
89
43
90
44
$ python3 train.py \
@@ -104,11 +58,11 @@ $ export ANNOTATION_FILE="gs://<path-to-coco-annotation-json>"
104
58
$ export TRAIN_DATA=" gs://<path-to-train-data>"
105
59
$ export EVAL_DATA=" gs://<path-to-eval-data>"
106
60
$ export OVERRIDES=" task.validation_data.input_path=${EVAL_DATA} , \
107
- task.train_data.input_path=${TRAIN_DATA} , \
108
- task.annotation_file=${ANNOTATION_FILE} , \
109
- runtime.distribution_strategy=mirrored, \
110
- runtime.mixed_precision_dtype=$PRECISION , \
111
- runtime.num_gpus=$NUM_GPUS "
61
+ task.train_data.input_path=${TRAIN_DATA} , \
62
+ task.annotation_file=${ANNOTATION_FILE} , \
63
+ runtime.distribution_strategy=mirrored, \
64
+ runtime.mixed_precision_dtype=$PRECISION , \
65
+ runtime.num_gpus=$NUM_GPUS "
112
66
113
67
114
68
$ python3 train.py \
@@ -117,7 +71,7 @@ $ python3 train.py \
117
71
--model_dir $MODEL_DIR \
118
72
--params_override=$OVERRIDES
119
73
```
120
- ** Note** : The [ PanopticSegmentationGenerator] ( https://github.com/tensorflow/models/blob/ac7f9e7f2d0508913947242bad3e23ef7cae5a43/official/vision/beta/projects/panoptic_maskrcnn/modeling/layers/panoptic_segmentation_generator.py#L22 ) layer uses dynamic shapes and hence generating panoptic masks is not supported on Cloud TPUs. Running evaluation on Cloud TPUs is not supported for the same reson.
74
+ ** Note** : The [ PanopticSegmentationGenerator] ( https://github.com/tensorflow/models/blob/ac7f9e7f2d0508913947242bad3e23ef7cae5a43/official/vision/beta/projects/panoptic_maskrcnn/modeling/layers/panoptic_segmentation_generator.py#L22 ) layer uses dynamic shapes and hence generating panoptic masks is not supported on Cloud TPUs. Running evaluation on Cloud TPUs is not supported for the same reason. However, training is both supported on Cloud TPUs and GPUs.
121
75
## Pretrained Models
122
76
Backbone | Schedule | Experiment name | Box mAP | Mask mAP | Overall PQ | Things PQ | Stuff PQ | Checkpoints
123
77
:------------| :----------- | :---------------------------| ------- | ---------- | ---------- | --------- | -------- | ------------:
@@ -128,7 +82,6 @@ ResNet-50 | 3x | `panoptic_fpn_coco` | 40.64 | 36.29
128
82
129
83
___
130
84
## Citation
131
-
132
85
```
133
86
@misc{kirillov2019panoptic,
134
87
title={Panoptic Feature Pyramid Networks},
0 commit comments