搞了几天终于把这个给搞得差不多了,遇到的错误这里也记录一下:
一、配置【配置什么的300和512其实差不多,这里只举一个例子来分析一下】
之前的文件修改什么的和300x300的一样:https://www.cnblogs.com/GrPhoenix/p/10018072.html
从自己训练的ssd_300_vgg模型开始训练ssd_512_vgg的模型
因ssd_300_vgg中没有block12,又因为block7,block8,block9,block10,block11,中的参数张量两个网络模型中不匹配,因此ssd_512_vgg中这几个模块的参数不从ssd_300_vgg模型中继承,因此使用checkpoint_exclude_scopes命令指出。
因为所有的参数均需要训练,因此不使用命令--trainable_scopes
另外由300转512后还需修改:
1. 首先修改ssd_vgg_512.py的训练类别
2.修改train_ssd_network.py的model_name
修改为ssd_512_vgg
3. 修改nets/np_methods.py
修改:将300改为512, 将类别改为自己数据的类别(+背景)
4. 修改preprocessing/ssd_vgg_preprocessing.py
修改:将300改为512
5. 修改ssd_notbook.ipynb
a 将文件中数字“300”改为“512”
其他修改可以参考:http://blog.csdn.net/liuyan20062010/article/details/78905517
二、我遇到的错误:
InvalidArgumentError (see above for traceback): Restoring from checkpoint failed. This is most likely due to a mismatch between the current graph and the graph from the checkpoint. Please ensure that you have not altered the graph expected based on the checkpoint. Original error:
Assign requires shapes of both tensors to match. lhs shape= [84] rhs shape= [8]
[[{{node save/Assign_20}} = Assign[T=DT_FLOAT, _class=["loc:@ssd_512_vgg/block12_box/conv_cls/biases"], use_locking=true, validate_shape=true, _device="/job:localhost/replica:0/task:0/device:GPU:0"](ssd_512_vgg/block12_box/conv_cls/biases, save/RestoreV2/_41)]]
[[{{node save/RestoreV2/_104}} = _Send[T=DT_FLOAT, client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_110_save/RestoreV2", _device="/job:localhost/replica:0/task:0/device:CPU:0"](save/RestoreV2:52)]]
这类的问题本质上来说还是自己的配置不对,这个问题我查了很久,最后发现实在是太simpleT-T。
我的问题的话:在从300转到512的时候忘记改ssd_vgg_512.py的类别导致test的时候文件配置和训练的tensor shape不匹配TT...