Commit 70e20023 authored by Ross Girshick's avatar Ross Girshick Committed by Facebook Github Bot

Remove legacy multi-scale inference support

Reviewed By: ir413

Differential Revision: D7148425

fbshipit-source-id: 78c11427b0559248116ca1065b8252355f0034a3
parent 9b41e84b
......@@ -29,7 +29,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -29,7 +29,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -26,7 +26,7 @@ TRAIN:
BATCH_SIZE_PER_IM: 512
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 6000
......
......@@ -26,7 +26,7 @@ TRAIN:
BATCH_SIZE_PER_IM: 512
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 6000
......
......@@ -29,7 +29,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -29,7 +29,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -36,7 +36,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -36,7 +36,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -36,7 +36,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -37,7 +37,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -43,7 +43,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('keypoints_coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -43,7 +43,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('keypoints_coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -43,7 +43,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('keypoints_coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -43,7 +43,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('keypoints_coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -48,7 +48,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('keypoints_coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -48,7 +48,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('keypoints_coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -49,7 +49,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('keypoints_coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -49,7 +49,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('keypoints_coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -38,7 +38,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -38,7 +38,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -34,7 +34,7 @@ TRAIN:
BATCH_SIZE_PER_IM: 512
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 6000
......
......@@ -34,7 +34,7 @@ TRAIN:
BATCH_SIZE_PER_IM: 512
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 6000
......
......@@ -38,7 +38,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -38,7 +38,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -45,7 +45,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -45,7 +45,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -46,7 +46,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -46,7 +46,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -45,7 +45,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
BBOX_VOTE:
......
......@@ -30,7 +30,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998887/12_2017_baselines/rpn_R-101-FPN_1x.yaml.08_07_07.vzhHEs0V/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -30,7 +30,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998887/12_2017_baselines/rpn_R-101-FPN_1x.yaml.08_07_07.vzhHEs0V/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -28,7 +28,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998355/12_2017_baselines/rpn_R-50-C4_1x.yaml.08_00_43.njH5oD9L/output/test/coco_2014_minival/rpn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -28,7 +28,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998355/12_2017_baselines/rpn_R-50-C4_1x.yaml.08_00_43.njH5oD9L/output/test/coco_2014_minival/rpn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -30,7 +30,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998814/12_2017_baselines/rpn_R-50-FPN_1x.yaml.08_06_03.Axg0r179/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -30,7 +30,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998814/12_2017_baselines/rpn_R-50-FPN_1x.yaml.08_06_03.Axg0r179/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -37,7 +37,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/36760102/12_2017_baselines/rpn_X-101-32x8d-FPN_1x.yaml.06_00_16.RWeBAniO/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -37,7 +37,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/36760102/12_2017_baselines/rpn_X-101-32x8d-FPN_1x.yaml.06_00_16.RWeBAniO/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -37,7 +37,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998956/12_2017_baselines/rpn_X-101-64x4d-FPN_1x.yaml.08_08_41.Seh0psKz/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -37,7 +37,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998956/12_2017_baselines/rpn_X-101-64x4d-FPN_1x.yaml.08_08_41.Seh0psKz/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -44,7 +44,7 @@ TEST:
DATASETS: ('keypoints_coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35999521/12_2017_baselines/rpn_person_only_R-101-FPN_1x.yaml.08_20_33.1OkqMmqP/output/test/keypoints_coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -44,7 +44,7 @@ TEST:
DATASETS: ('keypoints_coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35999521/12_2017_baselines/rpn_person_only_R-101-FPN_1x.yaml.08_20_33.1OkqMmqP/output/test/keypoints_coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -44,7 +44,7 @@ TEST:
DATASETS: ('keypoints_coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998996/12_2017_baselines/rpn_person_only_R-50-FPN_1x.yaml.08_10_08.0ZWmJm6F/output/test/keypoints_coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -44,7 +44,7 @@ TEST:
DATASETS: ('keypoints_coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998996/12_2017_baselines/rpn_person_only_R-50-FPN_1x.yaml.08_10_08.0ZWmJm6F/output/test/keypoints_coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -49,7 +49,7 @@ TEST:
DATASETS: ('keypoints_coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/36760438/12_2017_baselines/rpn_person_only_X-101-32x8d-FPN_1x.yaml.06_04_23.M2oJlDPW/output/test/keypoints_coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -49,7 +49,7 @@ TEST:
DATASETS: ('keypoints_coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/36760438/12_2017_baselines/rpn_person_only_X-101-32x8d-FPN_1x.yaml.06_04_23.M2oJlDPW/output/test/keypoints_coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -50,7 +50,7 @@ TEST:
DATASETS: ('keypoints_coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35999553/12_2017_baselines/rpn_person_only_X-101-64x4d-FPN_1x.yaml.08_21_33.ghFzzArr/output/test/keypoints_coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -50,7 +50,7 @@ TEST:
DATASETS: ('keypoints_coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35999553/12_2017_baselines/rpn_person_only_X-101-64x4d-FPN_1x.yaml.08_21_33.ghFzzArr/output/test/keypoints_coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -39,7 +39,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998887/12_2017_baselines/rpn_R-101-FPN_1x.yaml.08_07_07.vzhHEs0V/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -39,7 +39,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998887/12_2017_baselines/rpn_R-101-FPN_1x.yaml.08_07_07.vzhHEs0V/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -36,7 +36,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998355/12_2017_baselines/rpn_R-50-C4_1x.yaml.08_00_43.njH5oD9L/output/test/coco_2014_minival/rpn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -36,7 +36,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998355/12_2017_baselines/rpn_R-50-C4_1x.yaml.08_00_43.njH5oD9L/output/test/coco_2014_minival/rpn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -39,7 +39,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998814/12_2017_baselines/rpn_R-50-FPN_1x.yaml.08_06_03.Axg0r179/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -39,7 +39,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998814/12_2017_baselines/rpn_R-50-FPN_1x.yaml.08_06_03.Axg0r179/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -46,7 +46,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/36760102/12_2017_baselines/rpn_X-101-32x8d-FPN_1x.yaml.06_00_16.RWeBAniO/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -46,7 +46,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/36760102/12_2017_baselines/rpn_X-101-32x8d-FPN_1x.yaml.06_00_16.RWeBAniO/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -47,7 +47,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998956/12_2017_baselines/rpn_X-101-64x4d-FPN_1x.yaml.08_08_41.Seh0psKz/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -47,7 +47,7 @@ TEST:
DATASETS: ('coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998956/12_2017_baselines/rpn_X-101-64x4d-FPN_1x.yaml.08_08_41.Seh0psKz/output/test/coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
OUTPUT_DIR: .
......@@ -33,7 +33,7 @@ TRAIN:
RPN_STRADDLE_THRESH: -1 # default 0
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 10000 # Per FPN level
......
......@@ -33,7 +33,7 @@ TRAIN:
RPN_STRADDLE_THRESH: -1 # default 0
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 10000 # Per FPN level
......
......@@ -33,7 +33,7 @@ TRAIN:
RPN_STRADDLE_THRESH: -1 # default 0
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 10000 # Per FPN level
......
......@@ -33,7 +33,7 @@ TRAIN:
RPN_STRADDLE_THRESH: -1 # default 0
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 10000 # Per FPN level
......
......@@ -38,7 +38,7 @@ TRAIN:
RPN_STRADDLE_THRESH: -1 # default 0
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 10000 # Per FPN level
......
......@@ -38,7 +38,7 @@ TRAIN:
RPN_STRADDLE_THRESH: -1 # default 0
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 10000 # Per FPN level
......
......@@ -38,7 +38,7 @@ TRAIN:
RPN_STRADDLE_THRESH: -1 # default 0
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 10000 # Per FPN level
......
......@@ -38,7 +38,7 @@ TRAIN:
RPN_STRADDLE_THRESH: -1 # default 0
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 10000 # Per FPN level
......
......@@ -25,7 +25,7 @@ TRAIN:
MAX_SIZE: 1333
TEST:
DATASETS: ('coco_2014_minival','coco_2014_train','coco_2014_valminusminival')
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
RPN_POST_NMS_TOP_N: 2000
......
......@@ -20,7 +20,7 @@ TRAIN:
MAX_SIZE: 1333
TEST:
DATASETS: ('coco_2014_minival','coco_2014_train','coco_2014_valminusminival')
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
USE_NCCL: False
OUTPUT_DIR: .
......@@ -25,7 +25,7 @@ TRAIN:
MAX_SIZE: 1333
TEST:
DATASETS: ('coco_2014_minival','coco_2014_train','coco_2014_valminusminival')
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
RPN_POST_NMS_TOP_N: 2000
......
......@@ -30,7 +30,7 @@ TRAIN:
MAX_SIZE: 1333
TEST:
DATASETS: ('coco_2014_minival','coco_2014_train','coco_2014_valminusminival')
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
RPN_POST_NMS_TOP_N: 2000
......
......@@ -30,7 +30,7 @@ TRAIN:
MAX_SIZE: 1333
TEST:
DATASETS: ('coco_2014_minival','coco_2014_train','coco_2014_valminusminival')
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
RPN_POST_NMS_TOP_N: 2000
......
......@@ -25,7 +25,7 @@ TRAIN:
MAX_SIZE: 1333
TEST:
DATASETS: ('keypoints_coco_2014_minival', 'keypoints_coco_2014_train', 'keypoints_coco_2014_valminusminival', 'keypoints_coco_2015_test')
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
RPN_POST_NMS_TOP_N: 2000
......
......@@ -25,7 +25,7 @@ TRAIN:
MAX_SIZE: 1333
TEST:
DATASETS: ('keypoints_coco_2014_minival', 'keypoints_coco_2014_train', 'keypoints_coco_2014_valminusminival', 'keypoints_coco_2015_test')
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
RPN_POST_NMS_TOP_N: 2000
......
......@@ -30,7 +30,7 @@ TRAIN:
MAX_SIZE: 1333
TEST:
DATASETS: ('keypoints_coco_2014_minival', 'keypoints_coco_2014_train', 'keypoints_coco_2014_valminusminival', 'keypoints_coco_2015_test')
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
RPN_POST_NMS_TOP_N: 2000
......
......@@ -30,7 +30,7 @@ TRAIN:
MAX_SIZE: 1333
TEST:
DATASETS: ('keypoints_coco_2014_minival', 'keypoints_coco_2014_train', 'keypoints_coco_2014_valminusminival', 'keypoints_coco_2015_test')
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
RPN_POST_NMS_TOP_N: 2000
......
......@@ -46,7 +46,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (500,)
SCALE: 500
MAX_SIZE: 833
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -46,7 +46,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (500,)
SCALE: 500
MAX_SIZE: 833
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -46,7 +46,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (500,)
SCALE: 500
MAX_SIZE: 833
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -46,7 +46,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (500,)
SCALE: 500
MAX_SIZE: 833
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -38,7 +38,7 @@ TRAIN:
RPN_PRE_NMS_TOP_N: 2000 # Per FPN level
TEST:
DATASETS: ('coco_2014_minival',)
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
RPN_PRE_NMS_TOP_N: 1000 # Per FPN level
......
......@@ -44,7 +44,7 @@ TEST:
DATASETS: ('keypoints_coco_2014_minival',)
PROPOSAL_FILES: ('https://s3-us-west-2.amazonaws.com/detectron/35998996/12_2017_baselines/rpn_person_only_R-50-FPN_1x.yaml.08_10_08.0ZWmJm6F/output/test/keypoints_coco_2014_minival/generalized_rcnn/rpn_proposals.pkl',)
PROPOSAL_LIMIT: 1000
SCALES: (800,)
SCALE: 800
MAX_SIZE: 1333
NMS: 0.5
WEIGHTS: https://s3-us-west-2.amazonaws.com/detectron/37651887/12_2017_baselines/keypoint_rcnn_R-50-FPN_s1x.yaml.20_01_40.FDjUQ7VX/output/train/keypoints_coco_2014_train%3Akeypoints_coco_2014_valminusminival/generalized_rcnn/model_final.pkl
......
......@@ -213,11 +213,8 @@ __C.TEST.WEIGHTS = b''
# If multiple datasets are listed, testing is performed on each one sequentially
__C.TEST.DATASETS = ()
# Scales to use during testing
# Each scale is the pixel size of an image's shortest side
# If multiple scales are given, then all scales are used as in multiscale
# inference
__C.TEST.SCALES = (600, )
# Scale to use during testing
__C.TEST.SCALE = 600
# Max pixel size of the longest side of a scaled input image
__C.TEST.MAX_SIZE = 1000
......@@ -968,7 +965,7 @@ __C.CLUSTER.ON_CLUSTER = False
# yaml configs, you can add the full config key as a string to the set below.
# ---------------------------------------------------------------------------- #
_DEPCRECATED_KEYS = set(
(
{
'FINAL_MSG',
'MODEL.DILATION',
'ROOT_GPU_ID',
......@@ -977,7 +974,7 @@ _DEPCRECATED_KEYS = set(
'TRAIN.DROPOUT',
'USE_GPU_NMS',
'TEST.NUM_TEST_IMAGES',
)
}
)
# ---------------------------------------------------------------------------- #
......@@ -1006,6 +1003,11 @@ _RENAMED_KEYS = {
"'path/to/file1:path/to/file2' -> " +
"('path/to/file1', 'path/to/file2')"
),
'TEST.SCALES': (
'TEST.SCALE',
"Also convert from a tuple, e.g. (600, ), " +
"to a integer, e.g. 600."
),
}
......
......@@ -42,9 +42,9 @@ from core.config import cfg
from datasets import task_evaluation
from datasets.json_dataset import JsonDataset
from modeling import model_builder
from utils.blob import im_list_to_blob
from utils.io import save_object
from utils.timer import Timer
import utils.blob as blob_utils
import utils.c2 as c2_utils
import utils.env as envu
import utils.net as nu
......@@ -186,8 +186,8 @@ def generate_proposals_on_roidb(
def im_proposals(model, im):
"""Generate RPN proposals on a single image."""
inputs = {}
inputs['data'], inputs['im_info'] = _get_image_blob(im)
scale = inputs['im_info'][0, 2]
inputs['data'], im_scale, inputs['im_info'] = \
blob_utils.get_image_blob_for_inference(im)
for k, v in inputs.items():
workspace.FeedBlob(core.ScopedName(k), v.astype(np.float32, copy=False))
workspace.RunNet(model.net.Proto().name)
......@@ -224,7 +224,7 @@ def im_proposals(model, im):
# Column 0 is the batch index in the (batch ind, x1, y1, x2, y2) encoding,
# so we remove it since we just want to return boxes
# Scale proposals back to the original input image scale
boxes = boxes[:, 1:] / scale
boxes = boxes[:, 1:] / im_scale
return boxes, scores
......@@ -255,41 +255,3 @@ def evaluate_proposal_file(dataset, proposal_file, output_dir):
recall_file = os.path.join(output_dir, 'rpn_proposal_recall.pkl')
save_object(results, recall_file)
return results
def _get_image_blob(im):
"""Converts an image into a network input.
Arguments:
im (ndarray): a color image in BGR order
Returns:
blob (ndarray): a data blob holding an image pyramid
im_scale_factors (list): list of image scales (relative to im) used
in the image pyramid
"""
im_orig = im.astype(np.float32, copy=True)
im_orig -= cfg.PIXEL_MEANS
im_shape = im_orig.shape
im_size_min = np.min(im_shape[0:2])
im_size_max = np.max(im_shape[0:2])
processed_ims = []
assert len(cfg.TEST.SCALES) == 1
target_size = cfg.TEST.SCALES[0]
im_scale = float(target_size) / float(im_size_min)
# Prevent the biggest axis from being more than MAX_SIZE
if np.round(im_scale * im_size_max) > cfg.TEST.MAX_SIZE:
im_scale = float(cfg.TEST.MAX_SIZE) / float(im_size_max)
im = cv2.resize(im_orig, None, None, fx=im_scale, fy=im_scale,
interpolation=cv2.INTER_LINEAR)
im_info = np.hstack((im.shape[:2], im_scale))[np.newaxis, :]
processed_ims.append(im)
# Create a blob to hold the input images
blob = im_list_to_blob(processed_ims)
return blob, im_info
......@@ -60,9 +60,9 @@ def im_detect_all(model, im, box_proposals, timers=None):
timers['im_detect_bbox'].tic()
if cfg.TEST.BBOX_AUG.ENABLED:
scores, boxes, im_scales = im_detect_bbox_aug(model, im, box_proposals)
scores, boxes, im_scale = im_detect_bbox_aug(model, im, box_proposals)
else:
scores, boxes, im_scales = im_detect_bbox(model, im, box_proposals)
scores, boxes, im_scale = im_detect_bbox(model, im, box_proposals)
timers['im_detect_bbox'].toc()
# score and boxes are from the whole image after score thresholding and nms
......@@ -78,7 +78,7 @@ def im_detect_all(model, im, box_proposals, timers=None):
if cfg.TEST.MASK_AUG.ENABLED:
masks = im_detect_mask_aug(model, im, boxes)
else:
masks = im_detect_mask(model, im_scales, boxes)
masks = im_detect_mask(model, im_scale, boxes)
timers['im_detect_mask'].toc()
timers['misc_mask'].tic()
......@@ -94,7 +94,7 @@ def im_detect_all(model, im, box_proposals, timers=None):
if cfg.TEST.KPS_AUG.ENABLED:
heatmaps = im_detect_keypoints_aug(model, im, boxes)
else:
heatmaps = im_detect_keypoints(model, im_scales, boxes)
heatmaps = im_detect_keypoints(model, im_scale, boxes)
timers['im_detect_keypoints'].toc()
timers['misc_keypoints'].tic()
......@@ -108,10 +108,10 @@ def im_detect_all(model, im, box_proposals, timers=None):
def im_conv_body_only(model, im):
"""Runs `model.conv_body_net` on the given image `im`."""
im_blob, im_scale_factors = _get_image_blob(im)
im_blob, im_scale, _im_info = blob_utils.get_image_blob_for_inference(im)
workspace.FeedBlob(core.ScopedName('data'), im_blob)
workspace.RunNet(model.conv_body_net.Proto().name)
return im_scale_factors
return im_scale
def im_detect_bbox(model, im, boxes=None):
......@@ -130,7 +130,7 @@ def im_detect_bbox(model, im, boxes=None):
im_scales (list): list of image scales used in the input blob (as
returned by _get_blobs and for use with im_detect_mask, etc.)
"""
inputs, im_scales = _get_blobs(im, boxes)
inputs, im_scale = _get_blobs(im, boxes)
# When mapping from image ROIs to feature map ROIs, there's some aliasing
# (some distinct image ROIs get mapped to the same feature ROI).
......@@ -155,11 +155,9 @@ def im_detect_bbox(model, im, boxes=None):
# Read out blobs
if cfg.MODEL.FASTER_RCNN:
assert len(im_scales) == 1, \
'Only single-image / single-scale batch implemented'
rois = workspace.FetchBlob(core.ScopedName('rois'))
# unscale back to raw image space
boxes = rois[:, 1:5] / im_scales[0]
boxes = rois[:, 1:5] / im_scale
# Softmax class probabilities
scores = workspace.FetchBlob(core.ScopedName('cls_prob')).squeeze()
......@@ -189,7 +187,7 @@ def im_detect_bbox(model, im, boxes=None):
scores = scores[inv_index, :]
pred_boxes = pred_boxes[inv_index, :]
return scores, pred_boxes, im_scales
return scores, pred_boxes, im_scale
def im_detect_bbox_aug(model, im, box_proposals=None):
......@@ -218,7 +216,7 @@ def im_detect_bbox_aug(model, im, box_proposals=None):
# Perform detection on the horizontally flipped image
if cfg.TEST.BBOX_AUG.H_FLIP:
scores_hf, boxes_hf, _im_scales_hf = im_detect_bbox_hflip(
scores_hf, boxes_hf, _ = im_detect_bbox_hflip(
model, im, box_proposals
)
add_preds_t(scores_hf, boxes_hf)
......@@ -253,7 +251,7 @@ def im_detect_bbox_aug(model, im, box_proposals=None):
# Compute detections for the original image (identity transform) last to
# ensure that the Caffe2 workspace is populated with blobs corresponding
# to the original image on return (postcondition of im_detect_bbox)
scores_i, boxes_i, im_scales_i = im_detect_bbox(model, im, box_proposals)
scores_i, boxes_i, im_scale_i = im_detect_bbox(model, im, box_proposals)
add_preds_t(scores_i, boxes_i)
# Combine the predicted scores
......@@ -280,7 +278,7 @@ def im_detect_bbox_aug(model, im, box_proposals=None):
'Coord heur {} not supported'.format(cfg.TEST.BBOX_AUG.COORD_HEUR)
)
return scores_c, boxes_c, im_scales_i
return scores_c, boxes_c, im_scale_i
def im_detect_bbox_hflip(model, im, box_proposals=None):
......@@ -296,14 +294,14 @@ def im_detect_bbox_hflip(model, im, box_proposals=None):
else:
box_proposals_hf = None
scores_hf, boxes_hf, im_scales = im_detect_bbox(
scores_hf, boxes_hf, im_scale = im_detect_bbox(
model, im_hf, box_proposals_hf
)
# Invert the detections computed on the flipped image
boxes_inv = box_utils.flip_boxes(boxes_hf, im_width)
return scores_hf, boxes_inv, im_scales
return scores_hf, boxes_inv, im_scale
def im_detect_bbox_scale(
......@@ -313,11 +311,11 @@ def im_detect_bbox_scale(
Returns predictions in the original image space.
"""
# Remember the original scale
orig_scales = cfg.TEST.SCALES
orig_scale = cfg.TEST.SCALE
orig_max_size = cfg.TEST.MAX_SIZE
# Perform detection at the given scale
cfg.TEST.SCALES = (scale, )
cfg.TEST.SCALE = scale
cfg.TEST.MAX_SIZE = max_size
if hflip:
......@@ -328,7 +326,7 @@ def im_detect_bbox_scale(
scores_scl, boxes_scl, _ = im_detect_bbox(model, im, box_proposals)
# Restore the original scale
cfg.TEST.SCALES = orig_scales
cfg.TEST.SCALE = orig_scale
cfg.TEST.MAX_SIZE = orig_max_size
return scores_scl, boxes_scl
......@@ -361,7 +359,7 @@ def im_detect_bbox_aspect_ratio(
return scores_ar, boxes_inv
def im_detect_mask(model, im_scales, boxes):
def im_detect_mask(model, im_scale, boxes):
"""Infer instance segmentation masks. This function must be called after
im_detect_bbox as it assumes that the Caffe2 workspace is already populated
with the necessary blobs.
......@@ -377,15 +375,12 @@ def im_detect_mask(model, im_scales, boxes):
output by the network (must be processed by segm_results to convert
into hard masks in the original image coordinate space)
"""
assert len(im_scales) == 1, \
'Only single-image / single-scale batch implemented'
M = cfg.MRCNN.RESOLUTION
if boxes.shape[0] == 0:
pred_masks = np.zeros((0, M, M), np.float32)
return pred_masks
inputs = {'mask_rois': _get_rois_blob(boxes, im_scales)}
inputs = {'mask_rois': _get_rois_blob(boxes, im_scale)}
# Add multi-level rois for FPN
if cfg.FPN.MULTILEVEL_ROIS:
_add_multilevel_rois_for_test(inputs, 'mask_rois')
......@@ -425,8 +420,8 @@ def im_detect_mask_aug(model, im, boxes):
masks_ts = []
# Compute masks for the original image (identity transform)
im_scales_i = im_conv_body_only(model, im)
masks_i = im_detect_mask(model, im_scales_i, boxes)
im_scale_i = im_conv_body_only(model, im)
masks_i = im_detect_mask(model, im_scale_i, boxes)
masks_ts.append(masks_i)
# Perform mask detection on the horizontally flipped image
......@@ -486,8 +481,8 @@ def im_detect_mask_hflip(model, im, boxes):
im_hf = im[:, ::-1, :]
boxes_hf = box_utils.flip_boxes(boxes, im.shape[1])
im_scales = im_conv_body_only(model, im_hf)
masks_hf = im_detect_mask(model, im_scales, boxes_hf)
im_scale = im_conv_body_only(model, im_hf)
masks_hf = im_detect_mask(model, im_scale, boxes_hf)
# Invert the predicted soft masks
masks_inv = masks_hf[:, :, :, ::-1]
......@@ -499,21 +494,21 @@ def im_detect_mask_scale(model, im, scale, max_size, boxes, hflip=False):
"""Computes masks at the given scale."""
# Remember the original scale
orig_scales = cfg.TEST.SCALES
orig_scale = cfg.TEST.SCALE
orig_max_size = cfg.TEST.MAX_SIZE
# Perform mask detection at the given scale
cfg.TEST.SCALES = (scale, )
cfg.TEST.SCALE = scale
cfg.TEST.MAX_SIZE = max_size
if hflip:
masks_scl = im_detect_mask_hflip(model, im, boxes)
else:
im_scales = im_conv_body_only(model, im)
masks_scl = im_detect_mask(model, im_scales, boxes)
im_scale = im_conv_body_only(model, im)
masks_scl = im_detect_mask(model, im_scale, boxes)
# Restore the original scale
cfg.TEST.SCALES = orig_scales
cfg.TEST.SCALE = orig_scale
cfg.TEST.MAX_SIZE = orig_max_size
return masks_scl
......@@ -529,13 +524,13 @@ def im_detect_mask_aspect_ratio(model, im, aspect_ratio, boxes, hflip=False):
if hflip:
masks_ar = im_detect_mask_hflip(model, im_ar, boxes_ar)
else:
im_scales = im_conv_body_only(model, im_ar)
masks_ar = im_detect_mask(model, im_scales, boxes_ar)
im_scale = im_conv_body_only(model, im_ar)
masks_ar = im_detect_mask(model, im_scale, boxes_ar)
return masks_ar
def im_detect_keypoints(model, im_scales, boxes):
def im_detect_keypoints(model, im_scale, boxes):
"""Infer instance keypoint poses. This function must be called after
im_detect_bbox as it assumes that the Caffe2 workspace is already populated
with the necessary blobs.
......@@ -552,15 +547,12 @@ def im_detect_keypoints(model, im_scales, boxes):
by the network (must be processed by keypoint_results to convert
into point predictions in the original image coordinate space)
"""
assert len(im_scales) == 1, \
'Only single-image / single-scale batch implemented'
M = cfg.KRCNN.HEATMAP_SIZE
if boxes.shape[0] == 0:
pred_heatmaps = np.zeros((0, cfg.KRCNN.NUM_KEYPOINTS, M, M), np.float32)
return pred_heatmaps
inputs = {'keypoint_rois': _get_rois_blob(boxes, im_scales)}
inputs = {'keypoint_rois': _get_rois_blob(boxes, im_scale)}
# Add multi-level rois for FPN
if cfg.FPN.MULTILEVEL_ROIS:
......@@ -603,8 +595,8 @@ def im_detect_keypoints_aug(model, im, boxes):
us_ts.append(us_t)
# Compute the heatmaps for the original image (identity transform)
im_scales = im_conv_body_only(model, im)
heatmaps_i = im_detect_keypoints(model, im_scales, boxes)
im_scale = im_conv_body_only(model, im)
heatmaps_i = im_detect_keypoints(model, im_scale, boxes)
add_heatmaps_t(heatmaps_i)
# Perform keypoints detection on the horizontally flipped image
......@@ -614,8 +606,8 @@ def im_detect_keypoints_aug(model, im, boxes):
# Compute detections at different scales
for scale in cfg.TEST.KPS_AUG.SCALES:
ds_scl = scale < cfg.TEST.SCALES[0]
us_scl = scale > cfg.TEST.SCALES[0]
ds_scl = scale < cfg.TEST.SCALE
us_scl = scale > cfg.TEST.SCALE
heatmaps_scl = im_detect_keypoints_scale(
model, im, scale, cfg.TEST.KPS_AUG.MAX_SIZE, boxes
)
......@@ -672,8 +664,8 @@ def im_detect_keypoints_hflip(model, im, boxes):
im_hf = im[:, ::-1, :]
boxes_hf = box_utils.flip_boxes(boxes, im.shape[1])
im_scales = im_conv_body_only(model, im_hf)
heatmaps_hf = im_detect_keypoints(model, im_scales, boxes_hf)
im_scale = im_conv_body_only(model, im_hf)
heatmaps_hf = im_detect_keypoints(model, im_scale, boxes_hf)
# Invert the predicted keypoints
heatmaps_inv = keypoint_utils.flip_heatmaps(heatmaps_hf)
......@@ -685,21 +677,21 @@ def im_detect_keypoints_scale(model, im, scale, max_size, boxes, hflip=False):
"""Computes keypoint predictions at the given scale."""
# Store the original scale
orig_scales = cfg.TEST.SCALES
orig_scale = cfg.TEST.SCALE
orig_max_size = cfg.TEST.MAX_SIZE
# Perform detection at the given scale
cfg.TEST.SCALES = (scale, )
cfg.TEST.SCALE = scale
cfg.TEST.MAX_SIZE = max_size
if hflip:
heatmaps_scl = im_detect_keypoints_hflip(model, im, boxes)
else:
im_scales = im_conv_body_only(model, im)
heatmaps_scl = im_detect_keypoints(model, im_scales, boxes)
im_scale = im_conv_body_only(model, im)
heatmaps_scl = im_detect_keypoints(model, im_scale, boxes)
# Restore the original scale
cfg.TEST.SCALES = orig_scales
cfg.TEST.SCALE = orig_scale
cfg.TEST.MAX_SIZE = orig_max_size
return heatmaps_scl
......@@ -717,8 +709,8 @@ def im_detect_keypoints_aspect_ratio(
if hflip:
heatmaps_ar = im_detect_keypoints_hflip(model, im_ar, boxes_ar)
else:
im_scales = im_conv_body_only(model, im_ar)
heatmaps_ar = im_detect_keypoints(model, im_scales, boxes_ar)
im_scale = im_conv_body_only(model, im_ar)
heatmaps_ar = im_detect_keypoints(model, im_scale, boxes_ar)
return heatmaps_ar
......@@ -891,25 +883,7 @@ def keypoint_results(cls_boxes, pred_heatmaps, ref_boxes):
return cls_keyps
def _get_image_blob(im):
"""Converts an image into a network input.
Arguments:
im (ndarray): a color image in BGR order
Returns:
blob (ndarray): a data blob holding an image pyramid
im_scale_factors (ndarray): array of image scales (relative to im) used
in the image pyramid
"""
processed_ims, im_scale_factors = blob_utils.prep_im_for_blob(
im, cfg.PIXEL_MEANS, cfg.TEST.SCALES, cfg.TEST.MAX_SIZE
)
blob = blob_utils.im_list_to_blob(processed_ims)
return blob, np.array(im_scale_factors)
def _get_rois_blob(im_rois, im_scale_factors):
def _get_rois_blob(im_rois, im_scale):
"""Converts RoIs into network inputs.
Arguments:
......@@ -920,7 +894,7 @@ def _get_rois_blob(im_rois, im_scale_factors):
blob (ndarray): R x 5 matrix of RoIs in the image pyramid with columns
[level, x1, y1, x2, y2]
"""
rois, levels = _project_im_rois(im_rois, im_scale_factors)
rois, levels = _project_im_rois(im_rois, im_scale)
rois_blob = np.hstack((levels, rois))
return rois_blob.astype(np.float32, copy=False)
......@@ -936,21 +910,8 @@ def _project_im_rois(im_rois, scales):
rois (ndarray): R x 4 matrix of projected RoI coordinates
levels (ndarray): image pyramid levels used by each projected RoI
"""
im_rois = im_rois.astype(np.float, copy=False)
if len(scales) > 1:
widths = im_rois[:, 2] - im_rois[:, 0] + 1
heights = im_rois[:, 3] - im_rois[:, 1] + 1
areas = widths * heights
scaled_areas = areas[:, np.newaxis] * (scales[np.newaxis, :]**2)
diff_areas = np.abs(scaled_areas - 224 * 224)
levels = diff_areas.argmin(axis=1)[:, np.newaxis]
else:
rois = im_rois.astype(np.float, copy=False) * scales
levels = np.zeros((im_rois.shape[0], 1), dtype=np.int)
rois = im_rois * scales[levels]
return rois, levels
......@@ -978,11 +939,8 @@ def _add_multilevel_rois_for_test(blobs, name):
def _get_blobs(im, rois):
"""Convert an image and RoIs within that image into network inputs."""
blobs = {}
blobs['data'], im_scale_factors = _get_image_blob(im)
if cfg.MODEL.FASTER_RCNN and rois is None:
height, width = blobs['data'].shape[2], blobs['data'].shape[3]
scale = im_scale_factors[0]
blobs['im_info'] = np.array([[height, width, scale]], dtype=np.float32)
blobs['data'], im_scale, blobs['im_info'] = \
blob_utils.get_image_blob_for_inference(im)
if rois is not None:
blobs['rois'] = _get_rois_blob(rois, im_scale_factors)
return blobs, im_scale_factors
blobs['rois'] = _get_rois_blob(rois, im_scale)
return blobs, im_scale
......@@ -27,10 +27,10 @@ from collections import defaultdict
from caffe2.python import core, workspace
from core.config import cfg
from core.rpn_generator import _get_image_blob
from modeling.generate_anchors import generate_anchors
from utils.timer import Timer
import utils.blob as blob_utils
import utils.boxes as box_utils
logger = logging.getLogger(__name__)
......@@ -76,7 +76,8 @@ def im_detect_bbox(model, im, timers=None):
k_max, k_min = cfg.FPN.RPN_MAX_LEVEL, cfg.FPN.RPN_MIN_LEVEL
A = cfg.RETINANET.SCALES_PER_OCTAVE * len(cfg.RETINANET.ASPECT_RATIOS)
inputs = {}
inputs['data'], inputs['im_info'] = _get_image_blob(im)
inputs['data'], im_scale, inputs['im_info'] = \
blob_utils.get_image_blob_for_inference(im)
cls_probs, box_preds = [], []
for lvl in range(k_min, k_max + 1):
suffix = 'fpn{}'.format(lvl)
......@@ -86,7 +87,6 @@ def im_detect_bbox(model, im, timers=None):
workspace.FeedBlob(core.ScopedName(k), v.astype(np.float32, copy=False))
workspace.RunNet(model.net.Proto().name)
scale = inputs['im_info'][0, 2]
cls_probs = workspace.FetchBlobs(cls_probs)
box_preds = workspace.FetchBlobs(box_preds)
......@@ -147,7 +147,7 @@ def im_detect_bbox(model, im, timers=None):
pred_boxes = (
box_utils.bbox_transform(boxes, box_deltas)
if cfg.TEST.BBOX_REG else boxes)
pred_boxes /= scale
pred_boxes /= im_scale
pred_boxes = box_utils.clip_tiled_boxes(pred_boxes, im.shape)
box_scores = np.zeros((pred_boxes.shape[0], 5))
box_scores[:, 0:4] = pred_boxes
......
......@@ -105,7 +105,7 @@ def _get_image_blob(roidb):
im = im[:, ::-1, :]
target_size = cfg.TRAIN.SCALES[scale_inds[i]]
im, im_scale = blob_utils.prep_im_for_blob(
im, cfg.PIXEL_MEANS, [target_size], cfg.TRAIN.MAX_SIZE
im, cfg.PIXEL_MEANS, target_size, cfg.TRAIN.MAX_SIZE
)
im_scales.append(im_scale[0])
processed_ims.append(im[0])
......
......@@ -37,6 +37,33 @@ from caffe2.proto import caffe2_pb2
from core.config import cfg
def get_image_blob_for_inference(im):
"""Converts an image into a network input.
Arguments:
im (ndarray): a color image in BGR order
Returns:
blob (ndarray): a data blob holding an image pyramid
im_scale (float): image scale (target size) / (original size)
im_info (ndarray)
"""
processed_im, im_scale = prep_im_for_blob(
im, cfg.PIXEL_MEANS, cfg.TEST.SCALE, cfg.TEST.MAX_SIZE
)
blob = im_list_to_blob(processed_im)
# NOTE: this height and width may be larger than actual scaled input image
# due to the FPN.COARSEST_STRIDE related padding in im_list_to_blob. We are
# maintaining this behavior for now to make existing results exactly
# reproducible (in practice using the true input image height and width
# yields nearly the same results, but they are sometimes slightly different
# because predictions near the edge of the image will be pruned more
# aggressively).
height, width = blob.shape[2], blob.shape[3]
im_info = np.hstack((height, width, im_scale))[np.newaxis, :]
return blob, im_scale, im_info.astype(np.float32)
def im_list_to_blob(ims):
"""Convert a list of images into a network input. Assumes images were
prepared using prep_im_for_blob or equivalent: i.e.
......@@ -47,6 +74,8 @@ def im_list_to_blob(ims):
Output is a 4D HCHW tensor of the images concatenated along axis 0 with
shape.
"""
if not isinstance(ims, list):
ims = [ims]
max_shape = np.array([im.shape for im in ims]).max(axis=0)
# Pad the image so they can be divisible by a stride
if cfg.FPN.FPN_ON:
......@@ -55,8 +84,9 @@ def im_list_to_blob(ims):
max_shape[1] = int(np.ceil(max_shape[1] / stride) * stride)
num_images = len(ims)
blob = np.zeros((num_images, max_shape[0], max_shape[1], 3),
dtype=np.float32)
blob = np.zeros(
(num_images, max_shape[0], max_shape[1], 3), dtype=np.float32
)
for i in range(num_images):
im = ims[i]
blob[i, 0:im.shape[0], 0:im.shape[1], :] = im
......@@ -67,7 +97,7 @@ def im_list_to_blob(ims):
return blob
def prep_im_for_blob(im, pixel_means, target_sizes, max_size):
def prep_im_for_blob(im, pixel_means, target_size, max_size):
"""Prepare an image for use as a network input blob. Specially:
- Subtract per-channel pixel mean
- Convert to float32
......@@ -80,19 +110,19 @@ def prep_im_for_blob(im, pixel_means, target_sizes, max_size):
im_shape = im.shape
im_size_min = np.min(im_shape[0:2])
im_size_max = np.max(im_shape[0:2])
ims = []
im_scales = []
for target_size in target_sizes:
im_scale = float(target_size) / float(im_size_min)
# Prevent the biggest axis from being more than max_size
if np.round(im_scale * im_size_max) > max_size:
im_scale = float(max_size) / float(im_size_max)
im = cv2.resize(im, None, None, fx=im_scale, fy=im_scale,
interpolation=cv2.INTER_LINEAR)
ims.append(im)
im_scales.append(im_scale)
return ims, im_scales
im = cv2.resize(
im,
None,
None,
fx=im_scale,
fy=im_scale,
interpolation=cv2.INTER_LINEAR
)
return im, im_scale
def zeros(shape, int32=False):
......
......@@ -434,8 +434,6 @@ def _prepare_blobs(
def run_model_pb(args, net, init_net, im, check_blobs):
assert len(cfg.TEST.SCALES) == 1
workspace.ResetWorkspace()
workspace.RunNetOnce(init_net)
mutils.create_input_blobs_for_net(net.Proto())
......@@ -445,7 +443,7 @@ def run_model_pb(args, net, init_net, im, check_blobs):
input_blobs = _prepare_blobs(
im,
cfg.PIXEL_MEANS,
cfg.TEST.SCALES[0], cfg.TEST.MAX_SIZE
cfg.TEST.SCALE, cfg.TEST.MAX_SIZE
)
gpu_blobs = []
if args.device == 'gpu':
......
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