提交 c1bb148f 编写于 作者: W Waleed Abdulla

Rename config.print() to display() for Python 2.7

上级 a12c1b81
......@@ -243,7 +243,7 @@ def build_coco_results(dataset, image_ids, rois, class_ids, scores, masks):
result = {
"image_id": image_id,
"category_id": dataset.get_source_class_id(class_id, "coco"),
"bbox": [bbox[1], bbox[0], bbox[3]-bbox[1], bbox[2]-bbox[0]],
"bbox": [bbox[1], bbox[0], bbox[3] - bbox[1], bbox[2] - bbox[0]],
"score": score,
"segmentation": maskUtils.encode(np.asfortranarray(mask))
}
......@@ -281,7 +281,7 @@ def evaluate_coco(dataset, coco, eval_type="bbox", limit=0):
t_prediction += (time.time() - t)
# Convert results to COCO format
image_results = build_coco_results(dataset, coco_image_ids[i:i+1],
image_results = build_coco_results(dataset, coco_image_ids[i:i + 1],
r["rois"], r["class_ids"],
r["scores"], r["masks"])
results.extend(image_results)
......@@ -297,15 +297,15 @@ def evaluate_coco(dataset, coco, eval_type="bbox", limit=0):
cocoEval.summarize()
print("Prediction time: {}. Average {}/image".format(
t_prediction, t_prediction/len(image_ids)))
t_prediction, t_prediction / len(image_ids)))
print("Total time: ", time.time() - t_start)
############################################################
# Training
############################################################
if __name__ == '__main__':
import argparse
......@@ -336,7 +336,7 @@ if __name__ == '__main__':
GPU_COUNT = 1
IMAGES_PER_GPU = 1
config = InferenceConfig()
config.print()
config.display()
# Create model
if args.command == "train":
......
......@@ -141,7 +141,8 @@ class Config(object):
self.BATCH_SIZE = self.IMAGES_PER_GPU * self.GPU_COUNT
# Input image size
self.IMAGE_SHAPE = np.array([self.IMAGE_MAX_DIM, self.IMAGE_MAX_DIM, 3])
self.IMAGE_SHAPE = np.array(
[self.IMAGE_MAX_DIM, self.IMAGE_MAX_DIM, 3])
# Compute backbone size from input image size
self.BACKBONE_SHAPES = np.array(
......@@ -149,7 +150,7 @@ class Config(object):
int(math.ceil(self.IMAGE_SHAPE[1] / stride))]
for stride in self.BACKBONE_STRIDES])
def print(self):
def display(self):
"""Display Configuration values."""
print("\nConfigurations:")
for a in dir(self):
......
......@@ -130,7 +130,7 @@
" IMAGES_PER_GPU = 1\n",
"\n",
"config = InferenceConfig()\n",
"config.print()"
"config.display()"
]
},
{
......@@ -151,7 +151,7 @@
" IMAGES_PER_GPU = 1\n",
"\n",
"config = InferenceConfig()\n",
"config.print()"
"config.display()"
]
},
{
......@@ -155,7 +155,7 @@
" VALIDATION_STPES = 5\n",
" \n",
"config = ShapesConfig()\n",
"config.print()"
"config.display()"
]
},
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册