DeepLabV3+预测单张图片代码实现和问题解决

本文介绍了在使用DeepLabV3+模型进行图片预测时遇到的问题及解决方案。问题一是export_model.py导出模型时,需确保crop_size与预测图片尺寸一致;问题二是正向传播过程中遇到未知错误,通过尝试新方法成功解决,同时分享了使用pdb进行Python代码调试的经验。
摘要由CSDN通过智能技术生成

问题一:在使用export_model.py进行导出模型并进行网络正向传播的过程中,出现错误:

2019-03-25 17:47:42.896918: W tensorflow/core/framework/allocator.cc:122] Allocation of 62720000 exceeds 10% of system memory.
2019-03-25 17:47:43.105534: W tensorflow/core/framework/allocator.cc:122] Allocation of 62720000 exceeds 10% of system memory.
2019-03-25 17:47:43.406195: W tensorflow/core/framework/allocator.cc:122] Allocation of 62720000 exceeds 10% of system memory.
2019-03-25 17:47:43.663981: W tensorflow/core/framework/allocator.cc:122] Allocation of 63438848 exceeds 10% of system memory.
2019-03-25 17:47:51.507348: W tensorflow/core/framework/op_kernel.cc:1273] OP_REQUIRES failed at spacetobatch_op.cc:219 : Invalid argument: padded_shape[0]=49 is not divisible by block_shape[0]=2
2019-03-25 17:47:53.206279: W tensorflow/core/framework/op_kernel.cc:1273] OP_REQUIRES failed at spacetobatch_op.cc:219 : Invalid argument: padded_shape[0]=49 is not divisible by block_shape[0]=2
Traceback (most recent call last):
  File "/home/pzn/anaconda3/envs/DeepLabV3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1334, in _do_call
    return fn(*args)
  File "/home/pzn/anaconda3/envs/DeepLabV3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1319, in _run_fn
    options, feed_dict, fetch_list, target_list, run_metadata)
  File "/home/pzn/anaconda3/envs/DeepLabV3/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1407, in _call_tf_sessionrun
    run_metadata)
tensorflow.python.framework.errors_impl.InvalidArgumentError: padded_shape[0]=49 is not divisible by block_shape[0]=2
	 [[{
  {node import/xception_65/exit_flow/block2/unit_1/xception_module/separable_conv1_depthwise/depthwise/SpaceToBatchND}} = SpaceToBatchND[T=DT_FLOAT, Tblock_shape=DT_INT32, Tpaddings=DT_INT32, _device="/job:localhost/replica:0/task:0/device:GPU:0"](import/xception_65/exit_flow/block1/unit_1/xception_module/add, import/xception_65/exit_flow/block2/unit_1/xception_module/separable_conv1_depthwise/depthwise/SpaceToBatchND/block_shape, import/xception_65/exit_flow/block2/unit_1/xception
评论 36
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值