Kaydet (Commit) 80f6e2d0 authored tarafından vcarpani's avatar vcarpani Kaydeden (comit) Hans Gaiser

Rename postprocess_image to cast_image_to_floatx.

üst 7899cd81
......@@ -33,7 +33,7 @@ from ..utils.image import (
apply_transform,
preprocess_image,
resize_image,
postprocess_image,
cast_image_to_floatx,
)
from ..utils.transform import transform_aabb
......@@ -54,7 +54,7 @@ class Generator(object):
compute_anchor_targets=anchor_targets_bbox,
compute_shapes=guess_shapes,
preprocess_image=preprocess_image,
postprocess_image=postprocess_image,
cast_image_to_floatx=cast_image_to_floatx,
config=None
):
""" Initialize Generator object.
......@@ -70,7 +70,7 @@ class Generator(object):
compute_anchor_targets : Function handler for computing the targets of anchors for an image and its annotations.
compute_shapes : Function handler for computing the shapes of the pyramid for a given input.
preprocess_image : Function handler for preprocessing an image (scaling / normalizing) for passing through a network.
postprocess_image : Function handler for postprocessing an image (converting to floatx) for passing through a network.
cast_image_to_floatx : Function handler for converting to floatx an image for passing through a network.
"""
self.transform_generator = transform_generator
self.batch_size = int(batch_size)
......@@ -82,7 +82,7 @@ class Generator(object):
self.compute_anchor_targets = compute_anchor_targets
self.compute_shapes = compute_shapes
self.preprocess_image = preprocess_image
self.postprocess_image = postprocess_image
self.cast_image_to_floatx = cast_image_to_floatx
self.config = config
self.group_index = 0
......@@ -226,7 +226,7 @@ class Generator(object):
annotations['bboxes'] *= image_scale
# convert to the wanted keras floatx
image = self.postprocess_image(image)
image = self.cast_image_to_floatx(image)
return image, annotations
......
......@@ -62,7 +62,7 @@ def preprocess_image(x, mode='caffe'):
return x
def postprocess_image(x):
def cast_image_to_floatx(x):
""" Convert an image to the actual keras floatx.
Args
......@@ -71,8 +71,6 @@ def postprocess_image(x):
Returns
The input in the keras floatx representation.
"""
# mostly identical to "https://github.com/keras-team/keras-applications/blob/master/keras_applications/imagenet_utils.py"
# except for converting RGB -> BGR since we assume BGR already
x = x.astype(keras.backend.floatx())
return x
......
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