提交 e33e38d1 编写于 作者: L LDOUBLEV

add error message when image shape are not divisible by 4

上级 a5f1efdf
......@@ -59,28 +59,23 @@ class DetModel(object):
return: (image, corresponding label, dataloader)
"""
image_shape = deepcopy(self.image_shape)
if image_shape[1] % 4 != 0 or image_shape[2] % 4 != 0:
raise Exception("The size of the image must be divisible by 4, "
"received image shape is {}, please reset the "
"Global.image_shape in the yml file".format(
image_shape))
image = fluid.layers.data(
name='image', shape=image_shape, dtype='float32')
if mode == "train":
if self.algorithm == "EAST":
h, w = int(image_shape[1] // 4), int(image_shape[2] // 4)
score = fluid.layers.data(
name='score',
shape=[
1, int(image_shape[1] // 4), int(image_shape[2] // 4)
],
dtype='float32')
name='score', shape=[1, h, w], dtype='float32')
geo = fluid.layers.data(
name='geo',
shape=[
9, int(image_shape[1] // 4), int(image_shape[2] // 4)
],
dtype='float32')
name='geo', shape=[9, h, w], dtype='float32')
mask = fluid.layers.data(
name='mask',
shape=[
1, int(image_shape[1] // 4), int(image_shape[2] // 4)
],
dtype='float32')
name='mask', shape=[1, h, w], dtype='float32')
feed_list = [image, score, geo, mask]
labels = {'score': score, 'geo': geo, 'mask': mask}
elif self.algorithm == "DB":
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册